Class SwitchVideoAlt

Switches the video input based on user preference and current state.

The options for switching the video input.

The parameters required for switching the video input.

Indicates if recording has started.

Indicates if recording has resumed.

Indicates if recording has stopped.

Indicates if recording is paused.

The current media options (e.g., "video").

Indicates if the video is currently on.

The current facing mode of the camera (e.g., "environment").

Indicates if the user is allowed to switch video.

Indicates if the current room is audio-only.

Function to update the current facing mode.

Function to update the visibility of the media settings modal.

Optional function to show alert messages.

Function to switch the user's video input.

A promise that resolves when the video input has been switched.

This function checks if the user is allowed to switch the video input based on the current state, and it shows alerts if there are any issues. If the video is already on, it cannot be switched until it is turned off, and vice versa. The facing mode of the camera is toggled between "user" and "environment".

const options: SwitchVideoAltOptions = {
parameters: {
recordStarted: false,
recordResumed: false,
recordStopped: false,
recordPaused: false,
recordingMediaOptions: 'video',
videoAlreadyOn: true,
currentFacingMode: 'user',
allowed: true,
audioOnlyRoom: false,
updateCurrentFacingMode: (mode) => console.log(`Facing mode updated to: ${mode}`),
updateIsMediaSettingsModalVisible: (isVisible) => console.log(`Media settings modal is now ${isVisible ? 'visible' : 'hidden'}`),
switchUserVideoAlt: async ({ videoPreference }) => console.log(`Switched video to: ${videoPreference}`),
getUpdatedAllParams: () => ({ }),
},
};

const switchVideoService = new SwitchVideoAlt();
await switchVideoService.switchVideoAlt(options);

Constructors

Methods

Constructors

Methods