Pixi’VN
indexFunctions

Function: addVideo()

pixi-vn on GitHub

Call Signature

> addVideo(alias, options?): VideoSprite

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

Add a video in the canvas, using alias as the video alias. The video is not shown: use VideoSprite.load.

Parameters

alias

string

The unique alias of the component, also used as the alias of the asset (it must be registered in the asset cache or manifest).

options?

VideoSpriteOptions

The options of the video.

Returns

VideoSprite

This function returns an VideoSprite that you can use to manipulate the component.

Throws

when alias is not registered in the asset cache.

Example

Assets.add({ alias: "film", src: "https://pixijs.com/assets/video.mp4" });
const film = addVideo("film", { xAlign: 0.5 });
await film.load();

Call Signature

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

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

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

This function returns an VideoSprite that you can use to manipulate the component.

Throws

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

Example

Assets.add({ alias: "film", src: "https://pixijs.com/assets/video.mp4" });

// "film" is the alias of the component and of the asset
const film1 = addVideo("film");
await film1.load();
// a different alias for the component: (alias, assetAlias, options)
const film2 = addVideo("film2", "film", { xAlign: 1 });
await film2.load();

On this page