Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Events

  • event_audio_statistic_data_change(payload: { avg_loss: number; bandwidth: number; bitrate: number; encoding: boolean; jitter: number; max_loss: number; rtt: number; sample_rate: number }): void
  • Occurs when the audio statistics data is changed;

    Parameters

    • payload: { avg_loss: number; bandwidth: number; bitrate: number; encoding: boolean; jitter: number; max_loss: number; rtt: number; sample_rate: number }

      The event detail.

      • avg_loss: number

        Audio's Average package loss.

      • bandwidth: number

        Bandwidth, measured in bits per second (bps)

      • bitrate: number

        Bit rate, measured in bits per second (bps)

      • encoding: boolean

        If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.

      • jitter: number

        Audio's jitter.

      • max_loss: number

        Audio's maximum package loss.

      • rtt: number

        Audio's round trip time.

      • sample_rate: number

        Audio's sample rate.

    Returns void

  • event_connection_change(payload: { state: "Connected" | "Fail" }): void
  • Occurs when the connection is changed.

    Parameters

    • payload: { state: "Connected" | "Fail" }
      • state: "Connected" | "Fail"

    Returns void

  • event_video_statistic_data_change(payload: { avg_loss: number; bandwidth: number; bitrate: number; encoding: boolean; fps: number; height: number; jitter: number; max_loss: number; rtt: number; sample_rate: number; width: number }): void
  • Occurs when the video statistics data is changed;

    Parameters

    • payload: { avg_loss: number; bandwidth: number; bitrate: number; encoding: boolean; fps: number; height: number; jitter: number; max_loss: number; rtt: number; sample_rate: number; width: number }

      The event detail

      • avg_loss: number

        Video's average package loss.

      • bandwidth: number

        Bandwidth, measured in bits per second (bps)

      • bitrate: number

        Bit rate, measured in bits per second (bps)

      • encoding: boolean

        If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.

      • fps: number

        Video's frame rate in frames per second (FPS).

      • height: number

        Video's resolution height.

      • jitter: number

        Video's jitter.

      • max_loss: number

        Video's maximum package loss.

      • rtt: number

        Video's round trip time.

      • sample_rate: number

        Video's sample rate.

      • width: number

        Video's resolution width.

    Returns void

Variables

onEnded: ((this: LiveVideo, ev: CustomEvent) => any) | null

Occurs when streaming is ended.

liveVideo.addEventListener('ended', () => {

});


onPlaying: ((this: LiveVideo, ev: CustomEvent) => any) | null

Occurs when streaming is playing.

liveVideo.addEventListener('playing', () => {

});


onResulutionChange: ((this: LiveVideo, ev: CustomEvent<{ newVal: number; oldVal: number }>) => any) | null

Occurs when resolution of the streaming changes.

liveVideo.addEventListener('resolution-change', (event) => {
const {
detail: { oldVal, newVal },
} = event;
console.log(`resulotion changes from ${oldVal}P to ${newVal}P`);
});
onRewindConfig: ((this: LiveVideo, ev: CustomEvent<boolean>) => any) | null

Occurs when the rewind capability of the stream changes.

liveVideo.addEventListener('rewind-config', (event) => {
const {
detail: isSupported,
} = event;
console.log(`Current streaming supports rewind:${isSupported}`);
});
onRewindTotalTime: ((this: LiveVideo, ev: CustomEvent<number>) => any) | null

Occurs when a new TS (Transport Stream) segment is updated, the detail indicates the maximum rewind duration available at that moment.

liveVideo.addEventListener('rewind-total-time', (event) => {
const {
detail: totalTime,
} = event;
console.log(`Current max rewind time: ${totalTime}`);
});
onTimeupdate: ((this: LiveVideo, ev: CustomEvent) => any) | null

Occurs in rewind mode, when the time indicated by the currentTime attribute has been updated.

onwaiting: ((this: LiveVideo, ev: CustomEvent) => any) | null

Occurs when streaming is blocking, it's better to show the loading.

liveVideo.addEventListener('waiting', () => {

});


Functions

  • event_auto_play_audio_failed(): void
  • 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'.

    Returns void