public class Media extends java.lang.Object implements IMedia
IMedia.AudioTrack, IMedia.Event, IMedia.EventListener, IMedia.Meta, IMedia.Parse, IMedia.ParsedStatus, IMedia.Slave, IMedia.State, IMedia.Stats, IMedia.SubtitleTrack, IMedia.Track, IMedia.Type, IMedia.UnknownTrack, IMedia.VideoTrack
Modifier | Constructor and Description |
---|---|
|
Media(ILibVLC ILibVLC,
android.content.res.AssetFileDescriptor afd)
Create a Media from libVLC and an AssetFileDescriptor
|
|
Media(ILibVLC ILibVLC,
java.io.FileDescriptor fd)
Create a Media from libVLC and a FileDescriptor
|
|
Media(ILibVLC ILibVLC,
java.lang.String path)
Create a Media from libVLC and a local path starting with '/'.
|
|
Media(ILibVLC ILibVLC,
android.net.Uri uri)
Create a Media from libVLC and a Uri
|
protected |
Media(IMediaList ml,
int index) |
Modifier and Type | Method and Description |
---|---|
void |
addOption(java.lang.String option)
Add an option to this Media.
|
void |
addSlave(IMedia.Slave slave)
Add a slave to the current media.
|
void |
clearSlaves()
Clear all slaves previously added by
IMedia.addSlave(Slave) or internally. |
protected void |
finalize() |
long |
getDuration()
Get the duration of the media.
|
ILibVLC |
getLibVLC() |
java.lang.String |
getMeta(int id)
Get a Meta.
|
IMedia.Slave[] |
getSlaves()
Get a media's slave list
The list will contain slaves parsed by VLC or previously added by
IMedia.addSlave(Slave) . |
int |
getState()
Get the state of the media.
|
IMedia.Stats |
getStats()
Get the stats related to the playing media
|
IMedia.Track |
getTrack(int idx)
Get a Track
The Track can be casted to
AudioTrack , VideoTrack or SubtitleTrack in function of the 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 IMedia.Event |
onEventNative(int eventType,
long arg1,
long arg2,
float argf1,
java.lang.String args1)
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.
|
void |
setDefaultMediaPlayerOptions()
Enable HWDecoder options if not already set
|
protected void |
setEventListener(AbstractVLCEvent.Listener<T> listener)
Set an event listener.
|
protected void |
setEventListener(AbstractVLCEvent.Listener<T> listener,
android.os.Handler handler)
Set an event listener and an executor Handler
|
void |
setEventListener(IMedia.EventListener listener) |
void |
setHWDecoderEnabled(boolean enabled,
boolean force)
Add or remove hw acceleration media options
|
MediaList |
subItems()
Get the subItems MediaList associated with the Media.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLibVLC, isReleased, release, retain
public Media(ILibVLC ILibVLC, java.lang.String path)
ILibVLC
- a valid libVLCpath
- an absolute local pathpublic Media(ILibVLC ILibVLC, android.net.Uri uri)
ILibVLC
- a valid libVLCuri
- a valid RFC 2396 Uripublic Media(ILibVLC ILibVLC, java.io.FileDescriptor fd)
ILibVLC
- a valid LibVLCfd
- file descriptor objectpublic Media(ILibVLC ILibVLC, android.content.res.AssetFileDescriptor afd)
ILibVLC
- a valid LibVLCafd
- asset file descriptor objectprotected Media(IMediaList ml, int index)
ml
- Should not be released and lockedindex
- index of the Media from the MediaListpublic void setEventListener(IMedia.EventListener listener)
setEventListener
in interface IMedia
protected IMedia.Event onEventNative(int eventType, long arg1, long arg2, float argf1, java.lang.String args1)
eventType
- event typearg1
- first argumentarg2
- second argumentargf1
- first float argumentpublic android.net.Uri getUri()
public long getDuration()
getDuration
in interface IMedia
public int getState()
public MediaList subItems()
public boolean parse(int flags)
public boolean parse()
public boolean parseAsync(int flags, int timeout)
Event#ParsedChanged
event (only if this methods returned true).parseAsync
in interface IMedia
flags
- see Parse
timeout
- 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)
parseAsync
in interface IMedia
public boolean parseAsync()
parseAsync
in interface IMedia
parseAsync(int)
public boolean isParsed()
public int getType()
public int getTrackCount()
getTrackCount
in interface IMedia
public IMedia.Track getTrack(int idx)
AudioTrack
, VideoTrack
or SubtitleTrack
in function of the Track.Type
.getTrack
in interface IMedia
idx
- index of the trackgetTrackCount()
public java.lang.String getMeta(int id)
public void setHWDecoderEnabled(boolean enabled, boolean force)
setHWDecoderEnabled
in interface IMedia
enabled
- if true, hw decoder will be usedforce
- force hw acceleration even for unknown devicespublic void setDefaultMediaPlayerOptions()
setDefaultMediaPlayerOptions
in interface IMedia
public void addOption(java.lang.String option)
public void addSlave(IMedia.Slave slave)
parseAsync(int)
} or
before the media is played (via MediaPlayer.play()
)public void clearSlaves()
IMedia.addSlave(Slave)
or internally.clearSlaves
in interface IMedia
public IMedia.Slave[] getSlaves()
IMedia.addSlave(Slave)
. The typical use case of this function is to save
a list of slave in a database for a later use.public IMedia.Stats getStats()
protected void onReleaseNative()
public boolean isReleased()
isReleased
in interface IVLCObject<T extends AbstractVLCEvent>
public final boolean retain()
retain
in interface IVLCObject<T extends AbstractVLCEvent>
public final void release()
release
in interface IVLCObject<T extends AbstractVLCEvent>
protected void finalize()
finalize
in class java.lang.Object
public ILibVLC getLibVLC()
getLibVLC
in interface IVLCObject<T extends AbstractVLCEvent>
protected void setEventListener(AbstractVLCEvent.Listener<T> listener)
listener
- see AbstractVLCEvent.Listener
protected void setEventListener(AbstractVLCEvent.Listener<T> listener, android.os.Handler handler)
listener
- see AbstractVLCEvent.Listener
handler
- Handler in which events are sent. If null, a handler will be created running on the main thread