Version
Create a LiveVideo or reuse the existing LiveVideo and attach the streaming to it.
Note the returned live-videoLiveVideo element must be a child node of the live-video-container LiveVideoContainer.
<live-video-container class="streaming-container">
<!-- Other html tags -->
</live-video-container>
const element = await streaming.attachStreaming(
channelId,
token,
VideoQuality.Video_720P
);
document.querySelector(".streaming-container").appendChild(element);
Required. The channel ID.
Required. The JWT token.
Required. Quality of the video. One of the following: 90P/360P/640P/720P/1080P.
Optional. Empty value: create a new element; String value: LiveVideo element selector specified by document.querySelector; LiveVideo Element value: Specified element
Detach the streaming from all previously attached LiveVideo elements or specific elements.
const elements = await streaming.detachStreaming(channelId);
if (Array.isArray(elements)) {
elements.forEach((e) => e.remove());
} else {
elements.remove();
}`
Required. The channel ID.
Optional. Empty value: detach all streamings. String value:LiveVideo element selector specified by document.querySelector; LiveVideo Element value: Specified element
Removes the event handler.
Event name.
The event handler.
Listens for events and handles them.
Event name.
The event handler.
Details in event_connection_change
Occurs when the connection is changed.
listener Details in event_video_statistic_data_change
Occurs when the video statistics data is changed;
The event detail
Video's average package loss.
Bandwidth, measured in bits per second (bps)
Bit rate, measured in bits per second (bps)
If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.
Video's frame rate in frames per second (FPS).
Video's resolution height.
Video's jitter.
Video's maximum package loss.
Video's round trip time.
Video's sample rate.
Video's resolution width.
listener Details in event_audio_statistic_data_change
Occurs when the audio statistics data is changed;
The event detail.
Audio's Average package loss.
Bandwidth, measured in bits per second (bps)
Bit rate, measured in bits per second (bps)
If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.
Audio's jitter.
Audio's maximum package loss.
Audio's round trip time.
Audio's sample rate.
listener Details in event_auto_play_audio_failed
Occurs when the SDK tried and failed to auto play audio.
This is usually because the streaming was played without any prior user interaction with the page.
In this callback, you need to manually set the muted
attribute of the live-video element to 'false'.
Get an instance for managing the streaming. This method will return a same instance if called multiple times.
Optional. Specifies the init options.
Destroys the client.
Zoom Broadcast streaming for web platform.