Class: WebRTSPlayer

Members

(static, constant) BUFFER_TYPE :string

WebRTSPlayer HISPlayer buffer types.
Properties:
Name Value Type Description
CONNECTION Connection string
INITIAL Initial string
SEEK Seek string
PAUSE Pause string
BACKGROUND Background string

(static, constant) HisPlayerEvent :string

WebRTSPlayer HISPlayer event types.
Properties:
Name Value Type Description
LICENSE_ERROR licenseError string
STATE_CHANGE stateChange string The event has the detail field with the PLAYER_STATES.
BUFFER_TYPE bufferType string The event has the detail field with the BUFFER_TYPE.
ERROR error string The event has the detail field with the error.

(static, constant) PLAYER_STATES :string

WebRTSPlayer HISPlayer states.
Properties:
Name Value Type Description
NONE None string
CONTENT_REQUESTED ContentRequested string
READY Ready string
BUFFERING Buffering string
PLAYING Playing string
PAUSED Paused string
ENDED Ended string

Methods

addEventListener(type, listener)

Add an event listener to this object.
Parameters:
Name Type Description
type string The event type to listen for.
listener EventListener | function The callback or listener object to invoke.

destroy()

Destroys the WebRTS player instance and cleans up all associated resources.

getAudios() → {Array.<AudioTrack>}

Returns the audio tracks of the current playback.

getCurrentAudio() → (nullable) {AudioTrack}

Returns the current audio track of the current playback.

getCurrentTrack() → (nullable) {Track}

Returns the current track of the current playback.

getTracks() → {Array.<Track>}

Returns the video tracks of the current playback.

getVolume() → {number}

Returns the current volume. Valid values are contained between 0.0 and 1.0.

init(userConfig)

Create WebRTS player.
Parameters:
Name Type Description
userConfig WebRTSConfig

isMuted() → {boolean}

Returns true if the current playback is muted.

listenToAllEvents(listener)

Add an event listener to this object that is invoked for all events types the object fires.
Parameters:
Name Type Description
listener EventListener | function The callback or listener object to invoke.

pause()

Pause the playback. If the stream is already paused, this method does nothing.

play()

Resumes the playback if the stream is loaded and paused.

removeEventListener(type, listener)

Remove an event listener from this object.
Parameters:
Name Type Description
type string The event type for which you wish to remove a listener.
listener EventListener | function The callback or listener object to remove.

setBuffer(minopt, maxopt)

Sets the buffer limits for the player. If both `min` and `max` are provided, the buffer will be set manually with the specified values. If neither `min` nor `max` is provided, the buffer will be set automatically based on a 'normal' network profile.
Parameters:
Name Type Attributes Description
min number <optional>
The minimum buffer size in milliseconds. If not provided, defaults to a 'normal' profile value.
max number <optional>
The maximum buffer size in milliseconds. If not provided, defaults to a 'normal' profile value.

setMute(muted)

Mute the current playback.
Parameters:
Name Type Description
muted boolean

setVolume(volume)

Set the volume for the current playback.
Parameters:
Name Type Description
volume number The volume to set, from 0 (muted) to 1 (loudest).