# Playing HTML Video Element In Layers API In Camera Mode Webview

**URL:** <https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777>\
**Category:** Zoom Apps\
**Created:** [September 11, 2023, 2:50am UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777 "2023-09-11T02:50:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![micah](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/micah/32/51875_2.png) [@micah](https://devforum.zoom.us/u/micah)\
**Post date:** [September 11, 2023, 2:50am UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/1 "2023-09-11T02:50:33Z")

</div>

Hi, I’ve been exploring the layers API’s capabilities, mostly utilizing the sample apps.

I’m curious, has anybody been able to get an HTML video element to play in the camera mode webview?

I tried both autoplay (with muted), which works on the sidebar but not in camera view, and I also tried triggering dynamically via Javascript with `.play()`.

To be clear, I don’t need audio to also send through, but it would be really nice if the video actually worked. Does the camera view do something special here that disables video or am I missing something?

I started from zoomapps-cameramode-vuejs and just loaded a standard 10 second video.

Here’s a demo of it working on the sidebar but the exact same code not working in the camera mode webview layer: [Loom | Free Screen & Video Recording Software | Loom](https://www.loom.com/share/da538f45ce8a4815afc9a07e3db36b02?sid=968756f5-5e7c-4a9b-915e-c5bb03d94a49)

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [September 12, 2023, 3:22pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/3 "2023-09-12T15:22:07Z")

</div>

@Robert.Wallis Do you have insight into this behavior and if camera mode would interfere?

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [September 12, 2023, 7:18pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/4 "2023-09-12T19:18:43Z")

</div>

@micah thanks for the video, I just confirmed I have the same issue trying to play an mp4 video in Camera Mode.

Maybe it’s something like the Content-Security-Policy, since the sidebar uses WKWebView (Safari / Edge) but Camera Mode uses Chrome (CEF), so they process things like this differently. It definitely looks like a bug. 🐞

```html
    <video
      autoplay
      muted
      mute
      style="
        border: solid 1px red;
        background-color: #ff000080;
        width: 300px;
        height: 200px;
      "
    >
      <source id="mp4" src="trailer.mp4" type="video/mp4" />
    </video>

```

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/1/0/10cec93995a8b1b71391c1390ccf11c35bc7c373.jpeg)

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [September 12, 2023, 7:21pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/5 "2023-09-12T19:21:06Z")

</div>

Also on my server I see it make two hits to the trailer.mp4 file when I call runRenderingContext, so I know the browser is getting it, but not why it’s not loading it.

---

<div class="post-metadata">

**Author:** ![micah](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/micah/32/51875_2.png) [@micah](https://devforum.zoom.us/u/micah)\
**Post date:** [September 14, 2023, 2:01am UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/6 "2023-09-14T02:01:37Z")

</div>

Thanks @Robert.Wallis for reproducing!

Yeah, I played with the CSP a little bit, but in the camera mode sample Vue JS mode the dev server can actually set the CSP headers. As a result, I was able to get it both working and not working in the sidebar, so I think my CSP headers should be set fine because I verified them going from not working to working. While it’s definitely a possibility I did something wrong and chromium may handle things differently (and it could be double checked), I think the bug or issue might be something else. Please someone else correct me if I’m wrong though.

Curious, do you think a Zoom engineer internally could somehow boot the CEF with the devtools enabled using remote debugging/port forwarding and just get an error message from CEF from your sample code? [https://groups.google.com/g/cefglue/c/dJw54PcVe5I?pli=1](https://groups.google.com/g/cefglue/c/dJw54PcVe5I?pli=1) has an example of that; might be out of date but looks like that kind of thing might be possible?

I think knowing the exact error here would be incredibly helpful for deciding what potentially next to pursue in terms of trying to get this kind of thing working.

Currently camera mode is difficult to debug because there aren’t logs/devtools that we can see.

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [September 14, 2023, 3:44pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/7 "2023-09-14T15:44:44Z")

</div>

Our team found out that Chromium doesn’t support some codecs for copyright reasons: [Google Code Archive - Long-term storage for Google Code Project Hosting.](https://code.google.com/archive/p/chromiumembedded/issues/371)

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [September 14, 2023, 3:56pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/8 "2023-09-14T15:56:22Z")

</div>

Totally agree that enabling remote debugging would help solve issues like this.  
CC: @evgeny.balashov

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [September 14, 2023, 5:56pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/9 "2023-09-14T17:56:52Z")

</div>

Changing from .mp4 to .webm fixed the issue. It turns out that CEF doesn’t support mp4 as noted above. I re-encoded the video from .mp4 to .webm and it works now.

```auto
ffmpeg -i trailer.mp4 trailer.webm

```

Then changed the video `src` to the webm file and removed the `type` attribute.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/e/9/e9c4cf46f74a378000fc0a6e574270d011b54b7d.jpeg)

Thanks to Drake for the answer

[edit: typos]

---

<div class="post-metadata">

**Author:** ![micah](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/micah/32/51875_2.png) [@micah](https://devforum.zoom.us/u/micah)\
**Post date:** [September 15, 2023, 3:36am UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/10 "2023-09-15T03:36:34Z")

</div>

Wow, fantastic!

Thanks for looking into this everyone and for the quick responses. Really cool to see it was literally just the file format/codec, and nice find on the CEF limitation there.

---

<div class="post-metadata">

**Author:** ![speleji](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/speleji/32/63269_2.png) [@speleji](https://devforum.zoom.us/u/speleji)\
**Post date:** [September 12, 2024, 2:27pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/12 "2024-09-12T14:27:22Z")

</div>

Hi guys my name is safari  
i need to learn about HTML ,CSS and JavaScript

---

<div class="post-metadata">

**Author:** ![Mikron](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/mikron/32/18634_2.png) [@Mikron](https://devforum.zoom.us/u/Mikron)\
**Post date:** [September 19, 2024, 6:23pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/13 "2024-09-19T18:23:58Z")

</div>

Hi @Robert.Wallis, I’ve tried to display the same for 2 hours already… still not seeing the .webm file (local file nor a hosted one) Just seeing the red square.

Can you provide a working sample with a remotely hosted video file (even a short one)  
Thanks

---

<div class="post-metadata">

**Author:** ![Mikron](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/mikron/32/18634_2.png) [@Mikron](https://devforum.zoom.us/u/Mikron)\
**Post date:** [September 22, 2024, 12:17pm UTC](https://devforum.zoom.us/t/playing-html-video-element-in-layers-api-in-camera-mode-webview/94777/14 "2024-09-22T12:17:33Z")

</div>

Hi Micah, do you maybe have a working code which I can look into? I tried to add a video to CameraMode.js and even though I use webm, I can’t see it.

Thanks
