Class: VideoResource

PIXI.VideoResource

Resource type for HTMLVideoElement.

new PIXI.VideoResource (source, options) overrides

Name Type Attributes Default Description
source HTMLVideoElement | object | string | Array<string | object> <optional>

Video element to use.

options object <optional>

Options to use

options.autoLoad boolean <optional>
true

Start loading the video immediately

options.autoPlay boolean <optional>
true

Start playing video immediately

options.updateFPS number <optional>
0

How many times a second to update the texture from the video. Leave at 0 to update at every render.

options.crossorigin boolean <optional>
true

Load image using cross origin

Extends

Members

PIXI.VideoResource.MIME_TYPES Dict<string> staticreadonly

Map of video MIME types that can't be directly derived from file extensions.

PIXI.VideoResource.TYPES Array<string> staticreadonly

List of common video file extensions supported by VideoResource.

autoUpdate boolean

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

source HTMLVideoElement overrides

Override the source to be the video element.

updateFPS number

How many times a second to update the texture from the video. Leave at 0 to update at every render. A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.

_autoUpdate boolean protected

true to use PIXI.Ticker.shared to auto update the base texture.

Default Value:
  • true

_isConnectedToTicker boolean protected

true if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.

Default Value:
  • false

autoPlay boolean protected

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

Methods

PIXI.VideoResource.test (source, extension) boolean static

Used to auto-detect the type of resource.

Name Type Attributes Description
source unknown

The source object

extension string <optional>

The extension of source, if set

Returns:
Type Description
boolean true if video source

Destroys this texture.

load () Promise<void> overrides

Start preloading the video resource.

Returns:
Type Description
Promise<void> Handle the validate event

update (_deltaTime) void overrides

Trigger updating of the texture.

Name Type Default Description
_deltaTime number 0

time delta since last tick

Inherited Properties

From class PIXI.Resource

destroyed boolean readonly inherited

If resource has been destroyed.

Default Value:
  • false

height number readonly inherited

The height of the resource.

internal boolean inherited

true if resource is created by BaseTexture useful for doing cleanup with BaseTexture destroy and not cleaning up resources that were created externally.

src string inherited

The url of the resource

valid boolean readonly inherited

Has been validated

width number readonly inherited

The width of the resource.

_height number protected inherited

Internal height of the resource.

_width number protected inherited

Internal width of the resource.

Inherited Methods

From class PIXI.BaseImageResource

upload (renderer, baseTexture, glTexture, source) boolean inherited

Upload the texture to the GPU.

Name Type Attributes Description
renderer PIXI.Renderer

Upload to the renderer

baseTexture PIXI.BaseTexture

Reference to parent texture

glTexture PIXI.GLTexture
source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement <optional>

(optional)

Returns:
Type Description
boolean
  • true is success

From class PIXI.Resource

bind (baseTexture) void inherited

Bind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

destroy () void inherited

Call when destroying resource, unbind any BaseTexture object before calling this method, as reference counts are maintained internally.

resize (width, height) void inherited

Trigger a resize event

Name Type Description
width number

X dimension

height number

Y dimension

style (_renderer, _baseTexture, _glTexture) boolean inherited

Set the style, optional to override

Name Type Description
_renderer PIXI.Renderer

yeah, renderer!

_baseTexture PIXI.BaseTexture

the texture

_glTexture PIXI.GLTexture

texture instance for this webgl context

Returns:
Type Description
boolean
  • true is success

unbind (baseTexture) void inherited

Unbind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture