# Function: addVideo() (/jsdoc/pixi-vn/index/functions/addVideo)



\> **addVideo**(`alias`, `videoUrl?`, `options?`): [`VideoSprite`](/jsdoc/pixi-vn/index/classes/VideoSprite)

Defined in: [src/canvas/functions/video-utility.ts:25](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/functions/video-utility.ts#L25)

Add a video in the canvas.
Is the same that [showVideo](/jsdoc/pixi-vn/index/functions/showVideo), but the video is not shown.
If you want to show the video, then you need to use the function [()](/jsdoc/pixi-vn/index/classes/VideoSprite#load).

Parameters [#parameters]

alias [#alias]

`string`

is the unique alias of the video. You can use this alias to refer to this video

videoUrl? [#videourl]

`string`

is the url of the video. If you don't provide the url, then the alias is used as the url.

options? [#options]

[`VideoSpriteOptions`](/jsdoc/pixi-vn/index/interfaces/VideoSpriteOptions)

The options of the video.

Returns [#returns]

[`VideoSprite`](/jsdoc/pixi-vn/index/classes/VideoSprite)

the container of the video.

Throws [#throws]

when `videoUrl` is not provided and `alias` is not registered in the asset cache.

Example [#example]

```typescript
let video1 = addVideo("video1", "https://pixijs.com/assets/video1.mp4")
await video1.load()
Assets.add({ alias: "video2", src: "https://pixijs.com/assets/video2.png" })
let video2 = addVideo("video2")
await video2.load()
```
