Join room with disabled camera

Hello,

I join room using like so

    zoomVideo = ZoomVideo.createClient()
    await zoomVideo.init('pl-PL', 'Global', { patchJsMedia: true })
    await zoomVideo.join(TOPIC, TOKEN, USER_ID, PASSCODE)

    zoomSession = zoomVideo.getMediaStream()

Now when user is not allow to use camera i have error and that is fine.
zoomHelpers.js:14 you got an error: NotAllowedError: Permission denied

However when he allow to use camera but I do not want to at start start video i have problem.
To start camera i have
await zoomSession.startVideo()

But i want to start camera on button click of user.
However if I do not use function
await zoomSession.startVideo()

I do not see any participant, also i have no sound. But 100% I`am in the room.
Some times when i do not startVideo i see error of blob:… not found.

So is there option for me to join room with disabled camera and enable it on click.

If i do not run startVideo also no events fire.
Regards

Hey @Prze

Thanks for your feedback.

Do you want to turn on the camera only after user interaction? For example, clicking a button.

This can be easily accomplished by placing the call to zoomSession.startVideo() inside the callback function that handles the button click event. Here’s a straightforward example:

buttonElement.addEventListener("click", async () => {
  await zoomSession.startVideo();
});

Thanks
Vic

@vic.yang Yes.

However if i do not use before await zoomSession.startVideo() I will not have events and i do not see participants.

For now i found that code works. I enable video on start, next i disable it. After that button click works as expected.

Events work fine. However it looks like ugly hack.

    await zoomSession.startVideo()
    setTimeout(async () => {
       await zoomSession.stopVideo()
    }, 1)