You want to provide closed caption text while playing a video in the media player.
Begin by applying recipe 3-3. By obtaining the marked durations (in milliseconds) from the previous recipe you will create media marker events at points into the video. With each media marker you will associate text that will be displayed as closed captions. When a marker comes to pass, a text will be shown to the upper-right side.
The following code snippet demonstrates media marker events being handled in the
onDragDropped event property of the
... // inside the start() method final VBox messageArea = createClosedCaptionArea(scene); root.getChildren().add(messageArea); // Dropping over surface ...