# Error start video in preview screen: DOMException: Could not start video source and VideoNotStartedError

**URL:** <https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [July 11, 2024, 8:31am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445 "2024-07-11T08:31:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![phuongnv1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/phuongnv1/32/54805_2.png) [@phuongnv1](https://devforum.zoom.us/u/phuongnv1)\
**Post date:** [July 11, 2024, 8:31am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/1 "2024-07-11T08:31:07Z")

</div>

**Description**  
I opened the preview screen on two browsers, Chrome and Edge (with two USB cameras, referred to as Cam 1 and Cam 2).

- First, I accessed Chrome, and Cam 1 was displayed.
- Then, I accessed Edge, but Cam 1 did not appear và countered an error. I tried switching to Cam 2 using switchCamera but encountered an error.

However, in Chrome, switching to Cam 2 using switchCamera worked fine.

When I exit the Chrome browser preview screen, the Edge browser camera works normally.

**Browser Console Error**  
Error when Cam 1 did not appear in Edge: DOMException: Could not start video source  
Error when switching to Cam 2 in Edge: {“stack”: “Error: VideoNotStartedError”, “message”: “VideoNotStartedError”}

**Which Web Video SDK version?**  
1.11.6

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

1. Go to the preview screen on the Chrome browser, and Cam 1 works.
2. Go to the preview screen on the Edge browser, and Cam 1 does not work.
3. In the Edge browser, call the switchCamera function to switch to Cam 2, and Cam 2 does not work.
4. In the Chrome browser, call the switchCamera function to switch to Cam 2, and Cam 2 works.

**Device (please complete the following information):**

- Device: Windows
- OS: Windows 10 Version 22H2
- Browser: Chrome and Edge
- Browser Version: Chrome version 126.0.6478.127 (Official Build (Official Build) (64-bit) and Edge version 126.0.2592.87 (Official build) (64-bit)

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [July 12, 2024, 2:47am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/2 "2024-07-12T02:47:06Z")

</div>

Hey @phuongnv1

Thanks for your feedback.

This might be related to a known limitation on Windows.

When Camera1 is already being used by another program (in this case, Chrome), attempting to use Camera1 to capture video will result in an error.

You will need to specify a different camera to start video manually.

> **[CaptureVideoOption | Zoom Video SDK for Web - 1.11.10](https://marketplacefront.zoom.us/sdk/custom/web/interfaces/CaptureVideoOption.html)**
>
> Documentation for Zoom Video SDK for Web - 1.11.10

If you can share the problematic Session ID to help us confirm the issue, that would be great.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![phuongnv1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/phuongnv1/32/54805_2.png) [@phuongnv1](https://devforum.zoom.us/u/phuongnv1)\
**Post date:** [August 5, 2024, 10:49am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/3 "2024-08-05T10:49:40Z")

</div>

Hey @vic.yang,  
Thank you for your response, and I apologize for my delayed reply.

I am currently in the preview screen using `localTrack` to start, so the suggestion you provided doesn’t seem to apply.

I’ll describe my issue in more detail:

1. Edge browser enters the preview screen using Camera 1 =\> OK.
2. Chrome browser using Camera 1 =\> encountered the error “Device in use” (This is a limitation of Windows).
3. Chrome browser, I switch to Camera 2 (by recreating `localTrack` before starting the camera) =\> encountered the error “Could not start video source.”
4. Edge browser switches between two cameras and works fine. Only when I stop the camera in Edge does Chrome become able to use the camera (both cameras work =\> then Edge encounters the same error that Chrome initially did).

The above issue also occurs when both browsers enter the preview screen, each selecting a different camera (the browser that enters first gets to use the camera).

I don’t know if there is something wrong with the way I’m handling this?

Additionally, could you please explain why I don’t encounter the “Device in use” error when starting the camera with a virtual background?

Thanks

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [August 7, 2024, 12:54pm UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/4 "2024-08-07T12:54:57Z")

</div>

Hey @phuongnv1

Thanks for sharing the detailed steps with us.

> Could not start video source.

It might be [NotReadableError](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#notreadableerror). Could you test the camera with WebRTC official sample.

> **[Select audio and video sources](https://webrtc.github.io/samples/src/content/devices/input-output/)**
>
> WebRTC code samples

> why I don’t encounter the “Device in use” error when starting the camera with a virtual background

In the virtual background implementation, if the device is occupied, we will fall back to the default device (which is specified by the system). That’s why you will not encounter the “Device in use” error.

However, this fallback handling has a side effect because it is not the device you specified.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![phuongnv1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/phuongnv1/32/54805_2.png) [@phuongnv1](https://devforum.zoom.us/u/phuongnv1)\
**Post date:** [August 8, 2024, 2:43am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/5 "2024-08-08T02:43:12Z")

</div>

Hey @vic.yang ,

Thank you for your response.

> It might be `NotReadableError`

That’s correct, both the “Device in use” and “Could not start video source” messages are associated with the `NotReadableError`.

> Could you test the camera with WebRTC official sample.

I checked on WebRTC and encountered the same error.

According to the description of the `NotReadableError`, does it mean that there’s no way for each browser to use a different camera?

> In the virtual background implementation, if the device is occupied, we will fall back to the default device (which is specified by the system).

When falls back to the default device, it still uses the virtual background, right? If that’s the case, then no error would be received if the device is occupied.

> That’s why you will not encounter the “Device in use” error.

Is there a way I can handle the case where the camera starts with a virtual background to warn the user?

Additionally, Is there a way to determine the default device specified by the system?

Thanks  
Phuong

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [August 8, 2024, 6:46am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/6 "2024-08-08T06:46:13Z")

</div>

Hey @phuongnv1

> does it mean that there’s no way for each browser to use a different camera?

It depends on the device and OS, we tested the similar case on our device, it works without error.

> When falls back to the default device, it still uses the virtual background, right? If that’s the case, then no error would be received if the device is occupied.

The camera will not be the same one, browser will prioritize selecting an unoccupied device if one is available.

> Is there a way I can handle the case where the camera starts with a virtual background to warn the user?

Do you mean giving a warning when an incorrect camera is selected?

Currently, no selected camera device id for Local video track feature.

> Is there a way to determine the default device specified by the system?

When no other application is using the camera, the first time the camera is started, it uses the default device set in your system.

However, once this default device is occupied, the choice of which camera to use depends on the browser.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![phuongnv1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/phuongnv1/32/54805_2.png) [@phuongnv1](https://devforum.zoom.us/u/phuongnv1)\
**Post date:** [August 12, 2024, 1:51am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/7 "2024-08-12T01:51:04Z")

</div>

Hey @vic.yang

> It depends on the device and OS, we tested the similar case on our device, it works without error.

In my case, I am using two USB cameras (Logitech and HIKVISION) and two browsers: Chrome and Edge

- Chrome: Version 127.0.6533.99 (Official Build) (64-bit)
- Edge: Version 126.0.2592.102 (Official Build) (64-bit)

I tested it on WebRTC and encountered the same error.

> Do you mean giving a warning when an incorrect camera is selected?

No, when the user selects the camera in virtual background mode but the camera doesn’t turn on (Because the camera is being occupied). In this case, I want to warn the user ‘Your camera is being used by other apps. Close those apps and try again.’

Thanks  
Phuong

---

<div class="post-metadata">

**Author:** ![phuongnv1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/phuongnv1/32/54805_2.png) [@phuongnv1](https://devforum.zoom.us/u/phuongnv1)\
**Post date:** [August 20, 2024, 1:40am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/8 "2024-08-20T01:40:56Z")

</div>

@vic.yang  
Please help me respond to the above feedback.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [August 20, 2024, 3:14am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/9 "2024-08-20T03:14:10Z")

</div>

Hey @phuongnv1

Sorry for the late reply.

Are you still referring to the preview feature?

```javascript
try {
  await localVideo.start(canvas, { imageUrl: "url" });
} catch (e) {
  console.warn(e);
  // prompt the dialog
}

```

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![phuongnv1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/phuongnv1/32/54805_2.png) [@phuongnv1](https://devforum.zoom.us/u/phuongnv1)\
**Post date:** [August 21, 2024, 11:06am UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/10 "2024-08-21T11:06:53Z")

</div>

Hey @vic.yang

I still refer to the preview feature.  
When I start with imageUrl, I don’t receive any errors. It’s only when I start without using the virtual background that I encounter an error.

I still want to confirm with you that if I use the 2 USB cameras we discussed earlier, getting the `NotReadableError` when using the second camera will depend on the OS and the device. (We won’t be able to control this behavior)

Thanks  
Phuong

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [September 20, 2024, 9:07pm UTC](https://devforum.zoom.us/t/error-start-video-in-preview-screen-domexception-could-not-start-video-source-and-videonotstartederror/113445/11 "2024-09-20T21:07:36Z")

</div>

Closed on September 20, 2024, 9:07pm UTC

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