public abstract class DefaultMediaPlayer extends AbstractMediaPlayer implements MediaPlayer, EqualizerListener
| Constructor and Description |
|---|
DefaultMediaPlayer(LibVlc libvlc,
libvlc_instance_t instance)
Create a new media player.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMediaOptions(String... mediaOptions)
Add options to the current media.
|
void |
addMediaPlayerEventListener(MediaPlayerEventListener listener)
Add a component to be notified of media player events.
|
boolean |
canPause()
Can the current media be paused?
|
void |
enableEvents(long eventMask)
Restrict the set of media player events that generate event notifications to listeners.
|
void |
enableLogo(boolean enable)
Enable/disable the logo.
|
void |
enableMarquee(boolean enable)
Enable/disable the marquee.
|
void |
equalizerChanged(Equalizer equalizer)
The state of the equalizer changed.
|
List<List<String>> |
getAllChapterDescriptions()
Get all of the chapter descriptions for all available titles.
|
String |
getAspectRatio()
Get the video aspect ratio.
|
int |
getAudioChannel()
Get the current audio channel.
|
long |
getAudioDelay()
Get the audio delay.
|
List<TrackDescription> |
getAudioDescriptions()
Get the audio track descriptions.
|
String |
getAudioOutputDevice()
Get the identifier of the current audio output device, if available.
|
List<AudioDevice> |
getAudioOutputDevices()
Get the available audio devices for the media player audio output.
|
int |
getAudioTrack()
Get the current audio track.
|
int |
getAudioTrackCount()
Get the number of available audio tracks.
|
float |
getBrightness()
Get the current video brightness.
|
int |
getChapter()
Get the current chapter.
|
int |
getChapterCount()
Get the chapter count.
|
List<String> |
getChapterDescriptions()
Get the chapter descriptions for the current title.
|
List<String> |
getChapterDescriptions(int title)
Get the chapter descriptions for a title.
|
String |
getCodecDescription(libvlc_track_type_t type,
int codec)
Get a description for a FourCC codec value.
|
float |
getContrast()
Get the current video contrast.
|
String |
getCropGeometry()
Get the current video crop geometry.
|
Equalizer |
getEqualizer()
Get the current audio equalizer.
|
List<ChapterDescription> |
getExtendedChapterDescriptions()
Get the extended (or "full") chapter descriptions for the current title.
|
List<ChapterDescription> |
getExtendedChapterDescriptions(int title)
Get the extended (or "full") chapter descriptions for a particular title.
|
List<TitleDescription> |
getExtendedTitleDescriptions()
Get the extended (or "full") title descriptions for the current title.
|
float |
getFps()
Get the current play-back frames-per-second.
|
float |
getGamma()
Get the current video gamma.
|
int |
getHue()
Get the current video hue.
|
long |
getLength()
Get the length of the current media item.
|
MediaDetails |
getMediaDetails()
Get the media details.
|
MediaMeta |
getMediaMeta()
Get local meta data for the current media.
|
MediaMeta |
getMediaMeta(libvlc_media_t media)
Get local meta data for a media instance.
|
MediaMetaData |
getMediaMetaData()
Get local meta data for the current media.
|
libvlc_state_t |
getMediaPlayerState()
Get the media player current state.
|
libvlc_state_t |
getMediaState()
Get the current media state.
|
libvlc_media_stats_t |
getMediaStatistics()
Get the current media statistics.
|
libvlc_media_stats_t |
getMediaStatistics(libvlc_media_t media)
Get the current media statistics for a media item (e.g.
|
libvlc_media_type_e |
getMediaType()
Get the media type for the current media.
|
libvlc_media_type_e |
getMediaType(libvlc_media_t media)
Get the media type for a specific media.
|
float |
getPosition()
Get the current play-back position.
|
float |
getRate()
Get the current video play rate.
|
boolean |
getRepeat()
Test whether or not the media player will automatically repeat playing the media when it has
finished playing.
|
float |
getSaturation()
Get the current video saturation.
|
float |
getScale()
Get the current video scale (zoom).
|
BufferedImage |
getSnapshot()
Get a snapshot of the currently playing video.
|
BufferedImage |
getSnapshot(int width,
int height)
Get a snapshot of the currently playing video.
|
int |
getSpu()
Get the current sub-title track.
|
int |
getSpuCount()
Get the number of sub-pictures/sub-titles.
|
long |
getSpuDelay()
Get the sub-title delay.
|
List<TrackDescription> |
getSpuDescriptions()
Get the sub-title track descriptions.
|
List<MediaMeta> |
getSubItemMediaMeta()
Get local meta data for all of the current media sub-items (if there are any).
|
List<MediaMetaData> |
getSubItemMediaMetaData()
Get local meta data for all of the current media sub-items (if there are any).
|
List<List<TrackInfo>> |
getSubItemTrackInfo(TrackType... types)
Get the track (i.e.
|
int |
getTeletextPage()
Get the current teletext page.
|
long |
getTime()
Get the current play-back time.
|
int |
getTitle()
Get the current title.
|
int |
getTitleCount()
Get the number of titles.
|
List<TrackDescription> |
getTitleDescriptions()
Get the title descriptions.
|
List<TrackInfo> |
getTrackInfo(libvlc_media_t media,
TrackType... types)
Get track (i.e.
|
List<TrackInfo> |
getTrackInfo(TrackType... types)
Get the track (i.e.
|
List<TrackDescription> |
getVideoDescriptions()
Get the video (i.e.
|
Dimension |
getVideoDimension()
Get the video size.
|
int |
getVideoOutputs()
Get the number of video outputs for the media player.
|
int |
getVideoTrack()
Get the current video track.
|
int |
getVideoTrackCount()
Get the number of available video tracks.
|
int |
getVolume()
Get the current volume.
|
boolean |
isAdjustVideo()
Test whether or not the video adjustments are enabled.
|
boolean |
isMediaParsed()
Test whether or not the current media has been parsed.
|
boolean |
isMute()
Test whether or not the volume is currently muted.
|
boolean |
isPlayable()
Is the current media playable?
|
boolean |
isPlaying()
Is the media player playing?
|
boolean |
isSeekable()
Is the current media seekable?
|
libvlc_media_player_t |
mediaPlayerInstance()
Provide access to the native media player instance.
|
void |
menuActivate()
Activate a DVD menu.
|
void |
menuDown()
Navigate down a DVD menu.
|
void |
menuLeft()
Navigate left a DVD menu.
|
void |
menuRight()
Navigate right a DVD menu.
|
void |
menuUp()
Navigate up a DVD menu.
|
String |
mrl()
Get the media resource locator for the current media instance.
|
String |
mrl(libvlc_media_t mediaInstance)
Get the media resource locator for a media instance.
|
boolean |
mute()
Toggle volume mute.
|
void |
mute(boolean mute)
Mute or un-mute the volume.
|
void |
nextChapter()
Jump to the next chapter.
|
void |
nextFrame()
Advance one frame.
|
void |
parseMedia()
Parse local meta data from the current media.
|
void |
pause()
Pause play-back.
|
void |
play()
Begin play-back.
|
boolean |
playMedia(Media media)
Play a new media item.
|
boolean |
playMedia(String mrl,
String... mediaOptions)
Play a new media item, with options.
|
boolean |
playNextSubItem(String... mediaOptions)
Play the next sub-item (if there is one).
|
boolean |
playSubItem(int index,
String... mediaOptions)
Play a particular sub-item (if there is one).
|
boolean |
prepareMedia(Media media)
Prepare a new media item for play-back, but do not begin playing.
|
boolean |
prepareMedia(String mrl,
String... mediaOptions)
Prepare a new media item for play-back, but do not begin playing.
|
void |
previousChapter()
Jump to the previous chapter.
|
boolean |
programScrambled()
Is the current program scrambled?
|
void |
release()
Release the media player, freeing all associated (including native) resources.
|
void |
removeMediaPlayerEventListener(MediaPlayerEventListener listener)
Remove a component that was previously interested in notifications of media player events.
|
void |
requestParseMedia()
Parse local meta data from the current media.
|
boolean |
requestParseMediaWithOptions(libvlc_media_parse_flag_t... options)
Parse meta data from the current media, with options.
|
boolean |
saveSnapshot()
Save a snapshot of the currently playing video.
|
boolean |
saveSnapshot(File file)
Save a snapshot of the currently playing video.
|
boolean |
saveSnapshot(File file,
int width,
int height)
Save a snapshot of the currently playing video.
|
boolean |
saveSnapshot(int width,
int height)
Save a snapshot of the currently playing video.
|
void |
setAdjustVideo(boolean adjustVideo)
Enable/disable the video adjustments.
|
void |
setAspectRatio(String aspectRatio)
Set the video aspect ratio
|
void |
setAudioChannel(int channel)
Set the audio channel.
|
void |
setAudioDelay(long delay)
Set the audio delay.
|
boolean |
setAudioOutput(String output)
Set the desired audio output.
|
void |
setAudioOutputDevice(String output,
String outputDeviceId)
Set the desired audio output device.
|
int |
setAudioTrack(int track)
Set a new audio track to play.
|
void |
setBrightness(float brightness)
Set the video brightness.
|
void |
setChapter(int chapterNumber)
Set the chapter.
|
void |
setContrast(float contrast)
Set the video contrast.
|
void |
setCropGeometry(String cropGeometry)
Set the crop geometry.
|
void |
setDeinterlace(DeinterlaceMode deinterlaceMode)
Set the de-interlace filter to use.
|
void |
setEqualizer(Equalizer equalizer)
Set the audio equalizer.
|
void |
setGamma(float gamma)
Set the video gamma.
|
void |
setHue(int hue)
Set the video hue.
|
void |
setLogo(Logo logo)
Set a logo.
|
void |
setLogoFile(String logoFile)
Set the logo file.
|
void |
setLogoImage(RenderedImage logoImage)
Set the logo image.
|
void |
setLogoLocation(int x,
int y)
Set the logo location.
|
void |
setLogoOpacity(float opacity)
Set the logo opacity.
|
void |
setLogoOpacity(int opacity)
Set the logo opacity.
|
void |
setLogoPosition(libvlc_logo_position_e position)
Set the logo position.
|
void |
setMarquee(Marquee marquee)
Set a marquee.
|
void |
setMarqueeColour(Color colour)
Set the marquee colour.
|
void |
setMarqueeColour(int colour)
Set the marquee colour.
|
void |
setMarqueeLocation(int x,
int y)
Set the marquee location.
|
void |
setMarqueeOpacity(float opacity)
Set the marquee opacity.
|
void |
setMarqueeOpacity(int opacity)
Set the marquee opacity.
|
void |
setMarqueePosition(libvlc_marquee_position_e position)
Set the marquee position.
|
void |
setMarqueeSize(int size)
Set the marquee size.
|
void |
setMarqueeText(String text)
Set the marquee text.
|
void |
setMarqueeTimeout(int timeout)
Set the marquee timeout.
|
void |
setPause(boolean pause)
Pause/resume.
|
void |
setPlaySubItems(boolean playSubItems)
Set whether or not the media player should automatically play media sub-items.
|
void |
setPosition(float position)
Jump to a specific position.
|
int |
setRate(float rate)
Set the video play rate.
|
void |
setRepeat(boolean repeat)
Set whether or not the media player should automatically repeat playing the media when it has
finished playing.
|
void |
setSaturation(float saturation)
Set the video saturation.
|
void |
setScale(float factor)
Set the video scaling factor.
|
void |
setSnapshotDirectory(String snapshotDirectoryName)
Set the directory into which snapshots of the video are saved.
|
int |
setSpu(int spu)
Set the current sub-title track.
|
void |
setSpuDelay(long delay)
Set the sub-title delay.
|
void |
setStandardMediaOptions(String... options)
Set standard media options for all media items subsequently played.
|
void |
setSubTitleFile(File subTitleFile)
Set the sub-title file to use.
|
void |
setSubTitleFile(String subTitleFileName)
Set the sub-title file to use.
|
void |
setTeletextPage(int pageNumber)
Set the new teletext page to retrieve.
|
void |
setTime(long time)
Jump to a specific moment.
|
void |
setTitle(int title)
Set a new title to play.
|
void |
setVideoTitleDisplay(libvlc_position_e position,
int timeout)
Set if, and how, the video title will be shown when playing media.
|
int |
setVideoTrack(int track)
Set a new video track to play.
|
void |
setVolume(int volume)
Set the volume.
|
void |
skip(long delta)
Skip forward or backward by a period of time.
|
void |
skipPosition(float delta)
Skip forward or backward by a change in position.
|
boolean |
start()
Begin play-back and wait for the media to start playing or for an error to occur.
|
boolean |
startMedia(Media media)
Play a new media item, with options, and wait for it to start playing or error.
|
boolean |
startMedia(String mrl,
String... mediaOptions)
Play a new media item, with options, and wait for it to start playing or error.
|
void |
stop()
Stop play-back.
|
int |
subItemCount()
Get the number of sub-items (if any).
|
int |
subItemIndex()
Get the index of the current sub-item.
|
List<String> |
subItems()
Get the list of sub-items (if any).
|
List<libvlc_media_t> |
subItemsMedia()
Get the list of sub-item media instances (if any).
|
MediaList |
subItemsMediaList()
Get the sub-items as a
MediaList. |
void |
toggleTeletext()
Toggle teletext status.
|
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 DefaultMediaPlayer(LibVlc libvlc, libvlc_instance_t instance)
libvlc - native library interfaceinstance - libvlc instancepublic void addMediaPlayerEventListener(MediaPlayerEventListener listener)
MediaPlayeraddMediaPlayerEventListener in interface MediaPlayerlistener - component to notifypublic void removeMediaPlayerEventListener(MediaPlayerEventListener listener)
MediaPlayerremoveMediaPlayerEventListener in interface MediaPlayerlistener - component to stop notifyingpublic void enableEvents(long eventMask)
MediaPlayerIf a set of events is not explicitly enabled, then it is expected that all events be enabled.
See MediaPlayerEventType.
This setting applies to all registered event listeners - it is not (currently) possible to set a different event mask for each listener.
enableEvents in interface MediaPlayereventMask - bit mask of events to enablepublic void setStandardMediaOptions(String... options)
MediaPlayerThis will not affect any currently playing media item.
setStandardMediaOptions in interface MediaPlayeroptions - options to apply to all subsequently played media itemspublic boolean playMedia(String mrl, String... mediaOptions)
MediaPlayerThe new media will begin play-back asynchronously. This means that some media player functions will likely not work if you invoke them immediately after invoking this method - you will in some circumstances need to wait for an appropriate event to be fired before some API functions will have an effect.
When playing files, depending on the run-time Operating System it may be necessary to pass a URL here (beginning with "file://") rather than a local file path. This should actually not be required.
playMedia in interface MediaPlayermrl - media resource locatormediaOptions - zero or more media item optionstrue if the media item was created; false otherwisepublic boolean playMedia(Media media)
MediaPlayerThe new media will begin play-back asynchronously. This means that some media player functions will likely not work if you invoke them immediately after invoking this method - you will in some circumstances need to wait for an appropriate event to be fired before some API functions will have an effect.
When playing files, depending on the run-time Operating System it may be necessary to pass a URL here (beginning with "file://") rather than a local file path. This should actually not be required.
playMedia in interface MediaPlayermedia - media, with optionstrue if the media item was created; false otherwisepublic boolean prepareMedia(String mrl, String... mediaOptions)
MediaPlayerWhen playing files, depending on the run-time Operating System it may be necessary to pass a URL here (beginning with "file://") rather than a local file path.
prepareMedia in interface MediaPlayermrl - media resource locatormediaOptions - zero or more media item optionstrue if the media item was created; false otherwisepublic boolean prepareMedia(Media media)
MediaPlayerWhen playing files, depending on the run-time Operating System it may be necessary to pass a URL here (beginning with "file://") rather than a local file path.
prepareMedia in interface MediaPlayermedia - media, with optionstrue if the media item was created; false otherwisepublic boolean startMedia(String mrl, String... mediaOptions)
MediaPlayerThis call will block until the media starts or errors.
startMedia in interface MediaPlayermrl - media resource locatormediaOptions - zero or more media item optionstrue if the media started playing, false if the media failed to start because of an errorpublic boolean startMedia(Media media)
MediaPlayerThis call will block until the media starts or errors.
startMedia in interface MediaPlayermedia - media, with optionstrue if the media started playing, false if the media failed to start because of an errorpublic void parseMedia()
MediaPlayerThis method is synchronous.
Parsing media may cause an HTTP request to be made to search for cover- art.
Invoking this method on a stream or DVB channel may cause a hang.
parseMedia in interface MediaPlayerpublic void requestParseMedia()
MediaPlayerThis method is asynchronous and a media player event will be raised when the parsed status changes.
Parsing media may cause an HTTP request to be made to search for cover-art.
If the media has already been parsed when this function is called then no event will be raised.
Invoking this method on a stream or DVB channel may cause a hang.
requestParseMedia in interface MediaPlayerpublic boolean requestParseMediaWithOptions(libvlc_media_parse_flag_t... options)
MediaPlayerThis method is asynchronous and a media player event will be raised when the parsed status changes.
Parsing media may cause an HTTP request to be made to search for cover-art.
If the media has already been parsed when this function is called, or this function returns an error, then no event will be raised.
If no options are specified, then the file is parsed if it is a local file.
requestParseMediaWithOptions in interface MediaPlayeroptions - optional optionstrue if successful; false on error (or e.g. requires LibVLC 3.0.0)public boolean isMediaParsed()
MediaPlayerisMediaParsed in interface MediaPlayertrue if the current media has been parsed, otherwise falsepublic MediaMeta getMediaMeta()
MediaPlayer
Some media types require that the media be parsed before accessing meta data - it is the
responsibility of the client application to parse the media if required, see
MediaPlayer.parseMedia().
Note that requesting meta data may cause one or more HTTP connections to be made to external web-sites to attempt download of album art.
getMediaMeta in interface MediaPlayerpublic MediaMeta getMediaMeta(libvlc_media_t media)
MediaPlayer
See MediaPlayer.getMediaMeta(), the same notes with regard to parsing hold here.
getMediaMeta in interface MediaPlayermedia - media instance, may be a sub-itemnullpublic List<MediaMeta> getSubItemMediaMeta()
MediaPlayer
See MediaPlayer.getMediaMeta(), the same notes with regard to parsing hold here.
getSubItemMediaMeta in interface MediaPlayernullpublic MediaMetaData getMediaMetaData()
MediaPlayer
See MediaPlayer.getMediaMeta(), the same notes with regard to parsing hold here.
This function returns the meta data in a "detached" value object, i.e. there is no link to the native media handle (so the meta data can not be updated using this function.
getMediaMetaData in interface MediaPlayernullpublic List<MediaMetaData> getSubItemMediaMetaData()
MediaPlayer
See MediaPlayer.getMediaMeta(), the same notes with regard to parsing hold here.
This function returns the meta data in a "detached" value object, i.e. there is no link to the native media handle (so the meta data can not be updated using this function.
getSubItemMediaMetaData in interface MediaPlayernullpublic void addMediaOptions(String... mediaOptions)
MediaPlayeraddMediaOptions in interface MediaPlayermediaOptions - media optionspublic void setRepeat(boolean repeat)
MediaPlayer
There is no guarantee of seamless play-back when using this method - see instead
MediaListPlayer.
If the media has sub-items, then it is the sub-items that are repeated.
setRepeat in interface MediaPlayerrepeat - true to automatically replay the media, otherwise falsepublic boolean getRepeat()
MediaPlayergetRepeat in interface MediaPlayertrue if the media will be automatically replayed, otherwise falsepublic void setPlaySubItems(boolean playSubItems)
MediaPlayersetPlaySubItems in interface MediaPlayerplaySubItems - true to automatically play sub-items, otherwise falsepublic int subItemCount()
MediaPlayersubItemCount in interface MediaPlayerpublic int subItemIndex()
MediaPlayersubItemIndex in interface MediaPlayerpublic List<String> subItems()
MediaPlayerThe MRL of each sub-item is returned in the list.
subItems in interface MediaPlayernull if there is no current mediapublic List<libvlc_media_t> subItemsMedia()
MediaPlayerThe native media instance of each sub-item is returned in the list.
subItemsMedia in interface MediaPlayernull if there is no current mediapublic MediaList subItemsMediaList()
MediaPlayerMediaList.subItemsMediaList in interface MediaPlayernull if there is no current mediapublic boolean playNextSubItem(String... mediaOptions)
MediaPlayer
If any standard media options have been set via MediaPlayer.setStandardMediaOptions(String...)
then those options will be applied to the sub-item.
If the media player has been set to automatically repeat, then the sub- items will be repeated once the last one has been played.
playNextSubItem in interface MediaPlayermediaOptions - zero or more media options for the sub-itemtrue if there is a sub-item, otherwise falsepublic boolean playSubItem(int index,
String... mediaOptions)
MediaPlayer
If any standard media options have been set via MediaPlayer.setStandardMediaOptions(String...)
then those options will be applied to the sub-item.
If the media player has been set to automatically repeat, then the sub- items will be repeated once the last one has been played, or if the requested sub-item index exceeds the currently available sub-items.
playSubItem in interface MediaPlayerindex - sub-item indexmediaOptions - zero or more media options for the sub-itemtrue if there is a sub-item, otherwise falsepublic boolean isPlayable()
MediaPlayerisPlayable in interface MediaPlayertrue if the current media is playable, otherwise falsepublic boolean isPlaying()
MediaPlayerisPlaying in interface MediaPlayertrue if the media player is playing, otherwise falsepublic boolean isSeekable()
MediaPlayerisSeekable in interface MediaPlayertrue if the current media is seekable, otherwise falsepublic boolean canPause()
MediaPlayercanPause in interface MediaPlayertrue if the current media can be paused, otherwise falsepublic boolean programScrambled()
MediaPlayerRequires vlc 2.2.0 or later.
programScrambled in interface MediaPlayertrue if the current program is scrambled, otherwise falsepublic long getLength()
MediaPlayergetLength in interface MediaPlayerpublic long getTime()
MediaPlayergetTime in interface MediaPlayerpublic float getPosition()
MediaPlayergetPosition in interface MediaPlayerpublic float getFps()
MediaPlayergetFps in interface MediaPlayerpublic float getRate()
MediaPlayergetRate in interface MediaPlayerpublic int getVideoOutputs()
MediaPlayergetVideoOutputs in interface MediaPlayerpublic Dimension getVideoDimension()
MediaPlayerThe video dimensions are not available until after the video has started playing and a video output has been created.
getVideoDimension in interface MediaPlayernullpublic MediaDetails getMediaDetails()
MediaPlayerThe details are available after the video has started playing, regardless of whether nor not a video output has been created.
getMediaDetails in interface MediaPlayernull if the media meta data is not availablepublic String getAspectRatio()
MediaPlayergetAspectRatio in interface MediaPlayerpublic float getScale()
MediaPlayergetScale in interface MediaPlayerpublic String getCropGeometry()
MediaPlayergetCropGeometry in interface MediaPlayerpublic libvlc_media_stats_t getMediaStatistics()
MediaPlayerStatistics are only updated if the video is playing.
getMediaStatistics in interface MediaPlayerpublic libvlc_media_stats_t getMediaStatistics(libvlc_media_t media)
MediaPlayerStatistics are only updated if the video is playing.
getMediaStatistics in interface MediaPlayermedia - media itemnullpublic libvlc_state_t getMediaState()
MediaPlayergetMediaState in interface MediaPlayerpublic libvlc_state_t getMediaPlayerState()
MediaPlayergetMediaPlayerState in interface MediaPlayerpublic int getTitleCount()
MediaPlayergetTitleCount in interface MediaPlayerpublic int getTitle()
MediaPlayergetTitle in interface MediaPlayerpublic void setTitle(int title)
MediaPlayersetTitle in interface MediaPlayertitle - title numberpublic int getVideoTrackCount()
MediaPlayergetVideoTrackCount in interface MediaPlayerpublic int getVideoTrack()
MediaPlayergetVideoTrack in interface MediaPlayerMediaPlayer.getVideoDescriptions()public int setVideoTrack(int track)
MediaPlayer
The track identifier must be one of those returned by MediaPlayer.getVideoDescriptions().
Video can be disabled by passing here the identifier of the track with a description of "Disable".
There is no guarantee that the available track identifiers go in sequence from zero up to
MediaPlayer.getVideoTrackCount()-1. The MediaPlayer.getVideoDescriptions() method should always
be used to ascertain the available track identifiers.
setVideoTrack in interface MediaPlayertrack - track identifierpublic int getAudioTrackCount()
MediaPlayergetAudioTrackCount in interface MediaPlayerpublic int getAudioTrack()
MediaPlayergetAudioTrack in interface MediaPlayerMediaPlayer.getAudioDescriptions()public int setAudioTrack(int track)
MediaPlayer
The track identifier must be one of those returned by MediaPlayer.getAudioDescriptions().
Audio can be disabled by passing here the identifier of the track with a description of "Disable".
There is no guarantee that the available track identifiers go in sequence from zero up to
MediaPlayer.getAudioTrackCount()-1. The MediaPlayer.getAudioDescriptions() method should always
be used to ascertain the available track identifiers.
The implementation of the corresponding native method in libvlc is bugged before vlc 2.0.5, therefore vlc 2.0.5 or later is required for correct behaviour when using this method.
setAudioTrack in interface MediaPlayertrack - track identifierpublic void play()
MediaPlayerIf called when the play-back is paused, the play-back will resume from the current position.
play in interface MediaPlayerpublic boolean start()
MediaPlayerIf called when the play-back is paused, the play-back will resume from the current position.
This call will block until the media starts or errors.
start in interface MediaPlayertrue if the media started playing, false if the media failed to start because of an errorpublic void stop()
MediaPlayerA subsequent play will play-back from the start.
stop in interface MediaPlayerpublic void setPause(boolean pause)
MediaPlayerRequires vlc 1.1.1 or later.
setPause in interface MediaPlayerpause - true to pause, false to play/resumepublic void pause()
MediaPlayerIf the play-back is currently paused it will begin playing.
pause in interface MediaPlayerpublic void nextFrame()
MediaPlayernextFrame in interface MediaPlayerpublic void skip(long delta)
MediaPlayerTo skip backwards specify a negative delta.
skip in interface MediaPlayerdelta - time period, in millisecondspublic void skipPosition(float delta)
MediaPlayerTo skip backwards specify a negative delta.
skipPosition in interface MediaPlayerdelta - amount to skippublic void setTime(long time)
MediaPlayerIf the requested time is less than zero, it is normalised to zero.
setTime in interface MediaPlayertime - time since the beginning, in millisecondspublic void setPosition(float position)
MediaPlayerIf the requested position is less than zero, it is normalised to zero.
setPosition in interface MediaPlayerposition - position value, a percentage (e.g. 0.15 is 15%)public int setRate(float rate)
MediaPlayerSome media protocols are not able to change the rate.
setRate in interface MediaPlayerrate - rate, where 1.0 is normal speed, 0.5 is half speed, 2.0 is double speed and so onpublic void setAspectRatio(String aspectRatio)
MediaPlayersetAspectRatio in interface MediaPlayeraspectRatio - aspect ratio, e.g. "16:9", "4:3", "185:100" for 1:85.1 and so onpublic void setScale(float factor)
MediaPlayersetScale in interface MediaPlayerfactor - scaling factor, or zero to scale the video the size of the containerpublic void setCropGeometry(String cropGeometry)
MediaPlayerThe format for the crop geometry is one of:
mediaPlayer.setCropGeometry("4:3"); // W:H
mediaPlayer.setCropGeometry("719x575+0+0"); // WxH+L+T
mediaPlayer.setCropGeometry("6+10+6+10"); // L+T+R+B
setCropGeometry in interface MediaPlayercropGeometry - formatted string describing the desired crop geometrypublic boolean setAudioOutput(String output)
MediaPlayerThe change will not be applied until the media player has been stopped and then played again.
The output name comes from MediaPlayerFactory.getAudioOutputs().
setAudioOutput in interface MediaPlayeroutput - name of the desired audio outputtrue if the output was successfully set, otherwise falsepublic void setAudioOutputDevice(String output, String outputDeviceId)
MediaPlayerThe change will not be applied until the media player has been stopped and then played again.
The output name comes from MediaPlayerFactory.getAudioOutputs().
The device id comes from the AudioDevice.getDeviceId() returned by
MediaPlayerFactory.getAudioOutputs().
setAudioOutputDevice in interface MediaPlayeroutput - name of the desired audio outputoutputDeviceId - id of the desired audio output devicepublic String getAudioOutputDevice()
MediaPlayerTo return a useful value, an audio output must be active (i.e. the media must be playing).
getAudioOutputDevice in interface MediaPlayernull if not available (e.g. requires LibVLC 3.0.0)public List<AudioDevice> getAudioOutputDevices()
MediaPlayergetAudioOutputDevices in interface MediaPlayernull if not available (e.g. requires LibVLC 2.2.0)public boolean mute()
MediaPlayermute in interface MediaPlayertrue if the volume is muted, false if the volume is not mutedpublic void mute(boolean mute)
MediaPlayermute in interface MediaPlayermute - true to mute the volume, false to un-mute itpublic boolean isMute()
MediaPlayerisMute in interface MediaPlayertrue if the volume is muted, false if the volume is not mutedpublic int getVolume()
MediaPlayergetVolume in interface MediaPlayerpublic void setVolume(int volume)
MediaPlayerThe volume is actually a percentage of full volume, setting a volume over 100 may cause audible distortion.
setVolume in interface MediaPlayervolume - volume, a percentage of full volume in the range 0 to 200public int getAudioChannel()
MediaPlayerlibvlc_audio_output_channel_t.
Warning this API is subject to change.getAudioChannel in interface MediaPlayerpublic void setAudioChannel(int channel)
MediaPlayerlibvlc_audio_output_channel_t.
Warning this API is subject to change.setAudioChannel in interface MediaPlayerchannel - channelpublic long getAudioDelay()
MediaPlayergetAudioDelay in interface MediaPlayerpublic void setAudioDelay(long delay)
MediaPlayerThe audio delay is set for the current item only and will be reset to zero each time the media changes.
setAudioDelay in interface MediaPlayerdelay - desired audio delay, in microsecondspublic int getChapterCount()
MediaPlayergetChapterCount in interface MediaPlayerpublic int getChapter()
MediaPlayergetChapter in interface MediaPlayerpublic void setChapter(int chapterNumber)
MediaPlayersetChapter in interface MediaPlayerchapterNumber - chapter number, where zero is the first chapterpublic void nextChapter()
MediaPlayerIf the play-back is already at the last chapter, this will have no effect.
nextChapter in interface MediaPlayerpublic void previousChapter()
MediaPlayerIf the play-back is already at the first chapter, this will have no effect.
previousChapter in interface MediaPlayerpublic void menuActivate()
MediaPlayermenuActivate in interface MediaPlayerpublic void menuUp()
MediaPlayermenuUp in interface MediaPlayerpublic void menuDown()
MediaPlayermenuDown in interface MediaPlayerpublic void menuLeft()
MediaPlayermenuLeft in interface MediaPlayerpublic void menuRight()
MediaPlayermenuRight in interface MediaPlayerpublic int getSpuCount()
MediaPlayergetSpuCount in interface MediaPlayerpublic int getSpu()
MediaPlayergetSpu in interface MediaPlayerpublic int setSpu(int spu)
MediaPlayer
The track identifier must be one of those returned by MediaPlayer.getSpuDescriptions().
Subtitles can be disabled by passing here the identifier of the track with a description of "Disable".
There is no guarantee that the available subtitle identifiers go in sequence from zero up to
MediaPlayer.getSpuCount()-1. The MediaPlayer.getSpuDescriptions() method should always
be used to ascertain the available subtitle identifiers.
The implementation of the corresponding native method in libvlc is bugged before vlc 2.0.6, therefore vlc 2.0.6 or later is required for correct behaviour when using this method.
setSpu in interface MediaPlayerspu - sub-title identifier, or -1 for nonepublic long getSpuDelay()
MediaPlayergetSpuDelay in interface MediaPlayerpublic void setSpuDelay(long delay)
MediaPlayerThe sub-title delay is set for the current item only and will be reset to zero each time the media changes.
setSpuDelay in interface MediaPlayerdelay - desired sub-title delay, in microsecondspublic void setSubTitleFile(String subTitleFileName)
MediaPlayersetSubTitleFile in interface MediaPlayersubTitleFileName - name of the file containing the sub-titlespublic void setSubTitleFile(File subTitleFile)
MediaPlayersetSubTitleFile in interface MediaPlayersubTitleFile - file containing the sub-titlespublic int getTeletextPage()
MediaPlayergetTeletextPage in interface MediaPlayerpublic void setTeletextPage(int pageNumber)
MediaPlayersetTeletextPage in interface MediaPlayerpageNumber - page numberpublic void toggleTeletext()
MediaPlayertoggleTeletext in interface MediaPlayerpublic List<TrackDescription> getTitleDescriptions()
MediaPlayerThe media must be playing before this information is available.
getTitleDescriptions in interface MediaPlayernullpublic List<TrackDescription> getVideoDescriptions()
MediaPlayerThe media must be playing before this information is available.
getVideoDescriptions in interface MediaPlayernullpublic List<TrackDescription> getAudioDescriptions()
MediaPlayerThe media must be playing before this information is available.
getAudioDescriptions in interface MediaPlayernullpublic List<TrackDescription> getSpuDescriptions()
MediaPlayerThe media must be playing before this information is available.
getSpuDescriptions in interface MediaPlayernullpublic List<String> getChapterDescriptions(int title)
MediaPlayerThe media must be playing before this information is available.
getChapterDescriptions in interface MediaPlayertitle - title numbernull if there is no such titlepublic List<String> getChapterDescriptions()
MediaPlayerThe media must be playing before this information is available.
getChapterDescriptions in interface MediaPlayernull if there is no current titlepublic List<List<String>> getAllChapterDescriptions()
MediaPlayerThe media must be playing before this information is available.
getAllChapterDescriptions in interface MediaPlayernull)public List<TitleDescription> getExtendedTitleDescriptions()
MediaPlayergetExtendedTitleDescriptions in interface MediaPlayernull)public List<ChapterDescription> getExtendedChapterDescriptions()
MediaPlayergetExtendedChapterDescriptions in interface MediaPlayernull)public List<ChapterDescription> getExtendedChapterDescriptions(int title)
MediaPlayergetExtendedChapterDescriptions in interface MediaPlayertitle - title id (this is not an index from zero, it must be a valid title identifier)null)public List<TrackInfo> getTrackInfo(TrackType... types)
MediaPlayer
The media (if local) should first be parsed, see MediaPlayer.parseMedia(), or be already
playing.
In the case of DVD media (for example ".iso" files) and streams the media must be played and video output must be available before valid track information becomes available, and even then it is not always available immediately (or it is only partially available) so polling may be required.
If you invoke this method "too soon", you may only receive partial track information.
getTrackInfo in interface MediaPlayertypes - zero or more types of track to get, or all tracks if omittednull if there is no current mediapublic List<TrackInfo> getTrackInfo(libvlc_media_t media, TrackType... types)
MediaPlayergetTrackInfo in interface MediaPlayermedia - media itemtypes - zero or more types of track to get, or all tracks if omittednull if there is no current mediapublic libvlc_media_type_e getMediaType()
MediaPlayerThis is a medium type rather than e.g. a specific file type.
Requires LibVLC 3.0.0 or later.
getMediaType in interface MediaPlayernull if the current media is nullpublic libvlc_media_type_e getMediaType(libvlc_media_t media)
MediaPlayerThis is a medium type rather than e.g. a specific file type.
Requires LibVLC 3.0.0 or later.
getMediaType in interface MediaPlayermedia - medianull if media is nullpublic String getCodecDescription(libvlc_track_type_t type, int codec)
MediaPlayerRequires LibVLC 3.0.0 or later.
getCodecDescription in interface MediaPlayertype - type of trackcodec - codec valuepublic List<List<TrackInfo>> getSubItemTrackInfo(TrackType... types)
MediaPlayergetSubItemTrackInfo in interface MediaPlayertypes - zero or more types of track to get, or all tracks if omittednull if there is no current mediapublic void setSnapshotDirectory(String snapshotDirectoryName)
MediaPlayerIf the specified directory path does not yet exist, it will be created.
setSnapshotDirectory in interface MediaPlayersnapshotDirectoryName - name of the directory to save snapshots topublic boolean saveSnapshot()
MediaPlayerThe size of the image will be that produced by the libvlc native snapshot function, i.e. the size of the media itself.
The snapshot will be created in the directory set via MediaPlayer.setSnapshotDirectory(String),
unless that directory has not been set in which case the snapshot will be created in the
user's home directory, obtained via the "user.home" system property.
The snapshot will be assigned a filename based on the current time.
The size of the image will be that produced by the libvlc native snapshot function.
Taking a snapshot is an asynchronous function, the snapshot is not available until
after the MediaPlayerEventListener.snapshotTaken(MediaPlayer, String) event
is received.
saveSnapshot in interface MediaPlayertrue if the snapshot was saved, otherwise falsepublic boolean saveSnapshot(int width,
int height)
MediaPlayer
The snapshot will be created in the directory set via MediaPlayer.setSnapshotDirectory(String),
unless that directory has not been set in which case the snapshot will be created in the
user's home directory, obtained via the "user.home" system property.
The snapshot will be assigned a filename based on the current time.
If one of width or height is zero the original image aspect ratio will be preserved.
If both width and height are zero, the original image size will be used, see
MediaPlayer.saveSnapshot().
Taking a snapshot is an asynchronous function, the snapshot is not available until
after the MediaPlayerEventListener.snapshotTaken(MediaPlayer, String) event
is received.
saveSnapshot in interface MediaPlayerwidth - desired image widthheight - desired image heighttrue if the snapshot was saved, otherwise falsepublic boolean saveSnapshot(File file)
MediaPlayerThe size of the image will be that produced by the libvlc native snapshot function, i.e. the size of the media itself.
Any missing directory path will be created if it does not exist.
Taking a snapshot is an asynchronous function, the snapshot is not available until
after the MediaPlayerEventListener.snapshotTaken(MediaPlayer, String) event
is received.
saveSnapshot in interface MediaPlayerfile - file to contain the snapshottrue if the snapshot was saved, otherwise falsepublic boolean saveSnapshot(File file, int width, int height)
MediaPlayerAny missing directory path will be created if it does not exist.
If one of width or height is zero the original image aspect ratio will be preserved.
If both width and height are zero, the original image size will be used, see
MediaPlayer.saveSnapshot(File).
Taking a snapshot is an asynchronous function, the snapshot is not available until
after the MediaPlayerEventListener.snapshotTaken(MediaPlayer, String) event
is received.
saveSnapshot in interface MediaPlayerfile - file to contain the snapshotwidth - desired image widthheight - desired image heighttrue if the snapshot was saved, otherwise falsepublic BufferedImage getSnapshot()
MediaPlayerThe size of the image will be that produced by the libvlc native snapshot function, i.e. the size of the media itself.
This implementation uses the native libvlc method to save a snapshot of the currently playing video. This snapshot is saved to a temporary file and then the resultant image is loaded from the file.
Taking a snapshot is an asynchronous function, the snapshot is not available until
after the MediaPlayerEventListener.snapshotTaken(MediaPlayer, String) event
is received.
getSnapshot in interface MediaPlayernull if a snapshot could not be takenpublic BufferedImage getSnapshot(int width, int height)
MediaPlayerThis implementation uses the native libvlc method to save a snapshot of the currently playing video. This snapshot is saved to a temporary file and then the resultant image is loaded from the file.
If one of width or height is zero the original image aspect ratio will be preserved.
If both width and height are zero, the original image size will be used, see
MediaPlayer.getSnapshot()
Taking a snapshot is an asynchronous function, the snapshot is not available until
after the MediaPlayerEventListener.snapshotTaken(MediaPlayer, String) event
is received.
getSnapshot in interface MediaPlayerwidth - desired image widthheight - desired image heightnull if a snapshot could not be takenpublic void enableLogo(boolean enable)
MediaPlayerThe logo will not be enabled if there is currently no video being played.
enableLogo in interface MediaPlayerenable - true to show the logo, false to hide itpublic void setLogoOpacity(int opacity)
MediaPlayersetLogoOpacity in interface MediaPlayeropacity - opacity in the range 0 to 255 where 255 is fully opaquepublic void setLogoOpacity(float opacity)
MediaPlayersetLogoOpacity in interface MediaPlayeropacity - opacity percentage in the range 0.0 to 1.0 where 1.0 is fully opaquepublic void setLogoLocation(int x,
int y)
MediaPlayersetLogoLocation in interface MediaPlayerx - x co-ordinate for the top left of the logoy - y co-ordinate for the top left of the logopublic void setLogoPosition(libvlc_logo_position_e position)
MediaPlayersetLogoPosition in interface MediaPlayerposition - positionpublic void setLogoFile(String logoFile)
MediaPlayersetLogoFile in interface MediaPlayerlogoFile - logo file namepublic void setLogoImage(RenderedImage logoImage)
MediaPlayer
The image will first be written to a temporary file, before invoking
MediaPlayer.setLogoFile(String). This is not optimal, but creating a temporary file for the logo
in this way is unavoidable.
The temporary file will persist until the JVM exits. The file can not be deleted immediately due to the asynchronous nature of the native API call that sets the logo from the file.
There are circumstances under which this temporary file may fail to be deleted, as
per File.deleteOnExit() - i.e. "Deletion will be attempted only for normal termination
of the virtual machine".
setLogoImage in interface MediaPlayerlogoImage - logo imagepublic void setLogo(Logo logo)
MediaPlayersetLogo in interface MediaPlayerlogo - logopublic void enableMarquee(boolean enable)
MediaPlayerThe marquee will not be enabled if there is currently no video being played.
enableMarquee in interface MediaPlayerenable - true to show the marquee, false to hide itpublic void setMarqueeText(String text)
MediaPlayerFormat variables are available:
Time related: %Y = year %d = day %H = hour %M = minute %S = secondMeta data related:
$a = artist $b = album $c = copyright $d = description $e = encoded by $g = genre $l = language $n = track num $p = now playing $r = rating $s = subtitles language $t = title $u = url $A = date $B = audio bitrate (in kb/s) $C = chapter $D = duration $F = full name with path $I = title $L = time left $N = name $O = audio language $P = position (in %) $R = rate $S = audio sample rate (in kHz) $T = time $U = publisher $V = volume $_ = new lineSee
http://wiki.videolan.org/index.php?title=Documentation:Modules/marq.setMarqueeText in interface MediaPlayertext - textpublic void setMarqueeColour(Color colour)
MediaPlayersetMarqueeColour in interface MediaPlayercolour - colour, any alpha component will be masked offpublic void setMarqueeColour(int colour)
MediaPlayersetMarqueeColour in interface MediaPlayercolour - RGB colour valuepublic void setMarqueeOpacity(int opacity)
MediaPlayersetMarqueeOpacity in interface MediaPlayeropacity - opacity in the range 0 to 100 where 255 is fully opaquepublic void setMarqueeOpacity(float opacity)
MediaPlayersetMarqueeOpacity in interface MediaPlayeropacity - opacity percentage in the range 0.0 to 1.0 where 1.0 is fully opaquepublic void setMarqueeSize(int size)
MediaPlayersetMarqueeSize in interface MediaPlayersize - size, height of the marquee text in pixelspublic void setMarqueeTimeout(int timeout)
MediaPlayersetMarqueeTimeout in interface MediaPlayertimeout - timeout, in millisecondspublic void setMarqueeLocation(int x,
int y)
MediaPlayersetMarqueeLocation in interface MediaPlayerx - x co-ordinate for the top left of the marqueey - y co-ordinate for the top left of the marqueepublic void setMarqueePosition(libvlc_marquee_position_e position)
MediaPlayersetMarqueePosition in interface MediaPlayerposition - positionpublic void setMarquee(Marquee marquee)
MediaPlayersetMarquee in interface MediaPlayermarquee - marqueepublic void setDeinterlace(DeinterlaceMode deinterlaceMode)
MediaPlayersetDeinterlace in interface MediaPlayerdeinterlaceMode - mode, or null to disable the de-interlace filterpublic void setAdjustVideo(boolean adjustVideo)
MediaPlayerThe video adjustment controls must be enabled after the video has started playing.
Requires vlc 1.1.1 or later.
setAdjustVideo in interface MediaPlayeradjustVideo - true if the video adjustments are enabled, otherwise falsepublic boolean isAdjustVideo()
MediaPlayerRequires vlc 1.1.1 or later.
isAdjustVideo in interface MediaPlayerpublic float getContrast()
MediaPlayerRequires vlc 1.1.1 or later.
getContrast in interface MediaPlayerpublic void setContrast(float contrast)
MediaPlayerVideo adjustments must be enabled for this to have any effect. Requires vlc 1.1.1 or later.
setContrast in interface MediaPlayercontrast - contrast value, in the range from 0.0 to 2.0public float getBrightness()
MediaPlayerRequires vlc 1.1.1 or later.
getBrightness in interface MediaPlayerpublic void setBrightness(float brightness)
MediaPlayerVideo adjustments must be enabled for this to have any effect.
Requires vlc 1.1.1 or later.
setBrightness in interface MediaPlayerbrightness - brightness value, in the range from 0.0 to 2.0public int getHue()
MediaPlayerRequires vlc 1.1.1 or later.
getHue in interface MediaPlayerpublic void setHue(int hue)
MediaPlayerVideo adjustments must be enabled for this to have any effect.
Requires vlc 1.1.1 or later.
setHue in interface MediaPlayerhue - hue value, in the range from 0 to 360public float getSaturation()
MediaPlayerRequires vlc 1.1.1 or later.
getSaturation in interface MediaPlayerpublic void setSaturation(float saturation)
MediaPlayerVideo adjustments must be enabled for this to have any effect.
Requires vlc 1.1.1 or later.
setSaturation in interface MediaPlayersaturation - saturation value, in the range from 0.0 to 3.0public float getGamma()
MediaPlayerRequires vlc 1.1.1 or later.
getGamma in interface MediaPlayerpublic void setGamma(float gamma)
MediaPlayerVideo adjustments must be enabled for this to have any effect.
Requires vlc 1.1.1 or later.
setGamma in interface MediaPlayergamma - gamma, in the range from 0.01 to 10.0public void setVideoTitleDisplay(libvlc_position_e position, int timeout)
MediaPlayersetVideoTitleDisplay in interface MediaPlayerposition - position, libvlc_position_e.disable to prevent the title from appearingtimeout - time to display the title in milliseconds (ignored when the title is disabled)public Equalizer getEqualizer()
MediaPlayerRequires vlc 2.2.0 or later.
getEqualizer in interface MediaPlayernull if there is no active equalizerpublic void setEqualizer(Equalizer equalizer)
MediaPlayerRequires vlc 2.2.0 or later.
setEqualizer in interface MediaPlayerequalizer - equalizer, or null to disable the audio equalizerpublic String mrl()
MediaPlayerThe native media instance may be an automatically/scripted added sub-item.
mrl in interface MediaPlayernull if there is no current mediapublic String mrl(libvlc_media_t mediaInstance)
MediaPlayerThe native media instance may be an automatically/scripted added sub-item.
mrl in interface MediaPlayermediaInstance - native media instancepublic Object userData()
MediaPlayeruserData in interface MediaPlayerpublic void userData(Object userData)
MediaPlayeruserData in interface MediaPlayeruserData - user datapublic final void release()
MediaPlayerrelease in interface MediaPlayerpublic final libvlc_media_player_t mediaPlayerInstance()
MediaPlayerThis is exposed on the interface as an implementation side-effect, ordinary applications are not expected to use this.
mediaPlayerInstance in interface MediaPlayerpublic final void equalizerChanged(Equalizer equalizer)
EqualizerListenerequalizerChanged in interface EqualizerListenerequalizer - the equalizer that changedCopyright © 2009–2015 Caprica Software Limited. All rights reserved.