yodaRT.activity.Activity. MediaClient

Extends

Methods

start(uri, optionsopt) → {Promise.<string>}

Prepare a multimedia player for url, yet doesn't play it. Doesn't requires app to be the active app.

Parameters:
Name Type Attributes Description
uri string
options object <optional>
Name Type Attributes Default Description
streamType 'alarm' | 'playback' <optional>
'playback'
Returns:
Type:
Promise<string>

multimedia player id

start(uri, optionsopt) → {Promise.<string>}

Start playing your url. Requires app to be the active app.

Parameters:
Name Type Attributes Description
uri string
options object <optional>
Name Type Attributes Default Description
impatient boolean <optional>
true
streamType 'alarm' | 'playback' <optional>
'playback'
Returns:
Type:
Promise<string>

multimedia player id

pause(playerIdopt) → {Promise.<void>}

Pause the playing.

Parameters:
Name Type Attributes Description
playerId string <optional>
Returns:
Type:
Promise<void>

resume(playerId) → {Promise.<void>}

Resume the playing. Requires app to be the active app.

Parameters:
Name Type Description
playerId string
Returns:
Type:
Promise<void>

stop(playerId) → {Promise.<void>}

Stop the playing.

Parameters:
Name Type Description
playerId string
Returns:
Type:
Promise<void>

getPosition(playerId) → {Promise.<number>}

get position.

Parameters:
Name Type Description
playerId string
Returns:
Type:
Promise<number>

getLoopMode(playerId) → {Promise.<number>}

return whether to loop

Parameters:
Name Type Description
playerId string
Returns:
Type:
Promise<number>

setLoopMode(loop, playerId) → {Promise.<boolean>}

set loop playback if you pass true.

Parameters:
Name Type Description
loop boolean
playerId string
Returns:
Type:
Promise<boolean>

getEqMode(playerId) → {Promise.<number>}

return which EQ mode the player is.

Parameters:
Name Type Description
playerId string
Returns:
Type:
Promise<number>

setEqMode(eqMode, playerId) → {Promise.<boolean>}

set player EQ mode.

Parameters:
Name Type Description
eqMode number
playerId string
Returns:
Type:
Promise<boolean>

seek(pos, playerId) → {Promise.<void>}

Seek the given position.

Parameters:
Name Type Description
pos number
playerId string
Returns:
Type:
Promise<void>

setSpeed(speed, playerId) → {Promise.<void>}

set play speed.

Parameters:
Name Type Description
speed number
playerId string
Returns:
Type:
Promise<void>

Events

prepared

When the media resource is prepared.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

paused

When the media resource is paused.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

resumed

When the media resource is resumed.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

playbackcomplete

When the media playback is complete.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

cancel

When the media playback is canceled.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

bufferingupdate

When buffering progress is updates.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

seekcomplete

When the seek() operation is complete.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

speedchange

When the setSpeed() operation is complete.

Parameters:
Name Type Description
id string

multimedia player id

duration number
position number

error

Something went wrong

Type:
Parameters:
Name Type Description
id string

multimedia player id