public class Media
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Media.AudioTrack
see libvlc_audio_track_t
|
static class |
Media.Event |
static interface |
Media.EventListener |
static class |
Media.Meta
see libvlc_meta_t
|
static class |
Media.Parse
see libvlc_media_parse_flag_t
|
static class |
Media.ParsedStatus |
static class |
Media.Slave
see libvlc_media_slave_t
|
static class |
Media.State
see libvlc_state_t
|
static class |
Media.Stats
see libvlc_media_stats_t
|
static class |
Media.SubtitleTrack
see libvlc_subtitle_track_t
|
static class |
Media.Track
see libvlc_media_track_t
|
static class |
Media.Type
libvlc_media_type_t
|
static class |
Media.UnknownTrack
see libvlc_subtitle_track_t
|
static class |
Media.VideoTrack
see libvlc_video_track_t
|
| Modifier | Constructor and Description |
|---|---|
|
Media(LibVLC libVLC,
android.content.res.AssetFileDescriptor afd)
Create a Media from libVLC and an AssetFileDescriptor
|
|
Media(LibVLC libVLC,
java.io.FileDescriptor fd)
Create a Media from libVLC and a FileDescriptor
|
|
Media(LibVLC libVLC,
java.lang.String path)
Create a Media from libVLC and a local path starting with '/'.
|
|
Media(LibVLC libVLC,
android.net.Uri uri)
Create a Media from libVLC and a Uri
|
protected |
Media(MediaList ml,
int index) |
| Modifier and Type | Method and Description |
|---|---|
void |
addOption(java.lang.String option)
Add an option to this Media.
|
void |
addSlave(Media.Slave slave)
Add a slave to the current media.
|
void |
clearSlaves()
Clear all slaves previously added by
addSlave(Slave) or internally. |
protected void |
finalize() |
long |
getDuration()
Get the duration of the media.
|
java.lang.String |
getMeta(int id)
Get a Meta.
|
Media.Slave[] |
getSlaves()
Get a media's slave list
The list will contain slaves parsed by VLC or previously added by
addSlave(Slave). |
int |
getState()
Get the state of the media.
|
Media.Stats |
getStats()
Get the stats related to the playing media
|
Media.Track |
getTrack(int idx)
Get a Track
The Track can be casted to
Media.AudioTrack, Media.VideoTrack or Media.SubtitleTrack in function of the Media.Track.Type. |
int |
getTrackCount()
Get the Track count.
|
int |
getType()
Get the type of the media
|
android.net.Uri |
getUri()
Get the MRL associated with the Media.
|
boolean |
isParsed()
Returns true if the media is parsed This Media should be alive (not released).
|
boolean |
isReleased()
Returns true if native object is released
|
protected Media.Event |
onEventNative(int eventType,
long arg1,
long arg2,
float argf1)
Called when libvlc send events.
|
protected void |
onReleaseNative()
Called when native object is released (refcount is 0).
|
boolean |
parse()
Parse the media and local art synchronously.
|
boolean |
parse(int flags)
Parse the media synchronously with a flag.
|
boolean |
parseAsync()
Parse the media and local art asynchronously.
|
boolean |
parseAsync(int flags) |
boolean |
parseAsync(int flags,
int timeout)
Parse the media asynchronously with a flag.
|
void |
release()
Release the native object if ref count is 1.
|
boolean |
retain()
Increment internal ref count of the native object.
|
protected void |
setDefaultMediaPlayerOptions()
Enable HWDecoder options if not already set
|
void |
setEventListener(Media.EventListener listener) |
protected void |
setEventListener(VLCEvent.Listener<T> listener)
Set an event listener.
|
protected void |
setEventListener(VLCEvent.Listener<T> listener,
android.os.Handler handler)
Set an event listener and an executor Handler
|
void |
setHWDecoderEnabled(boolean enabled,
boolean force)
Add or remove hw acceleration media options
|
MediaList |
subItems()
Get the subItems MediaList associated with the Media.
|
public Media(LibVLC libVLC, java.lang.String path)
libVLC - a valid libVLCpath - an absolute local pathpublic Media(LibVLC libVLC, android.net.Uri uri)
libVLC - a valid libVLCuri - a valid RFC 2396 Uripublic Media(LibVLC libVLC, java.io.FileDescriptor fd)
libVLC - a valid LibVLCfd - file descriptor objectpublic Media(LibVLC libVLC, android.content.res.AssetFileDescriptor afd)
libVLC - a valid LibVLCafd - asset file descriptor objectprotected Media(MediaList ml, int index)
ml - Should not be released and lockedindex - index of the Media from the MediaListpublic void setEventListener(Media.EventListener listener)
protected Media.Event onEventNative(int eventType, long arg1, long arg2, float argf1)
eventType - event typearg1 - first argumentarg2 - second argumentargf1 - first float argumentpublic android.net.Uri getUri()
public long getDuration()
public int getState()
Media.Statepublic MediaList subItems()
release().public boolean parse(int flags)
flags - see Media.Parsepublic boolean parse()
public boolean parseAsync(int flags,
int timeout)
Media.Event.ParsedChanged
event (only if this methods returned true).flags - see Media.Parsetimeout - maximum time allowed to preparse the media. If -1, the
default "preparse-timeout" option will be used as a timeout. If 0, it will
wait indefinitely. If > 0, the timeout will be used (in milliseconds).public boolean parseAsync(int flags)
public boolean parseAsync()
parseAsync(int)public boolean isParsed()
public int getType()
Type}public int getTrackCount()
public Media.Track getTrack(int idx)
Media.AudioTrack, Media.VideoTrack or Media.SubtitleTrack in function of the Media.Track.Type.idx - index of the trackgetTrackCount()public java.lang.String getMeta(int id)
id - see Media.Metapublic void setHWDecoderEnabled(boolean enabled,
boolean force)
enabled - if true, hw decoder will be usedforce - force hw acceleration even for unknown devicesprotected void setDefaultMediaPlayerOptions()
public void addOption(java.lang.String option)
option - ":option" or ":option=value"public void addSlave(Media.Slave slave)
parseAsync(int)} or
before the media is played (via MediaPlayer.play())public void clearSlaves()
addSlave(Slave) or internally.public Media.Slave[] getSlaves()
addSlave(Slave). The typical use case of this function is to save
a list of slave in a database for a later use.public Media.Stats getStats()
protected void onReleaseNative()
public boolean isReleased()
public final boolean retain()
public final void release()
protected void finalize()
finalize in class java.lang.Objectprotected void setEventListener(VLCEvent.Listener<T> listener)
listener - see VLCEvent.Listenerprotected void setEventListener(VLCEvent.Listener<T> listener, android.os.Handler handler)
listener - see VLCEvent.Listenerhandler - Handler in which events are sent. If null, a handler will be created running on the main thread