Switches the user's video stream based on the provided video preference and other parameters.
This method manages the process of switching the user's video input device,
checking permissions, and updating the relevant application state.
If the specified device is not accessible, it attempts to find an alternative.
Param: options
The options for switching the user's video.
Param: options.videoPreference
The preferred video input device ID.
Param: options.checkoff
A flag indicating whether to turn off the video before switching.
Param: options.parameters
The parameters required for switching the video.
Param: options.parameters.showAlert
Function to show alert messages to the user.
Param: options.parameters.hasCameraPermission
Flag indicating if the user has granted camera permission.
Param: options.parameters.updateVideoSwitching
Function to update the video switching state.
Param: options.parameters.requestPermissionCamera
Function to request camera permission from the user.
Param: options.parameters.checkMediaPermission
Function to check if media permissions are granted.
Returns
A promise that resolves when the video switching is complete.
Throws
Will throw an error if the audio input device cannot be accessed or if there is an unexpected error.
Example
awaitswitchUserVideoAlt({ videoPreference:'user', checkoff:false, parameters: { hasCameraPermission:true, updateVideoSwitching: (state) => { /* update state */ }, // other parameters... }, });
Switches the user's video stream based on the provided video preference and other parameters.
This method manages the process of switching the user's video input device, checking permissions, and updating the relevant application state. If the specified device is not accessible, it attempts to find an alternative.
Param: options
The options for switching the user's video.
Param: options.videoPreference
The preferred video input device ID.
Param: options.checkoff
A flag indicating whether to turn off the video before switching.
Param: options.parameters
The parameters required for switching the video.
Param: options.parameters.showAlert
Function to show alert messages to the user.
Param: options.parameters.hasCameraPermission
Flag indicating if the user has granted camera permission.
Param: options.parameters.updateVideoSwitching
Function to update the video switching state.
Param: options.parameters.requestPermissionCamera
Function to request camera permission from the user.
Param: options.parameters.checkMediaPermission
Function to check if media permissions are granted.
Returns
A promise that resolves when the video switching is complete.
Throws
Will throw an error if the audio input device cannot be accessed or if there is an unexpected error.
Example