VideoService

🚀

SDK Beta

This service is a part of the Beta program.

The VideoService allows managing the local participant's video stream.

Events

videoStarted

videoStarted(result: MediaStream): void

Emitted whenever the local participant successfully starts video transmission. The event can be triggered by the startVideo, startCustomVideo, or join method.

When a video input device is successfully changed during ongoing video transmission, the SDK emits two events: videoStopped and videoStarted. VideoStopped indicates that a video from the previous device is stopped. VideoStarted indicates that a video from a new device is started.

example

VoxeetSDK.video.on('videoStarted', (result) => {

});

Parameters:

NameTypeDescription
resultMediaStreamA new MediaStream object.

Returns: void


videoStopped

videoStopped(result: MediaStream): void

Emitted whenever the local participant successfully stops video transmission. The event can be triggered by the stopVideo or leave method.

When a video input device is successfully changed during ongoing video transmission, the SDK emits two events: videoStopped and videoStarted. VideoStopped indicates that a video from the previous device is stopped. VideoStarted indicates that a video from a new device is started.

example

VoxeetSDK.video.on('videoStopped', (result) => {

});

Parameters:

NameTypeDescription
resultMediaStreamThe stopped MediaStream object.

Returns: void

Methods

setVideoProcessor

setVideoProcessor(processor: VideoProcessor): Promise<void>

Sets a new video processor for an existing local participant's video stream to blur the participant's background or replace the background with an image. The processor is supported only on Chrome and Edge on desktop operating systems.

Parameters:

NameTypeDescription
processorVideoProcessorThe video processor.

Returns: Promise<void>


startCustomVideo

startCustomVideo(track: MediaStreamTrack, processor?: VideoProcessor): Promise<MediaStream>

Starts sending the local participant's video from a custom track to the conference.

If the participant calls this method when their video is already enabled, the SDK stops the existing video stream and starts a new one. In the case of calling this method before the conference, the SDK starts a stream that will be added to the conference after joining. The new stream is successfully added to the conference only if video is not disabled via the disableVideo method and video constraints are not set to false.

Currently, this method is supported only on Chrome and Edge on desktop operating systems.

Parameters:

NameTypeDescription
trackMediaStreamTrackThe input video track that replaces the camera track.
processor?VideoProcessorThe video processor.

Returns: Promise<MediaStream>


startVideo

startVideo(constraints?: MediaTrackConstraints, processor?: VideoProcessor): Promise<MediaStream>

Enables the local participant's camera and starts sending the local participant's video stream to the conference. If the participant calls this method when their video is already enabled, the SDK stops the existing video stream and starts a new one. The new stream is successfully added to the conference only if video is not disabled via the disableVideo method and video constraints are not set to false.

In the case of calling this method before the conference, the SDK starts a camera stream that will be added to the conference after joining.

Parameters:

NameTypeDescription
constraints?MediaTrackConstraintsThe WebRTC video constraints.
processor?VideoProcessorThe video processor that allows blurring the participant's background or replacing the background with an image. The processor is supported only on Chrome and Edge on desktop operating systems.

Returns: Promise<MediaStream>


stopVideo

stopVideo(): Promise<void>

Disables the local participant's camera and stops sending the local participant's video stream to the conference. If you want to see your video locally, as a preview, and not send it to the conference, use the disableVideo method.

Returns: Promise<void>


Did this page help you?