Class LocalMediaHandler

Provides access to methods for managing actions related to local media. Instances of this class are obtained calling Conference#localMediaHandler

Properties

activeAudioInputDevice: BehaviorSubject<undefined | MediaDeviceInfo> = ...
activeAudioInputDevice$: Observable<undefined | MediaDeviceInfo>

The MediaDeviceInfo of the active audio device

activeVideoInputDevice: BehaviorSubject<undefined | MediaDeviceInfo> = ...
activeVideoInputDevice$: Observable<undefined | MediaDeviceInfo>

The MediaDeviceInfo of the active video device

audioInputDevices$: Observable<MediaDeviceInfo[]>

The list of available audio input devices

audioOnlyStream$: Observable<undefined | ManagedStream>

The local audio stream

audioOnlyStreamSubject: BehaviorSubject<undefined | ManagedStream> = ...
audioOutputDevices$: Observable<MediaDeviceInfo[]>

The list of available video input devices

beforeShareScreenVideo: boolean = true
canToggleCamera$: Observable<boolean>

Indicates if it is possible to change to a different camera

canToggleVideo$: Observable<boolean>

Indicates if video can be enabled or disabled

devices$: Observable<MediaDeviceInfo[]>
forceRefreshDevices: Subject<void> = ...
isAudioMuted$: Observable<boolean>

Indicates if local audio is muted

isAudioMutedSubject: BehaviorSubject<boolean> = ...
isPushToTalkActive$: Observable<boolean>

Indicates if push to talk is active

isPushToTalkActiveSubject: BehaviorSubject<boolean> = ...
isVideoMuted$: Observable<boolean>

Indicates if local video is muted

isVideoMutedSubject: BehaviorSubject<boolean> = ...
mediaConstraints$: Observable<Readonly<MediaStreamConstraints>>

The media constraints configured for the call

mediaConstraintsSubject: BehaviorSubject<Readonly<MediaStreamConstraints>>
mediaTypes$: Observable<Readonly<MediaTypes>>

The media types configured for the call

mediaTypesSubject: BehaviorSubject<MediaTypes> = ...
subscription: Subscription = ...
videoInputDevices$: Observable<MediaDeviceInfo[]>

The list of available audio output devices

videoStream$: Observable<undefined | ManagedStream>

The local video stream

videoStreamSubject: BehaviorSubject<undefined | ManagedStream> = ...

Accessors

  • get mediaConstraints(): Readonly<MediaStreamConstraints>
  • Return the media constraints configured for the call

    Returns Readonly<MediaStreamConstraints>

Methods

  • Updates media types adding video when screen is false or adds an internal mark to know video must be enabled when screen sharing ends.

    Returns Promise<void>

  • Returns Promise<undefined | MediaDeviceInfo>

  • Obtains current enabled media stream constraints. This is a combination of the media stream constraints configured for the call and the current media types.

    Parameters

    • __namedParameters: {
          mediaConstraints: undefined | Readonly<MediaStreamConstraints>;
          mediaTypes: undefined | Readonly<MediaTypes>;
      } = {}
      • mediaConstraints: undefined | Readonly<MediaStreamConstraints>
      • mediaTypes: undefined | Readonly<MediaTypes>

    Returns Readonly<MediaStreamConstraints>

  • Mutes or unmutes the audio. If no parameter is specified it toggles current value.

    Parameters

    • mute: boolean = !this.isAudioMuted

      If specified forces audio to be mute or unmute

    Returns void

  • Mutes or unmutes the video. If no parameter is specified it toggles current value.

    Note that this method just turns the emitted video black and implies no media renegotiation. Therefore, a video track will continue to be streamed. If you are instead looking for a method to stop sending video altogether check LocalMediaHandler.toggleVideo.

    Parameters

    • mute: boolean = !this.isVideoMuted

      When specified forces video to be mute or unmute

    Returns void

  • Updates the audio input device in used to the specified one

    Parameters

    • Optional audioInputDevice: MediaDeviceInfo

      If no value is specified the default one is selected

    Returns Promise<void>

  • Updates the video input device in used to the specified one

    Parameters

    • Optional videoInputDevice: MediaDeviceInfo

      If no value is specified the default one is selected

    Returns Promise<void>

  • Update constraints of local media. This feature is only available when the call has already been connected if "media-update" capability is present.

    Parameters

    • mediaConstraints: Readonly<MediaStreamConstraints>

      The requested media constraints

    Returns Promise<void>

    Example: Change video resolution

    const audio = true;
    const video = {
    height: 256,
    width: 256,
    };
    await call.setMediaConstraints({audio, video});
    console.log("media updated");
  • Update the enabled local media. This feature is only available when the call has already been connected if "media-update" capability is present.

    Parameters

    • mediaTypes: Readonly<MediaTypes>

      The requested media

    Returns Promise<void>

    Example: Disable video

    await call.setMediaTypes({audio: true, video: false, screen: false});
    console.log("media updated");
  • Turns on the microphone until stopPushToTalk method is called. Does nothing if microphone is not muted

    Returns void

  • Shares the screen. This feature is only available if "screen-sharing" capability is present.

    Parameters

    • screen: boolean = !this.mediaTypes.screen

      send screen if true, camera if false. If not specified it toggles from the last state.

    Returns Promise<void>

  • Enables or disables the video. If no parameter is specified it toggles current value.

    Note that this method will imply a media renegotation because the video track will be added or removed from the RTCPeerConnection. As a consequence, remote participants will receive a change in their remote participants streams.

    Parameters

    • video: boolean = !this.mediaTypes.video

      If specified forces video to be enabled or not

    Returns Promise<void>