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() → {Promise.<void>}

Pause the playing.

Returns:
Type:
Promise<void>

resume() → {Promise.<void>}

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

Returns:
Type:
Promise<void>

stop() → {Promise.<void>}

Stop the playing.

Returns:
Type:
Promise<void>

getPosition() → {Promise.<number>}

get position.

Returns:
Type:
Promise<number>

getLoopMode() → {Promise.<number>}

return whether to loop

Returns:
Type:
Promise<number>

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

set loop playback if you pass true.

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

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

Seek the given position.

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

Events

prepared

When the media resource is prepared.

Parameters:
Name Type Description
id string

multimedia player id

duration string
position string

playbackcomplete

When the media playback is complete.

Parameters:
Name Type Description
id string

multimedia player id

cancel

When the media playback is canceled.

Parameters:
Name Type Description
id string

multimedia player id

bufferingupdate

When buffering progress is updates.

Parameters:
Name Type Description
id string

multimedia player id

seekcomplete

When the seek() operation is complete.

Parameters:
Name Type Description
id string

multimedia player id

error

Something went wrong

Type:
Parameters:
Name Type Description
id string

multimedia player id