Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface RealtimeController

RealtimeController controls aspects meetings concerning realtime UX that for performance, privacy, or other reasons should be implemented using the most direct path. Callbacks generated by this interface should be consumed synchronously and without business logic dependent on the UI state where possible. All methods are prefixed with realtime to make it easier to perform audits of realtime control paths.

For an example involving performance implications, consider that volume indicator state is received for each attendee multiple times a second. The handler that receives WebSocket messages derives which indicators have updated and passes that information synchronously through the RealtimeController, which in turn provides the consumer of the volume indicator callbacks an opportunity to immediately render the information to the UI.

For an example involving privacy implications, consider that a mute button must accurately represent the mute state as otherwise a user may think they are muted when they are not. Creating a direct path from the mute button to the place where the underlying media stream is disabled ensures that muting is instantaneous and cannot fail.

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

  1. Unsubscribe from listeners; e.g., presence callbacks via RealtimeController.realtimeUnsubscribeToAttendeeIdPresence.
  2. Drop your reference to the controller to allow it to be garbage collected.

Hierarchy

  • RealtimeController

Implemented by

Index

Methods

realtimeCanUnmuteLocalAudio

  • realtimeCanUnmuteLocalAudio(): boolean

realtimeIsLocalAudioMuted

  • realtimeIsLocalAudioMuted(): boolean

realtimeMuteLocalAudio

  • realtimeMuteLocalAudio(): void
  • Mutes the audio input. If there is an active audio input, then a volume indicator update is also sent with the mute status for the current attendee id. It then synchronously notifies the callbacks if mute state changed. This mute is local and overrides any remote unmuted state received for the same attendee id.

    Returns void

realtimeReceiveDataMessage

  • realtimeReceiveDataMessage(dataMessage: DataMessage): void

realtimeSendDataMessage

  • realtimeSendDataMessage(topic: string, data: Uint8Array | string | any, lifetimeMs?: number): void

realtimeSetCanUnmuteLocalAudio

  • realtimeSetCanUnmuteLocalAudio(canUnmute: boolean): void

realtimeSetLocalAudioInput

  • realtimeSetLocalAudioInput(audioInput: MediaStream | null): void
  • Sets the audio input and stores the current mute state. Any previous media stream is first muted before it is replaced.

    Parameters

    • audioInput: MediaStream | null

    Returns void

realtimeSubscribeToAttendeeIdPresence

  • realtimeSubscribeToAttendeeIdPresence(callback: (attendeeId: string, present: boolean, externalUserId?: string, dropped?: boolean, posInFrame?: RealtimeAttendeePositionInFrame | null) => void): void

realtimeSubscribeToFatalError

  • realtimeSubscribeToFatalError(callback: (error: Error) => void): void
  • Subscribes to receive a callback when a fatal error is generated while processing an action. Receiving this callback potentially means that it was not possible to successfully mute, and so should be handled by tearing down the current connection and starting over.

    Parameters

    • callback: (error: Error) => void
        • Parameters

          Returns void

    Returns void

realtimeSubscribeToLocalSignalStrengthChange

  • realtimeSubscribeToLocalSignalStrengthChange(callback: (signalStrength: number) => void): void
  • Subscribes to changes in local signal strength

    Parameters

    • callback: (signalStrength: number) => void
        • (signalStrength: number): void
        • Parameters

          • signalStrength: number

          Returns void

    Returns void

realtimeSubscribeToMuteAndUnmuteLocalAudio

  • realtimeSubscribeToMuteAndUnmuteLocalAudio(callback: (muted: boolean) => void): void

realtimeSubscribeToReceiveDataMessage

  • realtimeSubscribeToReceiveDataMessage(topic: string, callback: (dataMessage: DataMessage) => void): void

