Interface AudioVideoFacade

[[ActiveSpeakerDetectorFacade]] listens to the volume indicator updates from the [[RealtimeController]].

When you are done using an ActiveSpeakerDetectorFacade, you should perform some cleanup steps in order to avoid memory leaks:

  1. Unsubscribe from listeners; e.g., from active speaker callbacks via ActiveSpeakerDetectorFacade.unsubscribeFromActiveSpeakerDetector.
  2. Drop your reference to the facade to allow it to be garbage collected.
interface AudioVideoFacade {
    transcriptionController?: TranscriptionController;
    addAudioMixObserver(observer: AudioMixObserver): void;
    addContentShareObserver(observer: ContentShareObserver): void;
    addDeviceChangeObserver(observer: DeviceChangeObserver): void;
    addObserver(observer: AudioVideoObserver): void;
    addVideoTile(): VideoTile;
    bindAudioElement(element: HTMLAudioElement): Promise<void>;
    bindVideoElement(tileId: number, videoElement: HTMLVideoElement): void;
    captureVideoTile(tileId: number): ImageData;
    chooseAudioOutput(deviceId: string): Promise<void>;
    chooseVideoInputQuality(
        width: number,
        height: number,
        frameRate: number,
    ): void;
    createAnalyserNodeForAudioInput(): RemovableAnalyserNode;
    demoteFromPrimaryMeeting(): void;
    enableSimulcastForContentShare(
        enable: boolean,
        encodingParams?: ContentShareSimulcastEncodingParameters,
    ): void;
    enableSVCForContentShare(enable: boolean): void;
    getAllRemoteVideoTiles(): VideoTile[];
    getAllVideoTiles(): VideoTile[];
    getCurrentMeetingAudioStream(): Promise<MediaStream>;
    getLocalVideoTile(): VideoTile;
    getRemoteVideoSources(): VideoSource[];
    getRTCPeerConnectionStats(
        selector?: MediaStreamTrack,
    ): Promise<RTCStatsReport>;
    getVideoInputQualitySettings(): VideoQualitySettings;
    getVideoTile(tileId: number): VideoTile;
    hasStartedLocalVideoTile(): boolean;
    listAudioInputDevices(forceUpdate?: boolean): Promise<MediaDeviceInfo[]>;
    listAudioOutputDevices(forceUpdate?: boolean): Promise<MediaDeviceInfo[]>;
    listVideoInputDevices(forceUpdate?: boolean): Promise<MediaDeviceInfo[]>;
    mixIntoAudioInput(stream: MediaStream): MediaStreamAudioSourceNode;
    pauseContentShare(): void;
    pauseVideoTile(tileId: number): void;
    promoteToPrimaryMeeting(
        credentials: MeetingSessionCredentials,
    ): Promise<MeetingSessionStatus>;
    realtimeCanUnmuteLocalAudio(): boolean;
    realtimeIsLocalAudioMuted(): boolean;
    realtimeMuteLocalAudio(): void;
    realtimeSendDataMessage(
        topic: string,
        data: any,
        lifetimeMs?: number,
    ): void;
    realtimeSetCanUnmuteLocalAudio(canUnmute: boolean): void;
    realtimeSubscribeToAttendeeIdPresence(
        callback: (
            attendeeId: string,
            present: boolean,
            externalUserId?: string,
            dropped?: boolean,
            posInFrame?: RealtimeAttendeePositionInFrame,
        ) => void,
    ): void;
    realtimeSubscribeToFatalError(callback: (error: Error) => void): void;
    realtimeSubscribeToLocalSignalStrengthChange(
        callback: (signalStrength: number) => void,
    ): void;
    realtimeSubscribeToMuteAndUnmuteLocalAudio(
        callback: (muted: boolean) => void,
    ): void;
    realtimeSubscribeToReceiveDataMessage(
        topic: string,
        callback: (dataMessage: DataMessage) => void,
    ): void;
    realtimeSubscribeToSetCanUnmuteLocalAudio(
        callback: (canUnmute: boolean) => void,
    ): void;
    realtimeSubscribeToVolumeIndicator(
        attendeeId: string,
        callback: VolumeIndicatorCallback,
    ): void;
    realtimeUnmuteLocalAudio(): boolean;
    realtimeUnsubscribeFromReceiveDataMessage(topic: string): void;
    realtimeUnsubscribeFromVolumeIndicator(
        attendeeId: string,
        callback?: VolumeIndicatorCallback,
    ): void;
    realtimeUnsubscribeToAttendeeIdPresence(
        callback: (
            attendeeId: string,
            present: boolean,
            externalUserId?: string,
            dropped?: boolean,
            posInFrame?: RealtimeAttendeePositionInFrame,
        ) => void,
    ): void;
    realtimeUnsubscribeToFatalError(callback: (error: Error) => void): void;
    realtimeUnsubscribeToLocalSignalStrengthChange(
        callback: (signalStrength: number) => void,
    ): void;
    realtimeUnsubscribeToMuteAndUnmuteLocalAudio(
        callback: (muted: boolean) => void,
    ): void;
    realtimeUnsubscribeToSetCanUnmuteLocalAudio(
        callback: (canUnmute: boolean) => void,
    ): void;
    removeAllVideoTiles(): void;
    removeAudioMixObserver(observer: AudioMixObserver): void;
    removeContentShareObserver(observer: ContentShareObserver): void;
    removeDeviceChangeObserver(observer: DeviceChangeObserver): void;
    removeLocalVideoTile(): void;
    removeObserver(observer: AudioVideoObserver): void;
    removeVideoTile(tileId: number): void;
    removeVideoTilesByAttendeeId(attendeeId: string): number[];
    setAudioProfile(audioProfile: AudioProfile): void;
    setContentAudioProfile(audioProfile: AudioProfile): void;
    setContentShareVideoCodecPreferences(
        preferences: VideoCodecCapability[],
    ): void;
    setDeviceLabelTrigger(trigger: () => Promise<MediaStream>): void;
    setVideoCodecSendPreferences(preferences: VideoCodecCapability[]): void;
    setVideoMaxBandwidthKbps(maxBandwidthKbps: number): void;
    start(options?: { signalingOnly?: boolean }): void;
    startAudioInput(device: AudioInputDevice): Promise<MediaStream>;
    startContentShare(stream: MediaStream): Promise<void>;
    startContentShareFromScreenCapture(
        sourceId?: string,
        frameRate?: number,
    ): Promise<MediaStream>;
    startLocalVideoTile(): number;
    startVideoInput(device: VideoInputDevice): Promise<MediaStream>;
    startVideoPreviewForVideoInput(element: HTMLVideoElement): void;
    stop(): void;
    stopAudioInput(): Promise<void>;
    stopContentShare(): void;
    stopLocalVideoTile(): void;
    stopVideoInput(): Promise<void>;
    stopVideoPreviewForVideoInput(element: HTMLVideoElement): void;
    subscribeToActiveSpeakerDetector(
        policy: ActiveSpeakerPolicy,
        callback: (activeSpeakers: string[]) => void,
        scoresCallback?: (scores: { [attendeeId: string]: number }) => void,
        scoresCallbackIntervalMs?: number,
    ): void;
    unbindAudioElement(): void;
    unbindVideoElement(tileId: number, cleanUpVideoElement?: boolean): void;
    unpauseContentShare(): void;
    unpauseVideoTile(tileId: number): void;
    unsubscribeFromActiveSpeakerDetector(
        callback: (activeSpeakers: string[]) => void,
    ): void;
}

