LogoPixi’VN
indexFunctions

Function: addVideo()

> addVideo(alias, videoUrl?, options?): VideoSprite

Defined in: src/canvas/functions/video-utility.ts:25

Add a video in the canvas. Is the same that showVideo, but the video is not shown. If you want to show the video, then you need to use the function ().

Parameters

alias

string

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

videoUrl?

string

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

options?

VideoSpriteOptions

The options of the video.

Returns

VideoSprite

the container of the video.

Throws

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

Example

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