-
- All Implemented Interfaces:
-
org.videolan.libvlc.interfaces.IMedia
,org.videolan.libvlc.interfaces.IVLCObject
,org.videolan.libvlc.interfaces.IVLCObject
public class Media extends VLCObject<IMedia.Event> implements IMedia
-
-
Constructor Summary
Constructors Constructor Description Media(ILibVLC ILibVLC, String path)
Create a Media from libVLC and a local path starting with '/'. Media(ILibVLC ILibVLC, Uri uri)
Create a Media from libVLC and a Uri Media(ILibVLC ILibVLC, FileDescriptor fd)
Create a Media from libVLC and a FileDescriptor Media(ILibVLC ILibVLC, AssetFileDescriptor afd)
Create a Media from libVLC and an AssetFileDescriptor
-
Method Summary
Modifier and Type Method Description void
setEventListener(IMedia.EventListener listener)
synchronized Uri
getUri()
Get the MRL associated with the Media. long
getDuration()
Get the duration of the media. int
getState()
Get the state of the media. MediaList
subItems()
Get the subItems MediaList associated with the Media. boolean
parse(int flags)
Parse the media synchronously with a flag. boolean
parse()
Parse the media and local art synchronously. boolean
parseAsync(int flags, int timeout)
Parse the media asynchronously with a flag. boolean
parseAsync(int flags)
boolean
parseAsync()
Parse the media and local art asynchronously. synchronized boolean
isParsed()
Returns true if the media is parsed This Media should be alive (not released). int
getType()
Get the type of the media int
getTrackCount()
Get the Track count. IMedia.Track
getTrack(int idx)
Get a TrackThe Track can be casted to AudioTrack, VideoTrack or SubtitleTrack in function of the Track.Type. String
getMeta(int id)
Get a Meta. String
getMeta(int id, boolean force)
Get a Meta. void
setHWDecoderEnabled(boolean enabled, boolean force)
Add or remove hw acceleration media options void
setDefaultMediaPlayerOptions()
Enable HWDecoder options if not already set void
addOption(String option)
Add an option to this Media. void
addSlave(IMedia.Slave slave)
Add a slave to the current media.A slave is an external input source that may contains an additional subtitletrack (like a .srt) or an additional audio track (like a .ac3). void
clearSlaves()
Clear all slaves previously added by addSlave or internally. Array<IMedia.Slave>
getSlaves()
Get a media's slave listThe list will contain slaves parsed by VLC or previously added by addSlave. IMedia.Stats
getStats()
Get the stats related to the playing media -
Methods inherited from class org.videolan.libvlc.VLCObject
getInstance, getLibVLC, isReleased, release, retain
-
Methods inherited from class org.videolan.libvlc.interfaces.IMedia
subItems
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Media
Media(ILibVLC ILibVLC, String path)
Create a Media from libVLC and a local path starting with '/'.- Parameters:
ILibVLC
- a valid libVLCpath
- an absolute local path
-
Media
Media(ILibVLC ILibVLC, Uri uri)
Create a Media from libVLC and a Uri- Parameters:
ILibVLC
- a valid libVLCuri
- a valid RFC 2396 Uri
-
Media
Media(ILibVLC ILibVLC, FileDescriptor fd)
Create a Media from libVLC and a FileDescriptor- Parameters:
ILibVLC
- a valid LibVLCfd
- file descriptor object
-
Media
Media(ILibVLC ILibVLC, AssetFileDescriptor afd)
Create a Media from libVLC and an AssetFileDescriptor- Parameters:
ILibVLC
- a valid LibVLCafd
- asset file descriptor object
-
-
Method Detail
-
setEventListener
void setEventListener(IMedia.EventListener listener)
-
getDuration
long getDuration()
Get the duration of the media.
-
getState
int getState()
Get the state of the media.
-
subItems
MediaList subItems()
Get the subItems MediaList associated with the Media. This Media should be alive (not released).
-
parse
boolean parse(int flags)
Parse the media synchronously with a flag. This Media should be alive (not released).
- Parameters:
flags
- see Parse
-
parse
boolean parse()
Parse the media and local art synchronously. This Media should be alive (not released).
-
parseAsync
boolean parseAsync(int flags, int timeout)
Parse the media asynchronously with a flag. This Media should be alive (not released).To track when this is over you can listen to ParsedChanged event (only if this methods returned true).
- Parameters:
flags
- see Parsetimeout
- maximum time allowed to preparse the media.
-
parseAsync
boolean parseAsync(int flags)
-
parseAsync
boolean parseAsync()
Parse the media and local art asynchronously. This Media should be alive (not released).
-
isParsed
synchronized boolean isParsed()
Returns true if the media is parsed This Media should be alive (not released).
-
getType
int getType()
Get the type of the media
-
getTrackCount
int getTrackCount()
Get the Track count.
-
getTrack
IMedia.Track getTrack(int idx)
Get a TrackThe Track can be casted to AudioTrack, VideoTrack or SubtitleTrack in function of the Track.Type.
- Parameters:
idx
- index of the track
-
getMeta
String getMeta(int id, boolean force)
Get a Meta.
- Parameters:
id
- see Metaforce
- force the native call to be done
-
setHWDecoderEnabled
void setHWDecoderEnabled(boolean enabled, boolean force)
Add or remove hw acceleration media options
- Parameters:
enabled
- if true, hw decoder will be usedforce
- force hw acceleration even for unknown devices
-
setDefaultMediaPlayerOptions
void setDefaultMediaPlayerOptions()
Enable HWDecoder options if not already set
-
addOption
void addOption(String option)
Add an option to this Media. This Media should be alive (not released).
- Parameters:
option
- ":option" or ":option=value"
-
addSlave
void addSlave(IMedia.Slave slave)
Add a slave to the current media.A slave is an external input source that may contains an additional subtitletrack (like a .srt) or an additional audio track (like a .ac3).This function must be called before the media is parsed (via parseAsync} orbefore the media is played (via play)
-
clearSlaves
void clearSlaves()
Clear all slaves previously added by addSlave or internally.
-
getSlaves
@Nullable() Array<IMedia.Slave> getSlaves()
Get a media's slave listThe list will contain slaves parsed by VLC or previously added by addSlave. The typical use case of this function is to savea list of slave in a database for a later use.
-
getStats
@Nullable() IMedia.Stats getStats()
Get the stats related to the playing media
-
-
-
-