Hierarchy (View Summary)

Implemented by

Properties

Methods

addAudioMixObserver addContentShareObserver addDeviceChangeObserver addObserver addVideoTile bindAudioElement bindVideoElement captureVideoTile chooseAudioOutput chooseVideoInputQuality createAnalyserNodeForAudioInput demoteFromPrimaryMeeting enableSimulcastForContentShare enableSVCForContentShare getAllRemoteVideoTiles getAllVideoTiles getCurrentMeetingAudioStream getLocalVideoTile getRemoteVideoSources getRTCPeerConnectionStats getVideoInputQualitySettings getVideoTile hasStartedLocalVideoTile listAudioInputDevices listAudioOutputDevices listVideoInputDevices mixIntoAudioInput pauseContentShare pauseVideoTile promoteToPrimaryMeeting realtimeCanUnmuteLocalAudio realtimeIsLocalAudioMuted realtimeMuteLocalAudio realtimeSendDataMessage realtimeSetCanUnmuteLocalAudio realtimeSubscribeToAttendeeIdPresence realtimeSubscribeToFatalError realtimeSubscribeToLocalSignalStrengthChange realtimeSubscribeToMuteAndUnmuteLocalAudio realtimeSubscribeToReceiveDataMessage realtimeSubscribeToSetCanUnmuteLocalAudio realtimeSubscribeToVolumeIndicator realtimeUnmuteLocalAudio realtimeUnsubscribeFromReceiveDataMessage realtimeUnsubscribeFromVolumeIndicator realtimeUnsubscribeToAttendeeIdPresence realtimeUnsubscribeToFatalError realtimeUnsubscribeToLocalSignalStrengthChange realtimeUnsubscribeToMuteAndUnmuteLocalAudio realtimeUnsubscribeToSetCanUnmuteLocalAudio removeAllVideoTiles removeAudioMixObserver removeContentShareObserver removeDeviceChangeObserver removeLocalVideoTile removeObserver removeVideoTile removeVideoTilesByAttendeeId setAudioProfile setContentAudioProfile setContentShareVideoCodecPreferences? setDeviceLabelTrigger setVideoCodecSendPreferences? setVideoMaxBandwidthKbps start startAudioInput startContentShare startContentShareFromScreenCapture startLocalVideoTile startVideoInput startVideoPreviewForVideoInput stop stopAudioInput stopContentShare stopLocalVideoTile stopVideoInput stopVideoPreviewForVideoInput subscribeToActiveSpeakerDetector unbindAudioElement unbindVideoElement unpauseContentShare unpauseVideoTile unsubscribeFromActiveSpeakerDetector

