# 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/4b8909bd13b1cc1fa7efb0238c44a5af3767e61f/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)

This function returns an [VideoSprite](/jsdoc/pixi-vn/index/classes/VideoSprite) that you can use to manipulate the component.

## Throws [#throws]

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

## Example [#example]

```ts
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()
```
