Interface ContentShareController

interface ContentShareController {
    addContentShareObserver(observer: ContentShareObserver): void;
    enableSimulcastForContentShare(
        enable: boolean,
        encodingParams?: ContentShareSimulcastEncodingParameters,
    ): void;
    enableSVCForContentShare(enable: boolean): void;
    forEachContentShareObserver(
        observerFunc: (observer: ContentShareObserver) => void,
    ): void;
    pauseContentShare(): void;
    removeContentShareObserver(observer: ContentShareObserver): void;
    setContentAudioProfile(audioProfile: AudioProfile): void;
    setContentShareVideoCodecPreferences(
        preferences: VideoCodecCapability[],
    ): void;
    startContentShare(stream: MediaStream): Promise<void>;
    startContentShareFromScreenCapture(
        sourceId?: string,
        frameRate?: number,
    ): Promise<MediaStream>;
    stopContentShare(): void;
    unpauseContentShare(): void;
}

Hierarchy (View Summary)

Implemented by

Methods

  • Toggle simulcast for content share. This should be called before calling startContentShare or startContentShareFromScreenCapture. The default encoding parameters are:

    • High layer: 1200 kbps max bitrate
    • Low layer: 300 kbps max bitrate, scale down resolution by 2, and 5 fps max frame rate.

    Simulcast is only supported for the H.264 and VP8 codecs. On Chromium-based browsers the default content share codec is AV1, which does not support simulcast; when the preferred codec is AV1 or VP9 the SDK will automatically use SVC instead (see enableSVCForContentShare). To use simulcast, additionally set an H.264 or VP8 preference via setContentShareVideoCodecPreferences.

    Parameters

    • enable: boolean

      Enable/disable simulcast

    • OptionalencodingParams: ContentShareSimulcastEncodingParameters

      Overide the default encoding params for either layer in max bitrate, scale resolution down by, or max frame rate.

    Returns void

  • Toggle SVC for content share. This should be called before calling startContentShare or startContentShareFromScreenCapture. This will only have impact if using an SVC supporting codec for content share, which is currently only AV1 (the default content share codec on Chromium-based browsers). It cannot be enabled at the same time as simulcast.

    Parameters

    • enable: boolean

      Enable/disable SVC

    Returns void