Java Reference
In-Depth Information
Duration.millis(10000));
media.getMarkers().put("Second marker",
Duration.millis(20000));
media.getMarkers().put("Last one...",
Duration.millis(30000));
// display closed caption
mediaPlayer.setOnMarker((MediaMarkerEvent event1) -> {
closedCaption.setText(event1.getMarker().getKey());
});
event.setDropCompleted(success);
event.consume();
}); // end of setOnDragDropped
The following code shows a factory method that returns an area that will contain
the closed caption to be displayed to the right of the video:
private VBox createClosedCaptionArea(final Scene scene) {
// create message area
final VBox messageArea = new VBox(3);
messageArea.setTranslateY(30);
messageArea.translateXProperty().bind(scene.widthProperty().subtract(152)
);
messageArea.setTranslateY(20);
closedCaption = new Text();
closedCaption.setStroke(Color.WHITE);
closedCaption.setFill(Color.YELLOW);
closedCaption.setFont(new Font(15));
messageArea.getChildren().add(closedCaption);
return messageArea;
}
Figure 16-5 depicts the video media player displaying the closed caption text.
 
Search WWH ::




Custom Search