public class DefaultMediaListPlayer extends AbstractMediaPlayer implements MediaListPlayer
Constructor and Description |
---|
DefaultMediaListPlayer(LibVlc libvlc,
libvlc_instance_t instance)
Create a new media list player.
|
Modifier and Type | Method and Description |
---|---|
void |
addMediaListPlayerEventListener(MediaListPlayerEventListener listener)
Add a component to be notified of media list player events.
|
String |
currentMrl()
Get the current MRL.
|
void |
enableEvents(int eventMask)
Restrict the set of media list player events that generate event notifications to listeners.
|
MediaList |
getMediaList()
Get the media list.
|
libvlc_state_t |
getMediaListPlayerState()
Get the media list player state.
|
boolean |
isPlaying()
Determine whether or not the media list is playing.
|
String |
mrl(libvlc_media_t mediaInstance)
Get the media resource locator for a media instance.
|
void |
pause()
Pause the media list.
|
void |
play()
Play the media list.
|
boolean |
playItem(int itemIndex)
Play a particular item on the media list.
|
void |
playNext()
Play the next item in the media list.
|
void |
playPrevious()
Play the previous item in the media list.
|
void |
release()
Release the media list player resources.
|
void |
removeMediaListPlayerEventListener(MediaListPlayerEventListener listener)
Remove a component that was previously interested in notifications of media list player
events.
|
void |
setMediaList(MediaList mediaList)
Set the media list (i.e.
|
void |
setMediaPlayer(MediaPlayer mediaPlayer)
Associate an actual media player with the media list player.
|
void |
setMode(MediaListPlayerMode mode)
Set the media list play mode.
|
void |
stop()
Stop the media list.
|
Object |
userData()
Get the user data associated with the media player.
|
void |
userData(Object userData)
Set user data to associate with the media player.
|
public DefaultMediaListPlayer(LibVlc libvlc, libvlc_instance_t instance)
libvlc
- native library interfaceinstance
- libvlc instancepublic void addMediaListPlayerEventListener(MediaListPlayerEventListener listener)
MediaListPlayer
addMediaListPlayerEventListener
in interface MediaListPlayer
listener
- component to notifypublic void removeMediaListPlayerEventListener(MediaListPlayerEventListener listener)
MediaListPlayer
removeMediaListPlayerEventListener
in interface MediaListPlayer
listener
- component to stop notifyingpublic void enableEvents(int eventMask)
MediaListPlayer
If a set of events is not explicitly enabled, then it is expected that all events be enabled.
enableEvents
in interface MediaListPlayer
eventMask
- bit mask of events to enablepublic void setMediaPlayer(MediaPlayer mediaPlayer)
MediaListPlayer
setMediaPlayer
in interface MediaListPlayer
mediaPlayer
- media playerpublic void setMediaList(MediaList mediaList)
MediaListPlayer
setMediaList
in interface MediaListPlayer
mediaList
- media listpublic MediaList getMediaList()
MediaListPlayer
getMediaList
in interface MediaListPlayer
public void play()
MediaListPlayer
play
in interface MediaListPlayer
public void pause()
MediaListPlayer
pause
in interface MediaListPlayer
public void stop()
MediaListPlayer
stop
in interface MediaListPlayer
public boolean playItem(int itemIndex)
MediaListPlayer
There is a bug in vlc that prevents proper operation of this method, and may cause a fatal JVM failure. This is resolved in vlc 2.0.2 and later.
playItem
in interface MediaListPlayer
itemIndex
- index of the item to playtrue
if the item could be played, otherwise false
public void playNext()
MediaListPlayer
playNext
in interface MediaListPlayer
public void playPrevious()
MediaListPlayer
playPrevious
in interface MediaListPlayer
public boolean isPlaying()
MediaListPlayer
isPlaying
in interface MediaListPlayer
true
if playing, otherwise false
public libvlc_state_t getMediaListPlayerState()
MediaListPlayer
getMediaListPlayerState
in interface MediaListPlayer
public void setMode(MediaListPlayerMode mode)
MediaListPlayer
Note that if you set the play mode to REPEAT before you have played any media then play-back will never start.
setMode
in interface MediaListPlayer
mode
- modepublic String mrl(libvlc_media_t mediaInstance)
MediaListPlayer
The native media instance may be an automatically/scripted added sub-item.
mrl
in interface MediaListPlayer
mediaInstance
- native media instancepublic Object userData()
MediaListPlayer
userData
in interface MediaListPlayer
public void userData(Object userData)
MediaListPlayer
userData
in interface MediaListPlayer
userData
- user datapublic final String currentMrl()
MediaListPlayer
currentMrl
in interface MediaListPlayer
null
public final void release()
MediaListPlayer
release
in interface MediaListPlayer
Copyright © 2009–2014 Caprica Software Limited. All rights reserved.