This widget implements a media player with a customizable user-interface, suitable to play video or audio.
To support cross-browser playing of video or audio content, you may need
to provide appropriately encoded contents. For audio, at least an MP3 or
MP4 audio (M4A) encoding should be supplied, while for video the M4V
encoding should be provided. Additional encodings are beneficial since
they increase the chance that native HTML
<audio> elements can be used (which may be hardware
accelerated), instead of the flash player. See HTML5 browser media support.
You need to specify the encoding types you are going to use when
instantiating the media player, since based on the chosen encodings, a
particular suitable implementation will be used. Thus, you need to call
addSource() immediately, but you may pass empty URLs if you do
not yet want to load media.
The player provides a user-interface to control the playback which may be freely customized, and which is independent of the underlying media technology (HTML video or Flash player). The controls user-interface may be implemented as a Wt widget, where the controls (buttons, progress bars, and text widgets) are bound directly to the video player component (client-side).
The default user-interface can be themed using jPlayer themes. The theme
is global (it applies to all media player instances), and is configured
by loading a CSS stylesheet, e.g.
The following examples show a video and audio player using the default controls.
Alternatively, a custom widget may be set which implements the controls,
setControlsWidget(). In this case, you should add to this
widget the buttons, text placeholders, and progress bars and bind them
to the media player using the
setProgressBar() methods. The controls widget is integrated
in the media player, and this has as unique benefit (for a video player)
that they may also be shown when the video player is maximized.
Finally, you may want to control the media player only through widgets external to the media player. This may be configured by setting 0 as controlsWidget. In this case however, full screen mode should not be used since there is no way to restore the original size.