Class LocalMediaHandler

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

Events

  • videoStream - Emitted every time videoStream changes.
  • * - Emitted every time a change that can affect to any property happens.

Hierarchy

  • LocalMediaHandler

Properties

_audioMuted: boolean = false
_audioOnlyStream?: ManagedStream
_beforeShareScreenVideo: boolean = true
_mediaConstraints: MediaStreamConstraints
_mediaTypes: MediaTypes = ...
_updateMedia: UpdateMedia
_videoMuted: boolean = false
_videoStream?: ManagedStream
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

audioOutputDevices$: Observable<MediaDeviceInfo[]>

The list of available video input devices

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[]>
emitter: EventEmitter<Events, any> = ...
forceRefreshDevices: Subject<void> = ...
subscription: Subscription = ...
videoInputDevices$: Observable<MediaDeviceInfo[]>

The list of available audio output devices

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 | MediaStreamConstraints;
          mediaTypes: undefined | MediaTypes;
      } = {}
      • mediaConstraints: undefined | MediaStreamConstraints
      • mediaTypes: undefined | MediaTypes

    Returns MediaStreamConstraints

  • Return the media constraints configured for the call

    Returns 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 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.

    Example

    Change video resolution

    const audio = true;
    const video = {
    height: 256,
    width: 256,
    };
    await call.setMediaConstraints({audio, video});
    console.log("media updated");

    Parameters

    • mediaConstraints: MediaStreamConstraints

      The requested media constraints

    Returns Promise<void>

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

    Example

    Disable video

    await call.setMediaTypes({audio: true, video: false, screen: false});
    console.log("media updated");

    Parameters

    Returns Promise<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>

Generated using TypeDoc