# Play video in the background

**URL:** <https://phaser.discourse.group/t/play-video-in-the-background/8220>\
**Category:** Phaser 3\
**Created:** [November 25, 2020, 5:19pm UTC](https://phaser.discourse.group/t/play-video-in-the-background/8220 "2020-11-25T17:19:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![XXXiV-QN](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/xxxiv-qn/32/4410_2.png) [@XXXiV-QN](https://phaser.discourse.group/u/XXXiV-QN)\
**Post date:** [November 25, 2020, 5:19pm UTC](https://phaser.discourse.group/t/play-video-in-the-background/8220/1 "2020-11-25T17:19:06Z")

</div>

I borrowed this code from Phaser lab for playing video.

```
var video = document.createElement('video');
video.playsinline = true;
video.src = './assets/ocean.mp4';
video.width = 800;
video.height = 450;
video.autoplay = true;
var element = this.add.dom(400, 300, video);

```

However, it keeps returning “this.add.dom” is not a function.  
(I added dom:{createContainer: true} to my config, didn’t fix the problem)

Any suggestions?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [November 25, 2020, 5:38pm UTC](https://phaser.discourse.group/t/play-video-in-the-background/8220/2 "2020-11-25T17:38:58Z")

</div>

Which Phaser version are you using? Maybe it’s an old one.

You can use a [video game object](https://www.phaser.io/examples/v3/category/game-objects/video) directly.
