# Error Implementing Virtual Background Preview Using \`video-player\` in Zoom VideoSDK v2.1.0

**URL:** <https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689>\
**Category:** Video SDK\
**Created:** [January 16, 2025, 8:50am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689 "2025-01-16T08:50:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [January 16, 2025, 8:50am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/1 "2025-01-16T08:50:04Z")

</div>

**Video SDK Type and Version**  
VideoSDK: 2.1.0

**Description**  
I attempted to remove the `canvas` and use the `video-player` nested within the `video-player-container` to display the virtual background preview, as outlined in the latest version of the ZoomVideoSDK documentation: [Preview Camera](https://developers.zoom.us/docs/video-sdk/web/preview/#preview-camera) [Changelog](https://developers.zoom.us/changelog)([Version 2.1.0 - Zoom Developers](https://developers.zoom.us/changelog/video-sdk/web/2.1.0/)). However, this approach failed and returned the following error:

`Cannot start video with virtual background.` Using the canvas still works as expected.

Additionally, I couldn’t find any updated implementation in the [Zoom VideoSDK Web Sample](https://github.com/zoom/videosdk-web-sample/blob/master/src/feature/preview/preview.tsx). Is the new method not work yet, and does it still require the canvas to work properly?

**Environment**  
Browser/client type and version: Chrome - Version 131.0.6778.205 (Official Build) (arm64)  
OS version: MacOS 15.1

---

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [January 22, 2025, 4:20am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/2 "2025-01-22T04:20:10Z")

</div>

I tried upgrading to version 2.1.5 but it still doesn’t work. Can anyone help me with this problem? 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:** [January 23, 2025, 7:03am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/3 "2025-01-23T07:03:40Z")

</div>

Hey @lmtruong1512

Thanks for your feedback.

Could you share some code snippets with us?

The [Video SDK Web sample app](https://github.com/zoom/videosdk-web-sample/tree/master) is also updated.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [January 23, 2025, 9:23am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/4 "2025-01-23T09:23:04Z")

</div>

Hi @vic.yang

Thank you for your response.

I have followed the exact instructions from the [Zoom Video SDK documentation](https://developers.zoom.us/docs/video-sdk/web/preview/#preview-camera) and implemented it as shown below:

```auto
<video-player-container class="local-preview-container">
  <video-player id="local-preview-video"></video-player>
</video-player-container>

  localVideoTrack.start(document.querySelector('#local-preview-video'), {
    imageUrl: 'blur'
  })

```

Regarding the [Zoom VideoSDK Web Sample](https://github.com/zoom/videosdk-web-sample/blob/master/src/feature/preview/preview.tsx), I noticed that it still uses the `canvas` element to render the blurred background. However, according to the updated documentation, it seems that the `video-player` element should be used instead.

Please check the implementation at this reference:  
[preview.tsx#L202](https://github.com/zoom/videosdk-web-sample/blob/master/src/feature/preview/preview.tsx#L202).

---

<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:** [January 23, 2025, 9:46am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/5 "2025-01-23T09:46:41Z")

</div>

Hey @lmtruong1512

Yes.

Using the canvas to render video is still supported but is no longer recommended.

Additionally, the canvas approach is not supported when using the WebRTC video solution.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [January 23, 2025, 10:00am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/6 "2025-01-23T10:00:29Z")

</div>

@vic.yang  
However, I am concerned about using the `video-player` element for rendering virtual backgrounds, as recommended in the latest documentation. It seems that this approach is not work at the moment. Could you confirm this?

---

<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:** [January 23, 2025, 10:27am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/7 "2025-01-23T10:27:40Z")

</div>

Hey @lmtruong1512

Thanks for sharing your concern with me.

I tested the `localVideoTrack.start` method with the `video-player` and the `blur` virtual background, and it works as expected.

Could you try it again? You can update the sample code on line 118 to include the virtual background option.

> <https://github.com/zoom/videosdk-web-sample/blob/2b9c19b755e7819c2559aff4fd96dcb76b3fd690/src/feature/preview/preview.tsx#L118>

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![GSDev](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gsdev/32/51527_2.png) [@GSDev](https://devforum.zoom.us/u/GSDev)\
**Post date:** [January 23, 2025, 10:50pm UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/8 "2025-01-23T22:50:20Z")

</div>

Having the same issue with the virtual background. I attempted adding the { imageUrl: ‘blur’ } to the line suggested here in the sample app and it just throws “Cannot start video with virtual background”

---

<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:** [January 24, 2025, 1:33am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/9 "2025-01-24T01:33:49Z")

</div>

Hey @GSDev

Thanks for your feedback.

> Cannot start video with virtual background

This error occurs because a virtual background was used with an `HTMLVideoElement`, whereas a `video-player` was expected.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [January 24, 2025, 4:35am UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/10 "2025-01-24T04:35:22Z")

</div>

@vic.yang Thanks! I tried it, and it worked. Previously, I was not using the `video-player` element, which is why it didn’t work.

---

<div class="post-metadata">

**Author:** ![GSDev](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gsdev/32/51527_2.png) [@GSDev](https://devforum.zoom.us/u/GSDev)\
**Post date:** [January 24, 2025, 9:37pm UTC](https://devforum.zoom.us/t/error-implementing-virtual-background-preview-using-video-player-in-zoom-videosdk-v2-1-0/124689/11 "2025-01-24T21:37:46Z")

</div>

yep this got my sample app working with the virtual background in the video-player component. In my app I needed to go one further and load the web assembly in and make a couple configuration changes in the vite config to get the blur working.
