Can't switch preview video when using **navigator.mediaDevices.getUserMedia** before

Description
Can’t switch preview video when using navigator.mediaDevices.getUserMedia before.

Browser Console Error

Which Web Video SDK version?
video-sdk version: 1.11.6

Video SDK Code Snippets
I have an issue: Camera will be stoped when screen device is locked so my solution is using navigator.mediaDevices.getUserMedia so that we got another problem that can’t switch preview camera

switch preview camera func:
Screenshot 2024-07-20 at 11.11.55

when we start preview video, we also create video dom :

base on this website:

My question is:

  1. I need your help to fix this problem.
  2. If we can’t use navigator.mediaDevices.getUserMedia to solve my issue above so if is there any solution for this ?.

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Preview screen
  2. Switch camera

Screenshots

Troubleshooting Routes
The troubleshooting attempt types you’ve already exhausted, including testing with the appropriate sample app (found on Zoom · GitHub).

Device (please complete the following information):

  • Device: Mac
  • OS: Ventura 13.3.1
  • Browser: Chrome
  • Browser: Version 126.0.6478.183 (Official Build) (arm64)

other
comment line 773 → 778 will not get error.

Hope see your answer soon.
Thanks

Hey @dunt

Sorry for the late reply.

Camera will be stoped when screen device is locked so my solution is using navigator.mediaDevices.getUserMedia

In Video SDK Web, we provide an option named stayAwake in the client.init method. It may meet your requirements.

we got another problem that can’t switch preview camera

Since the camera is being used to prevent screen lock, it cannot be used for the preview.

Thanks
Vic

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.