public class AudioMediaPlayerComponent extends MediaPlayerEventAdapter
Most implementation details, like creating a factory, are encapsulated.
The default implementation will work out-of-the-box, but there are various template methods available to sub-classes to tailor the behaviour of the component.
This class implements the most the most common use-case for an audio player and is intended to
enable a developer to get quickly started with the vlcj framework. More advanced applications are
free to directly use the MediaPlayerFactory
, if required, as has always been the case.
This component also adds implements the various media player listener interfaces, consequently an implementation sub-class can simply override those listener methods to handle events.
Applications can get a handle to the underlying media player object by invoking
getMediaPlayer()
.
To use, simply create an instance of this class.
In this minimal example, only two lines of code are required to create an audio player and play media:
mediaPlayerComponent = new AudioMediaPlayerComponent(); // <--- 1 mediaPlayerComponent.getMediaPlayer().playMedia(mrl); // <--- 2This is not quite as useful as the
EmbeddedMediaPlayerComponent
as audio players are
generally quite simple to create anyway.
An audio player may still have a user interface, but it will not have an associated video surface.
Constructor and Description |
---|
AudioMediaPlayerComponent()
Construct a media player component.
|
Modifier and Type | Method and Description |
---|---|
MediaPlayer |
getMediaPlayer()
Get the embedded media player reference.
|
MediaPlayerFactory |
getMediaPlayerFactory()
Get the media player factory reference.
|
void |
release()
Release the media player component and the associated native media player resources.
|
backward, buffering, endOfSubItems, error, finished, forward, lengthChanged, mediaChanged, mediaDurationChanged, mediaFreed, mediaMetaChanged, mediaParsedChanged, mediaStateChanged, mediaSubItemAdded, newMedia, opening, pausableChanged, paused, playing, positionChanged, seekableChanged, snapshotTaken, stopped, subItemFinished, subItemPlayed, timeChanged, titleChanged, videoOutput
public AudioMediaPlayerComponent()
public final MediaPlayerFactory getMediaPlayerFactory()
public final MediaPlayer getMediaPlayer()
An application uses this handle to control the media player, add listeners and so on.
public final void release()
Copyright © 2009-2012 Caprica Software Limited. All Rights Reserved.