Properties

transcriptionController?: TranscriptionController

Methods

  • Remove the promoted attendee from the Primary meeting. This client will stop sharing audio, video, and data messages. This will revert the end-user to precisely the state they were before a call to promoteToPrimaryMeeting

    This will have no effect if there was no previous successful call to promoteToPrimaryMeeting. This may result in AudioVideoObserver.audioVideoWasDemotedFromPrimaryMeeting but there is no need to wait for that callback to revert UX, etc.

    Returns void

  • This API will be deprecated in favor of ClientMetricReport.getRTCStatsReport().

    It makes an additional call to the getStats API and therefore may cause slight performance degradation.

    Please subscribe to metricsDidReceive(clientMetricReport: ClientMetricReport) callback, and get the raw RTCStatsReport via clientMetricReport.getRTCStatsReport().

    Parameters

    • Optionalselector: MediaStreamTrack

    Returns Promise<RTCStatsReport>

  • Allows an attendee in a Replica meeting to immediately transition to a Primary meeting attendee without need for reconnection. The promise should always return a session status even upon failure (i.e. it should never reject). See the guide for more information.

    The resolved MeetingSessionStatus will contain a MeetingSessionStatusCode of the following:

    • MeetingSessionStatusCode.OK: The promotion was successful (i.e. session token was valid, there was room in the Primary meeting, etc.), audio will begin flowing and the attendee can begin to send data messages, and content/video if the call is not already at limit.
    • MeetingSessionStatusCode.AudioAuthenticationRejected: Credentials provided were invalid when connection attempted to Primary meeting. There may be an issue with your mechanism which allocates the Primary meeting attendee for the Replica meeting proxied promotion. This also may indicate that this API was called in a non-Replica meeting.
    • MeetingSessionStatusCode.AudioCallAtCapacity: Credentials provided were correct but there was no room in the Primary meeting. Promotions to Primary meeting attendee take up a slot, just like regular Primary meeting attendee connections and are limited by the same mechanisms.
    • MeetingSessionStatusCode.SignalingBadRequest or MeetingSessionStatusCode.SignalingInternalServerError: Other failure, possibly due to disconnect or timeout. These failures are likely retryable.

    Application code may also receive a callback on AudioVideoObserver.videoAvailabilityDidChange to indicate they can begin to share video.

    chime::DeleteAttendee on the Primary meeting attendee will result in AudioVideoObserver.audioVideoWasDemotedFromPrimaryMeeting to indicate the attendee is no longer able to share.

    Any disconnection will trigger an automatic demotion to avoid unexpected or unwanted promotion state on reconnection. If the attendee still needs to be an interactive participant in the Primary meeting, promoteToPrimaryMeeting should be called again with the same credentials.

    This function should not be called until the first one resolves.

    Parameters

    Returns Promise<MeetingSessionStatus>

    Promise which resolves to a session status for the request. See possible options above.

  • Set codec preferences for this clients send stream in order of most preferred to least preferred. The controller will fallback for one of two reasons

    • The codec is not supported by the browser
    • Another client that has joined the conference does not support receiving the video. Note that if another client does not support any of the codecs provided the sender will not fallback, and that client will not be able to receive from this sender.

    If there is no overlap between what is passed in and what is supported by the browser, this function may not have any effect, and the default set of codecs for this browser will be used.

    Parameters

    Returns void

  • Start the meeting session. By default this will connect and begin sending and receiving audio, depending on the implementation.

    This method also allows you to provide options for how connection occurs.

    The only supported option is signalingOnly. Specifying this option will cause the controller to only connect the meeting signaling channel. This can be performed relatively early in the join lifecycle (e.g., prior to choosing audio devices), which can improve join latency.

    Your code is responsible for calling start again without signalingOnly to complete connection.

    Parameters

    • Optionaloptions: { signalingOnly?: boolean }

      Passing signalingOnly: true will cause only the initial signaling connection to occur.

    Returns void

  • Starts a video preview of the currently selected video and binds it a video element to be displayed before a meeting begins. Make sure to call [[stopVideoPreviewForVideoInput]] when the preview is no longer necessary so that the stream can be released and turn off the camera if it is not being used anymore.

    Parameters

    • element: HTMLVideoElement

    Returns void