public class MediaPlayer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MediaPlayer.Chapter |
static class |
MediaPlayer.Equalizer |
static class |
MediaPlayer.Event |
static interface |
MediaPlayer.EventListener |
static class |
MediaPlayer.Navigate |
static class |
MediaPlayer.Position |
static class |
MediaPlayer.Title |
static class |
MediaPlayer.TrackDescription |
| Constructor and Description |
|---|
MediaPlayer(LibVLC libVLC)
Create an empty MediaPlayer
|
MediaPlayer(Media media)
Create a MediaPlayer from a Media
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addSlave(int type,
java.lang.String path,
boolean select)
Add a slave (or subtitle) to the current media player.
|
boolean |
addSlave(int type,
android.net.Uri uri,
boolean select)
Add a slave (or subtitle) to the current media player.
|
long |
getAudioDelay()
Get the current audio delay.
|
int |
getAudioTrack()
Get the current audio track.
|
MediaPlayer.TrackDescription[] |
getAudioTracks()
Get the list of available audio tracks.
|
int |
getAudioTracksCount()
Get the number of available audio tracks.
|
int |
getChapter() |
MediaPlayer.Chapter[] |
getChapters(int title)
Get the full description of available chapters.
|
long |
getLength()
Gets current movie's length in ms.
|
Media |
getMedia()
Get the Media used by this MediaPlayer.
|
int |
getPlayerState()
Get player state.
|
float |
getPosition()
Gets the movie position.
|
float |
getRate()
Get the current playback speed
|
long |
getSpuDelay()
Get the current spu (subtitle) delay.
|
int |
getSpuTrack()
Get the current spu (subtitle) track.
|
MediaPlayer.TrackDescription[] |
getSpuTracks()
Get the list of available spu (subtitle) tracks.
|
int |
getSpuTracksCount()
Get the number of available spu (subtitle) tracks.
|
long |
getTime()
Gets the current movie time (in ms).
|
int |
getTitle() |
MediaPlayer.Title[] |
getTitles()
Get the full description of available titles.
|
int |
getVideoTrack()
Get the current video track.
|
MediaPlayer.TrackDescription[] |
getVideoTracks()
Get the list of available video tracks.
|
int |
getVideoTracksCount()
Get the number of available video tracks.
|
IVLCVout |
getVLCVout()
Get the IVLCVout helper.
|
int |
getVolume()
Gets volume as integer
|
boolean |
isPlaying()
Returns true if any media is playing
|
boolean |
isReleased()
Returns true if native object is released
|
boolean |
isSeekable()
Returns true if any media is seekable
|
void |
navigate(int navigate) |
int |
nextChapter() |
protected MediaPlayer.Event |
onEventNative(int eventType,
long arg1,
float arg2)
Called when libvlc send events.
|
protected void |
onReleaseNative()
Called when native object is released (refcount is 0).
|
void |
pause()
Pauses any playing media
|
void |
play()
Play the media
|
int |
previousChapter() |
void |
release()
Release the native object if ref count is 1.
|
boolean |
retain()
Increment internal ref count of the native object.
|
boolean |
setAudioDelay(long delay)
Set current audio delay.
|
boolean |
setAudioOutput(java.lang.String aout)
Selects an audio output module.
|
boolean |
setAudioOutputDevice(java.lang.String id)
Configures an explicit audio output device.
|
boolean |
setAudioTrack(int index)
Set the audio track.
|
void |
setChapter(int chapter) |
boolean |
setEqualizer(MediaPlayer.Equalizer equalizer)
Apply new equalizer settings to a media player.
|
void |
setEventListener(MediaPlayer.EventListener listener) |
protected void |
setEventListener(org.videolan.libvlc.VLCEvent.Listener<T> listener)
Set an event listener.
|
void |
setMedia(Media media)
Set a Media
|
void |
setPosition(float pos)
Sets the movie position.
|
void |
setRate(float rate)
Sets the speed of playback (1 being normal speed, 2 being twice as fast)
|
boolean |
setSpuDelay(long delay)
Set current spu (subtitle) delay.
|
boolean |
setSpuTrack(int index)
Set the spu (subtitle) track.
|
long |
setTime(long time)
Sets the movie time (in ms), if any media is being played.
|
void |
setTitle(int title) |
void |
setVideoTitleDisplay(int position,
int timeout)
Set if, and how, the video title will be shown when media is played
|
boolean |
setVideoTrack(int index)
Set the video track.
|
void |
setVideoTrackEnabled(boolean enabled)
Set the enabled state of the video track
|
int |
setVolume(int volume)
Sets volume as integer
|
void |
stop()
Stops the playing media
|
public MediaPlayer(LibVLC libVLC)
libVLC - a valid libVLCpublic MediaPlayer(Media media)
media - a valid Media objectpublic IVLCVout getVLCVout()
public void setMedia(Media media)
media - a valid Media objectpublic Media getMedia()
release().public void play()
public void stop()
public void setVideoTitleDisplay(int position,
int timeout)
position - see MediaPlayer.Positiontimeout - public boolean setAudioOutput(java.lang.String aout)
public boolean setAudioOutputDevice(java.lang.String id)
public MediaPlayer.Title[] getTitles()
public MediaPlayer.Chapter[] getChapters(int title)
title - index of the title (if -1, use the current title)public int getVideoTracksCount()
public MediaPlayer.TrackDescription[] getVideoTracks()
public int getVideoTrack()
public boolean setVideoTrack(int index)
public void setVideoTrackEnabled(boolean enabled)
enabled - public int getAudioTracksCount()
public MediaPlayer.TrackDescription[] getAudioTracks()
public int getAudioTrack()
public boolean setAudioTrack(int index)
public long getAudioDelay()
public boolean setAudioDelay(long delay)
delay - in microseconds.public int getSpuTracksCount()
public MediaPlayer.TrackDescription[] getSpuTracks()
public int getSpuTrack()
public boolean setSpuTrack(int index)
public long getSpuDelay()
public boolean setSpuDelay(long delay)
delay - in microseconds.public boolean setEqualizer(MediaPlayer.Equalizer equalizer)
MediaPlayer.Equalizer.create() or
MediaPlayer.Equalizer.createFromPreset(int)}.
It is possible to apply new equalizer settings to a media player whether the media
player is currently playing media or not.
Invoking this method will immediately apply the new equalizer settings to the audio
output of the currently playing media if there is any.
If there is no currently playing media, the new equalizer settings will be applied
later if and when new media is played.
Equalizer settings will automatically be applied to subsequently played media.
To disable the equalizer for a media player invoke this method passing null.public boolean addSlave(int type,
android.net.Uri uri,
boolean select)
type - see Media.Slave.Typeuri - a valid RFC 2396 Uripublic boolean addSlave(int type,
java.lang.String path,
boolean select)
type - see Media.Slave.Typepath - a local pathpublic void setRate(float rate)
rate - public float getRate()
public boolean isPlaying()
public boolean isSeekable()
public void pause()
public int getPlayerState()
public int getVolume()
public int setVolume(int volume)
volume: - Volume level passed as integerpublic long getTime()
public long setTime(long time)
time: - Time in ms.public float getPosition()
public void setPosition(float pos)
pos: - movie position.public long getLength()
public int getTitle()
public void setTitle(int title)
public int getChapter()
public int previousChapter()
public int nextChapter()
public void setChapter(int chapter)
public void navigate(int navigate)
public void setEventListener(MediaPlayer.EventListener listener)
protected MediaPlayer.Event onEventNative(int eventType, long arg1, float arg2)
eventType - event typearg1 - first argumentarg2 - second argumentprotected void onReleaseNative()
public boolean isReleased()
public final boolean retain()
public final void release()
protected void setEventListener(org.videolan.libvlc.VLCEvent.Listener<T> listener)
listener - see VLCEvent.Listener