Class: RemotePlayerController

Constructor

RemotePlayerController

new RemotePlayerController(player)

Parameter

player

cast.framework.RemotePlayer

The player to control.

Value must not be null.

Methods

addEventListener

addEventListener(type, handler)

Registers an event handler for a player change.

Parameter

type

cast.framework.RemotePlayerEventType

Event type.

Value must not be null.

handler

function(non-null cast.framework.RemotePlayerChangedEvent)

Event handler.

getFormattedTime

getFormattedTime(timeInSec)

Converts a number representing an interval of seconds to a string with HH:MM:SS format.

Parameter

timeInSec

number

Must be positive. Intervals longer than 100 hours get truncated silently.

getSeekPosition

getSeekPosition(currentTime, duration) returns number

Convert current play time to a progress percentage.

Parameter

currentTime

number

The current playing time.

duration

number

Current media total playing time.

Returns

number Current seek position in percentage.

getSeekTime

getSeekTime(currentPosition, duration) returns number

Convert current play seek percentage to seek time.

Parameter

currentPosition

number

Current seek position in percentage.

duration

number

Current media total playing time.

Returns

number The current playing time.

muteOrUnmute

muteOrUnmute()

Mute or unmute the audio of the connected device.

playOrPause

playOrPause()

Play or pause current playing media.

removeEventListener

removeEventListener(type, handler)

Unregister an event handler for a player change.

Parameter

type

cast.framework.RemotePlayerEventType

Event type.

Value must not be null.

handler

function(non-null cast.framework.RemotePlayerChangedEvent)

Event handler.

seek

seek()

Seeks the media item to player currentTime value.

setVolumeLevel

setVolumeLevel()

Sets the volume level of the connected device to the player volumeLevel value.

skipAd

skipAd()

Skip the ad currently playing on the receiver.

stop

stop()

Stops the media player.