How can I switch the camera off and on during a session?

Video SDK Type and Version
For Web (React): “@zoom/videosdk”: “^1.5.5”

Description

I need to give the user the opportunity to switch the camera on and off during the session. In the documentation I found such methods: startVideo(), stopVideo(). Perhaps there are more suitable methods for the implementation of such a functionality to make process faster/smoother?

How To Reproduce

During the session, the user presses the appropriate button and the camera is switched off. When he press the button again, the camera turns on.

React

  • Device: MacBook Pro
  • OS: macOS Monterey 12.0.1 (21A559)
  • Browser: Chrome 108.0.5359.124
  • SharedArrayBuffer is enabled

Hi @memx86 ,

Thanks for your question! To make sure I understand clearly, you’re looking for a different way to start/stop video, other than the mentioned methods? If so, is the reason that the starting/stopping is delayed for you?

Thanks,
Rehema

Yeah there is some delay but not critical. I was just wondering if there are some other methods that will fit my logic better. Maybe there is something that can turn camera on/off without creating a video stream instance

Hi @memx86 ,

Got it, thanks for clarifying. At this time, these are the only methods available for that functionality. The only other option I can think of is using some CSS to hide the video, instead of turning it off, based on a button click. While I can’t guarantee it, that might achieve your goal in a way that better suits your needs.

Thanks,
Rehema

1 Like