Methods

editTracksInfo

editTracksInfo(data)

Allows to edit the tracks information (active tracks and style).

Parameter

data

cast.receiver.media.TracksInfo

The tracks information. The tracks definition can not change so the tracks field will be undefined (and should be ignored).

getCurrentTimeSec

getCurrentTimeSec() returns number

Provides the current time in seconds.

Returns

number Current time (in seconds) of the playback.

getDurationSec

getDurationSec() returns number

Provides the duration of the media in seconds.

Returns

number Duration of the video, in seconds.

getState

getState() returns cast.receiver.media.PlayerState

Provides the state of the player.

Returns

cast.receiver.media.PlayerState The current state of the player.

getVolume

getVolume() returns cast.receiver.media.Volume

Provides the stream volume.

Returns

cast.receiver.media.Volume The media volume.

load

load(contentId, autoplay, opt_time, opt_tracksInfo, opt_onlyLoadTracks)

Loads content to be played.

Parameter

contentId

string

The content ID. Should be treated as an opaque string.

autoplay

boolean

Whether the content should play after load.

opt_time

Optional

number

The expected current time after load (in seconds).

opt_tracksInfo

Optional

cast.receiver.media.TracksInfo

The tracks information.

opt_onlyLoadTracks

Optional

boolean

If true, only the tracks will be loaded, the application will be responsible to call load. If it is true, opt_tracksInfo should be provided.

pause

pause()

Pauses playback.

play

play()

Starts playback.

registerEndedCallback

registerEndedCallback(endedCallback)

Registers an API that the player should call when the media has ended.

Parameter

endedCallback

function()

The callback method called when the player has ended.

registerErrorCallback

registerErrorCallback(errorCallback)

Registers an API that the player should call when there is an error.

Parameter

errorCallback

function(Object)

The callback method called when the player has an error.

registerLoadCallback

registerLoadCallback(loadCallback)

Registers an API that the player should call when load is complete.

Parameter

loadCallback

function()

The callback method called when the player has completed load succesfully.

reset

reset()

Resets the player. After this call the player state should be IDLE (no media loaded).

seek

seek(time, opt_resumeState)

Sets playback to start at a new time position.

Parameter

time

number

The expected current time after seek (in seconds).

opt_resumeState

Optional

cast.receiver.media.SeekResumeState

The expected state after seek.

setVolume

setVolume(volume)

Sets the stream volume.

Parameter

volume

cast.receiver.media.Volume

New volume.

unregisterEndedCallback

unregisterEndedCallback()

Called to unregister for ended callbacks.

unregisterErrorCallback

unregisterErrorCallback()

Called to unregister for error callbacks.

unregisterLoadCallback

unregisterLoadCallback()

Called to unregister for load callbacks.