It has been possible for many years to play both audio and video in Java, but the application programming interfaces (APIs) that are provided to do this are complex. In JavaFX, it is almost trivial to embed a media player that will play some sound or a video clip into your application. The code shown in Listing 19-1 is all that it takes.
This code opens a short video hosted by Sun Microsystems and streams it onto your screen. As you can see, there are three key classes that cooperate to play the content of a video file:
MediaView is a node that renders video delivered by a