Interface VdoPlayer
-
- All Implemented Interfaces:
public interface VdoPlayerInterface for controlling playback.
The VdoPlayer instance returned in onInitializationSuccess can be used to load media and control playback.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public @interfaceVdoPlayer.TimelineChangeReasonpublic interfaceVdoPlayer.PlaybackEventListenerInterface for callbacks related to playback events.
-
Method Summary
Modifier and Type Method Description abstract intgetPlaybackState()Returns the current state of the player. abstract voidsetPlayWhenReady(boolean playWhenReady)Sets whether playback should proceed when getPlaybackState == STATE_READY. abstract booleangetPlayWhenReady()Whether playback will proceed when getPlaybackState == STATE_READY. abstract voidload(VdoInitParams vdoParams)Immediately starts loading a media for the player to play. abstract voidretry()Attempt to prepare the media while maintaining its playback state. abstract longgetCurrentTime()Gets the current playback time of the video from the beginning. abstract longgetBufferedTime()Gets the time till which video is buffered abstract longgetDuration()Gets the duration of the current video. abstract booleanisSpeedControlSupported()Returns if the current player supports changing the playback speed. abstract voidsetPlaybackSpeed(float speed)Sets the playback speed. abstract floatgetPlaybackSpeed()Returns the currently active playback speed. abstract voidrelease()Release system resources used by this VdoPlayer. abstract voidseekTo(long timeInMillis)Seeks to a particular time in the video. abstract voidaddPlaybackEventListener(VdoPlayer.PlaybackEventListener listener)Register callbacks for playback events from this VdoPlayer abstract voidremovePlaybackEventListener(VdoPlayer.PlaybackEventListener listener)Remove a registered playback event listener from this VdoPlayer abstract voidstop()Stops the currently loaded video. abstract Array<Track>getAvailableTracks()Returns the available tracks for the currently playing media. abstract Array<Track>getSelectedTracks()Returns the selected tracks for the currently playing media. abstract voidsetSelectedTracks(Array<Track> tracks)Sets a fixed (non-adaptive) selection of tracks. abstract booleanisAdaptive()Returns if the current playback is adaptive. abstract MediaInfogetCurrentMedia()Returns a MediaInfo object containing info corresponding to the currently playing media. abstract ObjectgetPlaybackProperty(String propertyName)Returns values of additional properties specific to current playback session. abstract voidsearchInSelectedSubtitle(String searchText, SubtitleSearchListener subtitleSearchListener)Search in selected subtitle and seek to matching cues. abstract voidsetAutoResumeCallback(AutoResumeCallback autoResumeCallback)Set callback to provide event when video start resume from saved seek position abstract booleanisCurrentMediaItemLive()Returns whether the current MediaItem is live, or false if the Timeline is empty abstract booleanisCurrentWindowDynamic()Indicates whether the currently playing media item is still being updated. abstract booleanisCurrentMediaItemSeekable()Returns whether the current MediaItem is seekable, or false if the Timeline is empty. abstract longgetCurrentLiveOffset()Returns the offset between the current real time and the playback position (if available). abstract intgetCurrentMediaItemIndex()Returns the index of the current MediaItem in the timeline, or the prospective index if the current timeline is empty. abstract VdoTimeLinegetCurrentTimeline()Returns the current Timeline. abstract voidseekToDefaultPosition()Seeks to the default position associated with the current MediaItem. abstract PlayerOptiongetPlayerOptions()* Called when the player configuration for requested media is loaded. -
-
Method Detail
-
getPlaybackState
abstract int getPlaybackState()
Returns the current state of the player.
- Returns:
One of the STATE_IDLE, STATE_BUFFERING, STATE_READY, STATE_ENDED.
-
setPlayWhenReady
abstract void setPlayWhenReady(boolean playWhenReady)
Sets whether playback should proceed when getPlaybackState == STATE_READY.
If the player is already in the ready state then this method can be used to pause and resume playback.
- Parameters:
playWhenReady- Whether playback should proceed when ready.
-
getPlayWhenReady
abstract boolean getPlayWhenReady()
Whether playback will proceed when getPlaybackState == STATE_READY.
- Returns:
Whether playback will proceed when ready.
-
load
abstract void load(VdoInitParams vdoParams)
Immediately starts loading a media for the player to play.
- Parameters:
vdoParams- parameters for the playback
-
retry
abstract void retry()
Attempt to prepare the media while maintaining its playback state.
-
getCurrentTime
abstract long getCurrentTime()
Gets the current playback time of the video from the beginning.
- Returns:
the current playback time of the video in milliseconds
-
getBufferedTime
abstract long getBufferedTime()
Gets the time till which video is buffered
- Returns:
buffer time in milliseconds
-
getDuration
abstract long getDuration()
Gets the duration of the current video.
- Returns:
duration of the current video in milliseconds
-
isSpeedControlSupported
abstract boolean isSpeedControlSupported()
Returns if the current player supports changing the playback speed.
- Returns:
true if speed control is supported
-
setPlaybackSpeed
abstract void setPlaybackSpeed(float speed)
Sets the playback speed. Passing 0 or a negative value will reset player to use default playback speed of 1. onPlaybackSpeedChanged will be called when the currently active playback speed changes.
- Parameters:
speed- factor by which playback speed should be changed
-
getPlaybackSpeed
abstract float getPlaybackSpeed()
Returns the currently active playback speed.
- Returns:
playback speed
-
release
abstract void release()
Release system resources used by this VdoPlayer.
A new VdoPlayer instance must be created to play/stream another video.
-
seekTo
abstract void seekTo(long timeInMillis)
Seeks to a particular time in the video.
- Parameters:
timeInMillis- time in milliseconds
-
addPlaybackEventListener
abstract void addPlaybackEventListener(VdoPlayer.PlaybackEventListener listener)
Register callbacks for playback events from this VdoPlayer
- Parameters:
listener- listener for the callback
-
removePlaybackEventListener
abstract void removePlaybackEventListener(VdoPlayer.PlaybackEventListener listener)
Remove a registered playback event listener from this VdoPlayer
- Parameters:
listener- the listener to remove
-
stop
abstract void stop()
Stops the currently loaded video.
-
getAvailableTracks
abstract Array<Track> getAvailableTracks()
Returns the available tracks for the currently playing media.
- Returns:
array containing available tracks, or empty array if no tracks are currently available
-
getSelectedTracks
abstract Array<Track> getSelectedTracks()
Returns the selected tracks for the currently playing media.
- Returns:
array containing selected tracks, or empty array if no tracks are currently selected
-
setSelectedTracks
abstract void setSelectedTracks(Array<Track> tracks)
Sets a fixed (non-adaptive) selection of tracks. The provided array must contain Track objects returned by the player, and also must contain only single Track corresponding to a Track.TYPE_* constant. Only the first track in the array corresponding to a Track.TYPE_* constant will be acknowledged.
- Parameters:
tracks- the tracks to select
-
isAdaptive
abstract boolean isAdaptive()
Returns if the current playback is adaptive.
- Returns:
true if player is adaptive, false otherwise
-
getCurrentMedia
abstract MediaInfo getCurrentMedia()
Returns a MediaInfo object containing info corresponding to the currently playing media.
- Returns:
MediaInfo object corresponding to currently playing media, or null if no media is loaded
-
getPlaybackProperty
abstract Object getPlaybackProperty(String propertyName)
Returns values of additional properties specific to current playback session. Returned values need to be cast to their expected types before use.
Get the value for propertyName TOTAL_PLAYED, TOTAL_COVERED
- Parameters:
propertyName- name of desired property- Returns:
requested property value as an object; null if not available
-
searchInSelectedSubtitle
abstract void searchInSelectedSubtitle(String searchText, SubtitleSearchListener subtitleSearchListener)
Search in selected subtitle and seek to matching cues.
- Parameters:
searchText- text to search in subtitle file.subtitleSearchListener- SubtitleSearchListener Callback for search result and errors com.vdocipher.aegis.player.internal.subtitle.SubtitleSearchListener.Error.
-
setAutoResumeCallback
abstract void setAutoResumeCallback(AutoResumeCallback autoResumeCallback)
Set callback to provide event when video start resume from saved seek position
- Parameters:
autoResumeCallback- AutoResumeCallback Callback for autoResumeCallbackcom.vdocipher.aegis.player.internal.util.AutoResumeCallback.
-
isCurrentMediaItemLive
abstract boolean isCurrentMediaItemLive()
Returns whether the current MediaItem is live, or false if the Timeline is empty
-
isCurrentWindowDynamic
abstract boolean isCurrentWindowDynamic()
Indicates whether the currently playing media item is still being updated. This is usually true for live streams that are not yet ended. Note that this flag is also true for non-live streams in some cases.
-
isCurrentMediaItemSeekable
abstract boolean isCurrentMediaItemSeekable()
Returns whether the current MediaItem is seekable, or false if the Timeline is empty.
-
getCurrentLiveOffset
abstract long getCurrentLiveOffset()
Returns the offset between the current real time and the playback position (if available).
-
getCurrentMediaItemIndex
abstract int getCurrentMediaItemIndex()
Returns the index of the current MediaItem in the timeline, or the prospective index if the current timeline is empty.
-
getCurrentTimeline
abstract VdoTimeLine getCurrentTimeline()
Returns the current Timeline. Never null, but may be empty.
-
seekToDefaultPosition
abstract void seekToDefaultPosition()
Seeks to the default position associated with the current MediaItem. The position can depend on the type of media being played. For live streams it will typically be the live edge. For other streams it will typically be the start.
-
getPlayerOptions
abstract PlayerOption getPlayerOptions()
* Called when the player configuration for requested media is loaded.
-
-
-
-