... ; 20
21      public void initialize() {
22         // get URL of the video file
23         URL url = VideoPlayerController.class.getResource("sts117.mp4");
24
25         // create a Media object for the specified URL
26         Media media = new Media(url.toExternalForm());
27
28         // create a MediaPlayer to control Media playback
29         Media media = new MediaPlayer(media);
30
31         // specify which MediaPlayer to display in the MediaView
32         mediaView.setMediaPlayer(mediaPlayer);
33
34         // set handler to be called when the video completes playing
35         mediaPlayer. setOnEndOfMedia(
36            new Runnable() {
37               public void run() {
38                  playing = false;
39                  playPauseButton.setText("Play");
40                  mediaPlayer.seek(Duration.ZERO);
41                  mediaPlayer.pause();            
42               }
43            }
44         );
45
46         // set handler that displays an ...

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.