19. Video and Audio
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 MediaPlayer ...
Get JavaFX™ Developer’s Guide 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.