PIXI.VideoResource

class VideoResource extends PIXI.BaseImageResource

Resource type for HTMLVideoElement.

Constructor


new PIXI.VideoResource(source: HTMLVideoElement | object | string | Array<string | object>, options: object) → {}
Parameters:
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

Summary


Properties from VideoResource

Dict<string>
static MIME_TYPES
Array<string>
static TYPES
boolean
autoUpdate

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

HTMLVideoElement
source

Override the source to be the video element.

number
updateFPS
boolean
protected _autoUpdate = true
boolean
protected _isConnectedToTicker = false
boolean
protected autoPlay = true

Methods from VideoResource

boolean
static test(source: unknown, extension: string)
void
dispose()

Destroys this texture.

Promise<void>
load()
void
update(_deltaTime: number)

Properties inherited from Resource

boolean
destroyed = false
number
height
boolean
internal
string
src

The url of the resource

boolean
valid
number
width
number
protected _height

Internal height of the resource.

number
protected _width

Internal width of the resource.

Methods inherited from BaseImageResource

boolean
upload(renderer: PIXI.Renderer, baseTexture: PIXI.BaseTexture, glTexture: PIXI.GLTexture, source: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement)

Public Properties


MIME_TYPES VideoResource.ts:378
static MIME_TYPES: Dict<string>

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

TYPES VideoResource.ts:372
static TYPES: Array<string>

List of common video file extensions supported by VideoResource.

autoUpdate VideoResource.ts:318
autoUpdate: boolean

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

source VideoResource.ts:26
source: HTMLVideoElement

Override the source to be the video element.

updateFPS VideoResource.ts:343
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.

Protected Properties


_autoUpdate VideoResource.ts:29
protected _autoUpdate: boolean = true

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

_isConnectedToTicker VideoResource.ts:35
protected _isConnectedToTicker: boolean = false

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

autoPlay VideoResource.ts:43
protected autoPlay: boolean = true

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.

Public Methods


test VideoResource.ts:360
static test(source: unknown, extension: string) → {boolean}

Used to auto-detect the type of resource.

Parameters:
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

dispose VideoResource.ts:297
dispose() → {void}

Destroys this texture.

Returns:
Type Description
void
load VideoResource.ts:160
load() → {Promise<void>}

Start preloading the video resource.

Returns:
Type Description
Promise<void>

Handle the validate event

update VideoResource.ts:140
update(_deltaTime: number) → {void}

Trigger updating of the texture.

Parameters:
Name Type Default Description
_deltaTime number 0

time delta since last tick

Returns:
Type Description
void

Powered by webdoc!