Pixi’VN
indexFunctions

Function: showVideo()

pixi-vn on GitHub

Call Signature

> showVideo(alias, options?): Promise<VideoSprite>

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

Add and show a video in the canvas, using alias as the video alias.

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

Promise<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" });
await showVideo("film", { xAlign: 0.5 });

Call Signature

> showVideo(alias, videoUrl?, options?): Promise<VideoSprite>

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

Add and show a video in the canvas. This function is a combination of addVideo.

Parameters

alias

string

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

videoUrl?

string

The url of the video.

options?

VideoSpriteOptions

The options of the video.

Returns

Promise<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 = await showVideo("film");
// a different alias for the component: (alias, assetAlias, options)
const film2 = await showVideo("film2", "film", { xAlign: 1 });

On this page