Rate this page:

Player

Represents an audio player. Add the following line to your scenario code to use the class:

require(Modules.Player);

Methods

addEventListener

Copy URL
addEventListener(event: 

PlayerEvents

,
callback:

Function

):

void

Adds handler for specific event generated by Player. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler will be called.

Parameters

  • Event class (i.e., PlayerEvents.PlaybackFinished)

  • callback:

    Function

    Handler function. A single parameter is passed - object with event information

Returns

  • type:

    void

addMarker

Copy URL
addMarker(offset: 

number

):

void

Add playback marker. The PlayerEvents.PlaybackMarkerReached event will be triggered when the marker is reached.

Parameters

  • offset:

    number

    Positive/negative offset (ms) from the start/end of media.

Returns

  • type:

    void

pause

Copy URL
pause(): 

void

Pause playback. To continue playback use the Player.resume method.

Returns

  • type:

    void

removeEventListener

Copy URL
removeEventListener(event: 

PlayerEvents

,
callback:

Function

):

any

Removes handler for specific event generated by Player

Parameters

  • Event class (i.e., PlayerEvents.PlaybackFinished)

  • callback:

    Function

    Optional

    Handler function. If not specified, all event listeners are removed

Returns

  • type:

    any

resume

Copy URL
resume(): 

void

Resume playback after the Player.pause method was called.

Returns

  • type:

    void

sendMediaTo

Copy URL
sendMediaTo(mediaUnit: 

VoxMediaUnit

,
optional:

sendMediaOptions

):

void

Start sending media (voice and video) from this call to media unit specified in targetMediaUnit. Each call can send media to any number of other calls, but can receive from just one. So if targetCall was already receiving media from another call, that link would break.

Parameters

Returns

  • type:

    void

stop

Copy URL
stop(): 

void

Stops playback. The current player's instance will be destroyed.

Returns

  • type:

    void

stopMediaTo

Copy URL
stopMediaTo(mediaUnit: 

VoxMediaUnit

):

void

Stop sending media (voice and video) from this call to media unit specified in targetMediaUnit.

Parameters

  • mediaUnit:

    VoxMediaUnit

    media unit that will not receive media from this conference anymore.

Returns

  • type:

    void