Home Reference Source
import {LocalMediaHandler} from '@quobis/sippojs'
public class | source

LocalMediaHandler

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

Events

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

Member Summary

Public Members
public

emitter: EventEmitter

Method Summary

Public Methods
public

async addVideo(): Promise<void>

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

public

Indicates if it is possible to change to a different camera

public

Indicates if video can be enabled or disabled

public

Returns the list of available audio input devices

public

Returns the list of available audio output devices

public

Returns the list of available video input devices

public

Obtains current enabled media stream constraints.

public

Return the media constraints configured for the call

public

Return the media types configured for the call

public

Returns the local video stream

public

Returns a boolean value indicating if the call has a local audio track

public

Returns a boolean value indicating if the call has a local video track

public

Returns a boolean value indicating if local audio is muted

public

Returns a boolean value indication if local video is muted

public

Mutes or unmutes the audio.

public

Mutes or unmutes the video.

public

Updates the audio input device in used to the specified one

public

Updates the video input device in used to the specified one

public

setAvailableAudioInputDevices(availableAudioInputDevices: MediaDeviceInfo[]): Promise

Replaces the list of available audio input devices

public

setAvailableVideoInputDevices(availableVideoInputDevices: MediaDeviceInfo[]): Promise

Replaces the list of available video input devices

public

async setMediaConstraints(mediaConstraints: MediaStreamConstraints)

Update constraints of local media.

public

async setMediaTypes(mediaTypes: MediaTypes)

Update the enabled local media.

public

Changes the local video stream to the next available camera.

public

async toggleScreen(screen: boolean)

Shares the screen.

public

Enables or disables the video.

Public Members

public emitter: EventEmitter source

Public Methods

public async addVideo(): Promise<void> source

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

Return:

Promise<void>

public canToggleCamera(): boolean source

Indicates if it is possible to change to a different camera

Return:

boolean

public canToggleVideo(): boolean source

Indicates if video can be enabled or disabled

Return:

boolean

public getAvailableAudioInputDevices(): MediaDeviceInfo[] source

Returns the list of available audio input devices

Return:

MediaDeviceInfo[]

A list of MediaDeviceInfo objects that can be used as audio input

public getAvailableAudioOutputDevices(): MediaDeviceInfo[] source

Returns the list of available audio output devices

Return:

MediaDeviceInfo[]

A list of MediaDeviceInfo objects that can be used as audio output

public getAvailableVideoInputDevices(): MediaDeviceInfo[] source

Returns the list of available video input devices

Return:

MediaDeviceInfo[]

A list of MediaDeviceInfo objects that can be used as video input

public getCurrentMediaConstraints(param: {mediaTypes: ?MediaTypes, mediaConstraints: ?MediaStreamConstraints}): MediaStreamConstraints source

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

Params:

NameTypeAttributeDescription
param {mediaTypes: ?MediaTypes, mediaConstraints: ?MediaStreamConstraints}

public getMediaConstraints(): MediaStreamConstraints source

Return the media constraints configured for the call

public getMediaTypes(): MediaTypes source

Return the media types configured for the call

Return:

MediaTypes

public getVideoStream(): ManagedStream | undefined source

Returns the local video stream

public hasAudioTrack(): boolean source

Returns a boolean value indicating if the call has a local audio track

Return:

boolean

public hasVideoTrack(): boolean source

Returns a boolean value indicating if the call has a local video track

Return:

boolean

public isAudioMuted(): boolean source

Returns a boolean value indicating if local audio is muted

Return:

boolean

public isVideoMuted(): boolean source

Returns a boolean value indication if local video is muted

Return:

boolean

public muteAudio(mute: boolean) source

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

Params:

NameTypeAttributeDescription
mute boolean
  • optional

If specified forces audio to be mute or unmute

public muteVideo(mute: boolean) source

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

Params:

NameTypeAttributeDescription
mute boolean
  • optional

When specified forces video to be mute or unmute

public setActiveAudioInputDevice(audioInputDevice: MediaDeviceInfo): Promise source

Updates the audio input device in used to the specified one

Params:

NameTypeAttributeDescription
audioInputDevice MediaDeviceInfo
  • optional

If no value is specified the default one is selected

Return:

Promise

public setActiveVideoInputDevice(videoInputDevice: MediaDeviceInfo): Promise source

Updates the video input device in used to the specified one

Params:

NameTypeAttributeDescription
videoInputDevice MediaDeviceInfo
  • optional

If no value is specified the default one is selected

Return:

Promise

public setAvailableAudioInputDevices(availableAudioInputDevices: MediaDeviceInfo[]): Promise source

Replaces the list of available audio input devices

Params:

NameTypeAttributeDescription
availableAudioInputDevices MediaDeviceInfo[]

The list of MediaDeviceInfo objects to be used as audio input

Return:

Promise

public setAvailableVideoInputDevices(availableVideoInputDevices: MediaDeviceInfo[]): Promise source

Replaces the list of available video input devices

Params:

NameTypeAttributeDescription
availableVideoInputDevices MediaDeviceInfo[]

The list of MediaDeviceInfo objects to be used as audio input

Return:

Promise

public async setMediaConstraints(mediaConstraints: MediaStreamConstraints) source

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

Params:

NameTypeAttributeDescription
mediaConstraints MediaStreamConstraints

The requested media constraints

Example:

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

public async setMediaTypes(mediaTypes: MediaTypes) source

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

Params:

NameTypeAttributeDescription
mediaTypes MediaTypes

The requested media

Example:

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

public toggleCamera(): Promise source

Changes the local video stream to the next available camera.

Return:

Promise

public async toggleScreen(screen: boolean) source

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

Params:

NameTypeAttributeDescription
screen boolean
  • optional

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

public toggleVideo(video: boolean): Promise source

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

Params:

NameTypeAttributeDescription
video boolean
  • optional

If specified forces video to be enabled or not

Return:

Promise