public class CastVdoPlayer extends java.lang.Object implements VdoPlayer
VdoPlayer implementation that can be used to interact with the
VdoCipher Cast receiver app.
In order to use this class, you must pass a CastContext to create an instance.
To track cast session availability, use isCastSessionAvailable() to get session
status at start, and attach a CastSessionAvailabilityListener using
setSessionAvailabilityListener(CastSessionAvailabilityListener) to get further
session availability updates.
To join an existing playback session on the receiver app, use #joinSession(VdoInitParams);
to load a new session, use VdoPlayer.load(VdoInitParams).
VdoPlayer.InitializationListener, VdoPlayer.PlaybackEventListener, VdoPlayer.PlayerHost, VdoPlayer.PlayerHostNotReadyException, VdoPlayer.VdoInitParamsSTATE_BUFFERING, STATE_ENDED, STATE_IDLE, STATE_READY| Constructor and Description |
|---|
CastVdoPlayer(CastContext castContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPlaybackEventListener(VdoPlayer.PlaybackEventListener listener)
Register callbacks for playback events from this VdoPlayer
|
Track[] |
getAvailableTracks()
Returns the available tracks for the currently playing media.
|
long |
getBufferedTime()
Gets the time till which video is buffered
|
MediaInfo |
getCurrentMedia()
Returns a
MediaInfo object containing info corresponding to the currently playing media. |
long |
getCurrentTime()
Gets the current playback time of the video from the beginning.
|
long |
getDuration()
Gets the duration of the current video.
|
java.lang.Object |
getPlaybackProperty(java.lang.String propertyName)
Returns values of additional properties specific to current playback session.
|
float |
getPlaybackSpeed()
Returns the currently active playback speed.
|
int |
getPlaybackState()
Returns the current state of the player.
|
boolean |
getPlayWhenReady()
Whether playback will proceed when
VdoPlayer.getPlaybackState() == VdoPlayer.STATE_READY. |
Track[] |
getSelectedTracks()
Returns the selected tracks for the currently playing media.
|
boolean |
isAdaptive()
Returns if the current playback is adaptive.
|
boolean |
isCastSessionAvailable() |
boolean |
isSpeedControlSupported()
Returns if the current player supports changing the playback speed.
|
boolean |
joinSession(VdoPlayer.VdoInitParams vdoParams)
Join an existing cast session if the provided VdoInitParams is being played.
|
void |
load(VdoPlayer.VdoInitParams vdoParams)
Immediately starts loading a media for the player to play.
|
void |
release()
Release system resources used by this VdoPlayer.
|
void |
removePlaybackEventListener(VdoPlayer.PlaybackEventListener listener)
Remove a registered playback event listener from this VdoPlayer
|
void |
seekTo(long timeInMillis)
Seeks to a particular time in the video.
|
void |
setPlaybackSpeed(float speed)
Sets the playback speed.
|
void |
setPlayWhenReady(boolean playWhenReady)
Sets whether playback should proceed when
VdoPlayer.getPlaybackState() == VdoPlayer.STATE_READY. |
void |
setSelectedTracks(Track[] tracks)
Sets a fixed (non-adaptive) selection of tracks.
|
void |
setSessionAvailabilityListener(CastSessionAvailabilityListener listener) |
void |
stop()
Stops the currently loaded video.
|
public boolean isCastSessionAvailable()
public void setSessionAvailabilityListener(CastSessionAvailabilityListener listener)
public boolean joinSession(VdoPlayer.VdoInitParams vdoParams)
vdoParams - public int getPlaybackState()
VdoPlayergetPlaybackState in interface VdoPlayerVdoPlayer.STATE_IDLE, VdoPlayer.STATE_BUFFERING, VdoPlayer.STATE_READY, VdoPlayer.STATE_ENDED.public void setPlayWhenReady(boolean playWhenReady)
VdoPlayerVdoPlayer.getPlaybackState() == VdoPlayer.STATE_READY.
If the player is already in the ready state then this method can be used to pause and resume
playback.setPlayWhenReady in interface VdoPlayerplayWhenReady - Whether playback should proceed when ready.public boolean getPlayWhenReady()
VdoPlayerVdoPlayer.getPlaybackState() == VdoPlayer.STATE_READY.getPlayWhenReady in interface VdoPlayerpublic void load(VdoPlayer.VdoInitParams vdoParams)
VdoPlayerpublic long getCurrentTime()
VdoPlayergetCurrentTime in interface VdoPlayerpublic long getBufferedTime()
VdoPlayergetBufferedTime in interface VdoPlayerpublic long getDuration()
VdoPlayergetDuration in interface VdoPlayerpublic boolean isSpeedControlSupported()
VdoPlayerisSpeedControlSupported in interface VdoPlayerpublic void setPlaybackSpeed(float speed)
VdoPlayerVdoPlayer.PlaybackEventListener.onPlaybackSpeedChanged(float) will be called when the currently
active playback speed changes.setPlaybackSpeed in interface VdoPlayerspeed - factor by which playback speed should be changedpublic float getPlaybackSpeed()
VdoPlayergetPlaybackSpeed in interface VdoPlayerpublic void release()
VdoPlayerpublic void seekTo(long timeInMillis)
VdoPlayerpublic void addPlaybackEventListener(VdoPlayer.PlaybackEventListener listener)
VdoPlayeraddPlaybackEventListener in interface VdoPlayerlistener - listener for the callbackpublic void removePlaybackEventListener(VdoPlayer.PlaybackEventListener listener)
VdoPlayerremovePlaybackEventListener in interface VdoPlayerlistener - the listener to removepublic void stop()
VdoPlayerpublic Track[] getAvailableTracks()
VdoPlayergetAvailableTracks in interface VdoPlayerpublic Track[] getSelectedTracks()
VdoPlayergetSelectedTracks in interface VdoPlayerpublic void setSelectedTracks(Track[] tracks)
VdoPlayersetSelectedTracks in interface VdoPlayertracks - the tracks to selectpublic boolean isAdaptive()
VdoPlayerisAdaptive in interface VdoPlayerpublic MediaInfo getCurrentMedia()
VdoPlayerMediaInfo object containing info corresponding to the currently playing media.getCurrentMedia in interface VdoPlayerMediaInfo object corresponding to currently playing media, or null if no media is loadedpublic java.lang.Object getPlaybackProperty(java.lang.String propertyName)
VdoPlayerInteger.getPlaybackProperty in interface VdoPlayerpropertyName - name of desired property