realtimeSubscribeToSendDataMessage

  • realtimeSubscribeToSendDataMessage(callback: (topic: string, data: Uint8Array | string | any, lifetimeMs?: number) => void): void
  • Subscribe to local send message event

    Parameters

    • callback: (topic: string, data: Uint8Array | string | any, lifetimeMs?: number) => void
        • (topic: string, data: Uint8Array | string | any, lifetimeMs?: number): void
        • Parameters

          • topic: string
          • data: Uint8Array | string | any
          • Optional lifetimeMs: number

          Returns void

    Returns void

realtimeSubscribeToSetCanUnmuteLocalAudio

  • realtimeSubscribeToSetCanUnmuteLocalAudio(callback: (canUnmute: boolean) => void): void
  • Subscribes to the changes to the can unmute local audio state.

    Parameters

    • callback: (canUnmute: boolean) => void
        • (canUnmute: boolean): void
        • Parameters

          • canUnmute: boolean

          Returns void

    Returns void

realtimeSubscribeToVolumeIndicator

  • Subscribes to volume indicator changes for a specific attendee id with a callback. Volume is between 0.0 (min volume) and 1.0 (max volume). Signal strength can be 0 (no signal), 0.5 (weak signal), or 1 (good signal). A null value for any field means that it has not changed.

    Parameters

    Returns void

realtimeUnmuteLocalAudio

  • realtimeUnmuteLocalAudio(): boolean
  • Unmutes the audio input if currently allowed. If there is an active audio input, then a volume indicator update is also sent with the mute status for the current attendee id. It then synchronously notifies the callbacks if mute state changed. This unmute is local and overrides any remote muted state received for the same attendee id.

    Returns boolean

realtimeUnsubscribeFromReceiveDataMessage

  • realtimeUnsubscribeFromReceiveDataMessage(topic: string): void

realtimeUnsubscribeFromSendDataMessage

  • realtimeUnsubscribeFromSendDataMessage(callback: (topic: string, data: Uint8Array | string | any, lifetimeMs?: number) => void): void
  • Unsubscribe from local send message event

    Parameters

    • callback: (topic: string, data: Uint8Array | string | any, lifetimeMs?: number) => void
        • (topic: string, data: Uint8Array | string | any, lifetimeMs?: number): void
        • Parameters

          • topic: string
          • data: Uint8Array | string | any
          • Optional lifetimeMs: number

          Returns void

    Returns void

realtimeUnsubscribeFromVolumeIndicator

  • Unsubscribes to volume indicator changes for a specific attendee id. Optionally, you can pass a callback parameter to unsubscribe from a specific callback. Otherwise, all callbacks will be unsubscribed (e.g. activeSpeaker).

    Parameters

    Returns void

realtimeUnsubscribeToAttendeeIdPresence

  • realtimeUnsubscribeToAttendeeIdPresence(callback: (attendeeId: string, present: boolean, externalUserId?: string, dropped?: boolean, posInFrame?: RealtimeAttendeePositionInFrame | null) => void): void

realtimeUnsubscribeToFatalError

  • realtimeUnsubscribeToFatalError(callback: (error: Error) => void): void

realtimeUnsubscribeToLocalSignalStrengthChange

  • realtimeUnsubscribeToLocalSignalStrengthChange(callback: (signalStrength: number) => void): void
  • Unsubscribes to changes in local signal strength

    Parameters

    • callback: (signalStrength: number) => void
        • (signalStrength: number): void
        • Parameters

          • signalStrength: number

          Returns void

    Returns void

realtimeUnsubscribeToMuteAndUnmuteLocalAudio

  • realtimeUnsubscribeToMuteAndUnmuteLocalAudio(callback: (muted: boolean) => void): void

realtimeUnsubscribeToSetCanUnmuteLocalAudio

  • realtimeUnsubscribeToSetCanUnmuteLocalAudio(callback: (canUnmute: boolean) => void): void
  • Unsubscribes to the changes to the can unmute local audio state.

    Parameters

    • callback: (canUnmute: boolean) => void
        • (canUnmute: boolean): void
        • Parameters

          • canUnmute: boolean

          Returns void

    Returns void

Generated using TypeDoc