Class: VideoBaseTexture

PIXI. VideoBaseTexture

A texture of a [playing] Video.

Video base textures mimic Pixi BaseTexture.from.... method in their creation process.

This can be used in several ways, such as:

let texture = PIXI.VideoBaseTexture.fromUrl('http://mydomain.com/video.mp4');

let texture = PIXI.VideoBaseTexture.fromUrl({ src: 'http://mydomain.com/video.mp4', mime: 'video/mp4' });

let texture = PIXI.VideoBaseTexture.fromUrls(['/video.webm', '/video.mp4']);

let texture = PIXI.VideoBaseTexture.fromUrls([
    { src: '/video.webm', mime: 'video/webm' },
    { src: '/video.mp4', mime: 'video/mp4' }
]);

See the "deus" demo.

new PIXI.VideoBaseTexture(source, scaleMode)

Name Type Default Description
source HTMLVideoElement

Video source

scaleMode number PIXI.settings.SCALE_MODE optional

See PIXI.SCALE_MODES for possible values

Extends

Members

autoPlayboolean

When set to true will automatically play videos used by this texture once they are loaded. If false, it will not modify the playing state.

Default Value:
  • true

autoUpdateboolean

Should the base texture automatically update itself, set to true by default

Methods

staticPIXI.VideoBaseTexture.fromUrl(videoSrc, scaleMode){PIXI.VideoBaseTexture}

Helper function that creates a new BaseTexture based on the given video element. This BaseTexture can then be used to create a texture

Name Type Description
videoSrc string | object | Array.<string> | Array.<object>

The URL(s) for the video.

Name Type Description
src string optional

One of the source urls for the video

mime string optional

The mimetype of the video (e.g. 'video/mp4'). If not specified the url's extension will be used as the second part of the mime type.

scaleMode number

See PIXI.SCALE_MODES for possible values

Returns:
Type Description
PIXI.VideoBaseTexture Newly created VideoBaseTexture

staticPIXI.VideoBaseTexture.fromVideo(video, scaleMode){PIXI.VideoBaseTexture}

Mimic Pixi BaseTexture.from.... method.

Name Type Default Description
video HTMLVideoElement

Video to create texture from

scaleMode number PIXI.settings.SCALE_MODE optional

See PIXI.SCALE_MODES for possible values

Returns:
Type Description
PIXI.VideoBaseTexture Newly created VideoBaseTexture

Destroys this texture

Events

Fired when BaseTexture is destroyed.

Name Type Description
baseTexture PIXI.BaseTexture

Instance of texture being destroyed.

Fired when a not-immediately-available source fails to load.

Name Type Description
baseTexture PIXI.BaseTexture

Resource errored.

Fired when a not-immediately-available source finishes loading.

Name Type Description
baseTexture PIXI.BaseTexture

Resource loaded.

Fired when BaseTexture is updated.

Name Type Description
baseTexture PIXI.BaseTexture

Instance of texture being updated.