In this chapter, we will cover the following topics:
F Accessing media assets
F Loading and displaying images with ImageView
F Applying effects and transformations to images
F Creating image effects with blending
F Playing audio with MediaPlayer
F Playing video with MediaView
F Creating a media playback component
One of the most celebrated features of JavaFX is its inherent support for media playback.
As of version 1.2, JavaFX has the ability to seamlessly load images in different formats, play
audio, and play video in several formats using its built-in components. To achieve platform
independence and performance, the support for media playback in JavaFX is implemented
as a two-tiered strategy:
F Platform-independent APIs —the JavaFX SDK comes with a media API
designed to provide a uniform set of interfaces to media functionalities.
Part of the platform-independence offerings include a portable codec
(On2's VP6), which will play on all platforms where JavaFX media playback
is supported .
F Platform-dependent implementations —to boost media playback performance,
JavaFX also has the ability to use the native media engine supported by the
underlying OS. For instance, playback on the Windows platform may be
rendered by the Windows DirectShow media engine (see next recipe).