Class ControlsApi
- java.lang.Object
-
- uk.co.caprica.vlcj.player.base.ControlsApi
-
public final class ControlsApi extends Object
Behaviour pertaining to media player controls.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getRepeat()
Get whether or not the media player will automatically repeat playing the media when it has finished playing.void
nextFrame()
Advance one frame.void
pause()
Pause play-back.void
play()
Begin play-back.void
setPause(boolean pause)
Pause/resume.void
setPosition(float position)
Jump to a specific position.boolean
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
setTime(long time)
Jump to a specific moment.void
skipPosition(float delta)
Skip forward or backward by a change in position.void
skipTime(long delta)
Skip forward or backward by a period of time.boolean
start()
Begin play-back and wait for the media to start playing or for an error to occur.void
stop()
Stop play-back.
-
-
-
Method Detail
-
play
public void play()
Begin play-back.If called when the play-back is paused, the play-back will resume from the current position.
-
start
public boolean start()
Begin play-back and wait for the media to start playing or for an error to occur.If 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.
- Returns:
true
if the media started playing,false
on error
-
stop
public void stop()
Stop play-back.A subsequent play will play-back from the start.
-
setPause
public void setPause(boolean pause)
Pause/resume.- Parameters:
pause
- true to pause, false to play/resume
-
pause
public void pause()
Pause play-back.If the play-back is currently paused it will begin playing.
-
nextFrame
public void nextFrame()
Advance one frame.
-
skipTime
public void skipTime(long delta)
Skip forward or backward by a period of time.To skip backwards specify a negative delta.
- Parameters:
delta
- time period, in milliseconds
-
skipPosition
public void skipPosition(float delta)
Skip forward or backward by a change in position.To skip backwards specify a negative delta.
- Parameters:
delta
- amount to skip
-
setTime
public void setTime(long time)
Jump to a specific moment.If the requested time is less than zero, it is normalised to zero.
- Parameters:
time
- time since the beginning, in milliseconds
-
setPosition
public void setPosition(float position)
Jump to a specific position.If the requested position is less than zero, it is normalised to zero.
- Parameters:
position
- position value, a percentage (e.g. 0.15 is 15%)
-
setRate
public boolean setRate(float rate)
Set the video play rate.Some media protocols are not able to change the rate.
Note that a successful return does not guarantee the rate was changed (depending on media protocol).
- Parameters:
rate
- rate, where 1.0 is normal speed, 0.5 is half speed, 2.0 is double speed and so on- Returns:
true
if successful;false
otherwise
-
setRepeat
public void setRepeat(boolean repeat)
Set whether or not the media player should automatically repeat playing the media when it has finished playing.There is no guarantee of seamless play-back when using this method - see instead
MediaListPlayer
.- Parameters:
repeat
-true
to automatically replay the media, otherwisefalse
-
getRepeat
public boolean getRepeat()
Get whether or not the media player will automatically repeat playing the media when it has finished playing.- Returns:
true
if the media will be automatically replayed, otherwisefalse
-
-