Switches the user's video input device based on the provided options.
The options for switching the user's video.
The preferred video input device ID.
Flag indicating whether to turn off the video.
Additional parameters required for switching the video.
A promise that resolves when the video input device has been switched.
Switches the user's video input device based on the provided options.
This method checks permissions, enumerates available devices, and updates the video stream based on user preferences. It also manages UI updates and alerts.
Param: options
The options for switching the user's video.
Param: options.videoPreference
The preferred video input device ID.
Param: options.checkoff
Flag indicating whether to turn off the video.
Param: options.parameters
Additional parameters required for switching the video.
Param: options.parameters.audioOnlyRoom
Indicates if the room is audio-only.
Param: options.parameters.frameRate
The desired frame rate for the video.
Param: options.parameters.vidCons
Video constraints such as width and height.
Param: options.parameters.prevVideoInputDevice
The previous video input device ID.
Param: options.parameters.showAlert
Function to show alerts to the user.
Param: options.parameters.hasCameraPermission
Indicates if the user has camera permission.
Param: options.parameters.updateVideoSwitching
Function to update video switching state.
Param: options.parameters.updateUserDefaultVideoInputDevice
Function to update the default video input device.
Param: options.parameters.requestPermissionCamera
Function to request camera permission.
Param: options.parameters.streamSuccessVideo
Function to handle successful video stream.
Param: options.parameters.sleep
Function to pause execution for a specified duration.
Param: options.parameters.checkMediaPermission
Function to check media permissions.
Returns
A promise that resolves when the video input device has been successfully switched.
Throws
Throws an error if switching the video input device fails.
Example