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.
Method Summary
Public Methods | ||
public |
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 |
async forceUpdateDevices() Force the update of the devices list |
|
public |
getActiveAudioDevice(): * Return the MediaDeviceInfo of the active audio device |
|
public |
getActiveVideoDevice(): * Return the MediaDeviceInfo of the active video device |
|
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 |
getCurrentMediaConstraints(param: {mediaTypes: ?MediaTypes, mediaConstraints: ?MediaStreamConstraints}): MediaStreamConstraints Obtains current enabled media stream constraints. |
|
public |
Return the media constraints configured for the call |
|
public |
getMediaTypes(): MediaTypes 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 |
async setActiveAudioInputDevice(audioInputDevice: MediaDeviceInfo): Promise<undefined> Updates the audio input device in used to the specified one |
|
public |
async setActiveVideoInputDevice(videoInputDevice: MediaDeviceInfo): Promise<undefined> Updates the video input device in used to the specified one |
|
public |
async setAvailableAudioInputDevices(availableAudioInputDevices: MediaDeviceInfo[]): Promise<undefined> Replaces the list of available audio input devices |
|
public |
async setAvailableVideoInputDevices(availableVideoInputDevices: MediaDeviceInfo[]): Promise<undefined> Replaces the list of available video input devices |
|
public |
async setMediaConstraints(mediaConstraints: MediaStreamConstraints): Promise<undefined> Update constraints of local media. |
|
public |
async setMediaTypes(mediaTypes: MediaTypes): Promise<undefined> Update the enabled local media. |
|
public |
async toggleCamera(): Promise<undefined> Changes the local video stream to the next available camera. |
|
public |
async toggleScreen(screen: boolean): Promise<undefined> Shares the screen. |
|
public |
async toggleVideo(video: boolean): Promise<undefined> Enables or disables the video. |
Public Methods
public async addVideo(): Promise<undefined> 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.
public canToggleCamera(): boolean source
Indicates if it is possible to change to a different camera
public getActiveAudioDevice(): * source
Return the MediaDeviceInfo of the active audio device
Return:
* | MediaDeviceInfo |
public getActiveVideoDevice(): * source
Return the MediaDeviceInfo of the active video device
Return:
* | MediaDeviceInfo |
public getAvailableAudioInputDevices(): MediaDeviceInfo[] source
Returns the list of available audio input devices
public getAvailableAudioOutputDevices(): MediaDeviceInfo[] source
Returns the list of available audio output devices
public getAvailableVideoInputDevices(): MediaDeviceInfo[] source
Returns the list of available video input devices
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:
Name | Type | Attribute | Description |
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 hasAudioTrack(): boolean source
Returns a boolean value indicating if the call has a local audio track
public hasVideoTrack(): boolean source
Returns a boolean value indicating if the call has a local video track
public muteAudio(mute: boolean) source
Mutes or unmutes the audio. If no parameter is specified it toggles current value.
Params:
Name | Type | Attribute | Description |
mute | boolean |
|
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.
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.
Params:
Name | Type | Attribute | Description |
mute | boolean |
|
When specified forces video to be mute or unmute |
public async setActiveAudioInputDevice(audioInputDevice: MediaDeviceInfo): Promise<undefined> source
Updates the audio input device in used to the specified one
Params:
Name | Type | Attribute | Description |
audioInputDevice | MediaDeviceInfo |
|
If no value is specified the default one is selected |
public async setActiveVideoInputDevice(videoInputDevice: MediaDeviceInfo): Promise<undefined> source
Updates the video input device in used to the specified one
Params:
Name | Type | Attribute | Description |
videoInputDevice | MediaDeviceInfo |
|
If no value is specified the default one is selected |
public async setAvailableAudioInputDevices(availableAudioInputDevices: MediaDeviceInfo[]): Promise<undefined> source
Replaces the list of available audio input devices
Params:
Name | Type | Attribute | Description |
availableAudioInputDevices | MediaDeviceInfo[] | The list of MediaDeviceInfo objects to be used as audio input |
public async setAvailableVideoInputDevices(availableVideoInputDevices: MediaDeviceInfo[]): Promise<undefined> source
Replaces the list of available video input devices
Params:
Name | Type | Attribute | Description |
availableVideoInputDevices | MediaDeviceInfo[] | The list of MediaDeviceInfo objects to be used as audio input |
public async setMediaConstraints(mediaConstraints: MediaStreamConstraints): Promise<undefined> 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:
Name | Type | Attribute | Description |
mediaConstraints | MediaStreamConstraints | The requested media constraints |
Example:
const audio = true;
const video = {
height: 256,
width: 256,
};
await call.setMediaConstraints({audio, video});
console.log("media updated");
public async setMediaTypes(mediaTypes: MediaTypes): Promise<undefined> 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:
Name | Type | Attribute | Description |
mediaTypes | MediaTypes | The requested media |
Example:
await call.setMediaTypes({audio: true, video: false, screen: false});
console.log("media updated");
public async toggleCamera(): Promise<undefined> source
Changes the local video stream to the next available camera.
public async toggleScreen(screen: boolean): Promise<undefined> source
Shares the screen. This feature is only available if "screen-sharing" capability is present.
Params:
Name | Type | Attribute | Description |
screen | boolean |
|
send screen if true, camera if false. If not specified it toggles from the last state. |
public async toggleVideo(video: boolean): Promise<undefined> source
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.
Params:
Name | Type | Attribute | Description |
video | boolean |
|
If specified forces video to be enabled or not |