Handles the click event to toggle the participant's video on/off and manages video permission requests.

The options for handling the video click event.

The parameters required for the video action.

Indicates if media permission needs to be checked.

Indicates if camera permission has been granted.

Indicates if the video is currently active.

Indicates if the current room is audio-only.

Indicates if recording has started.

Indicates if recording has resumed.

Indicates if recording is paused.

Indicates if recording is stopped.

The media options for recording (e.g., "video", "audio").

The participant's level.

Indicates if the user is a co-host.

Indicates if there are admin restrictions on video.

State of the video request.

Timestamp of the video request.

The participant's name.

The socket connection used for communication.

The name of the room where the video is being toggled.

The default video input device.

The current facing mode of the camera.

Video constraints for the stream.

Desired frame rate for the video.

Indicates if a video action is currently taking place.

The local media stream.

The current audio setting.

The current video setting.

The current screenshare setting.

The current chat setting.

Interval time for updating request state.

A promise that resolves when the video action has been handled.

This function checks the current status of the video and handles the logic for starting or stopping the video stream. It validates permissions and room settings before allowing the video to be activated or deactivated.

const options: ClickVideoOptions = {
parameters: {
checkMediaPermission: true,
hasCameraPermission: false,
videoAlreadyOn: false,
audioOnlyRoom: false,
recordStarted: false,
recordResumed: false,
recordPaused: false,
recordStopped: false,
recordingMediaOptions: 'video',
islevel: '1',
youAreCoHost: false,
adminRestrictSetting: false,
videoRequestState: null,
videoRequestTime: 0,
member: 'John Doe',
socket: socketInstance,
roomName: 'myRoom',
userDefaultVideoInputDevice: '',
currentFacingMode: 'user',
vidCons: { width: 1280, height: 720 },
frameRate: 30,
videoAction: false,
localStream: null,
audioSetting: 'on',
videoSetting: 'on',
screenshareSetting: 'off',
chatSetting: 'allow',
updateRequestIntervalSeconds: 30,
showAlert: (alert) => console.log(alert.message),
updateVideoAlreadyOn: (status) => console.log(`Video already on: ${status}`),
updateVideoRequestState: (state) => console.log(`Video request state: ${state}`),
updateLocalStream: (stream) => console.log('Local stream updated'),
streamSuccessVideo: streamSuccessFunction,
disconnectSendTransportVideo: disconnectFunction,
requestPermissionCamera: requestPermissionFunction,
checkPermission: checkPermissionFunction,
getUpdatedAllParams: () => parameters,
},
};

const clickVideoService = new ClickVideo();
await clickVideoService.clickVideo(options);

Constructors

Methods

Constructors

Methods