PIXI.VideoResource
class VideoResource extends PIXI.BaseImageResource
Resource type for HTMLVideoElement.
Constructor
new PIXI.VideoResource(source: HTMLVideoElement | object | string | Array<string | object>, options: object) → {}
| 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> |
|
| Array<string> |
|
| boolean |
Should the base texture automatically update itself, set to true by default. |
| HTMLVideoElement |
Override the source to be the video element. |
| number |
|
| boolean |
|
| boolean |
|
| boolean |
|
Methods from VideoResource
| boolean |
|
| void |
Destroys this texture. |
| Promise<void> |
|
| void |
|
Properties inherited from Resource
| boolean |
|
| number |
|
| boolean |
|
| string |
The url of the resource |
| boolean |
|
| number |
|
| number |
Internal height of the resource. |
| number |
Internal width of the resource. |
Methods inherited from BaseImageResource
| boolean |
|
Methods inherited from Resource
| void |
|
| void |
|
| void |
|
| boolean |
|
| void |
|
Public Properties
static MIME_TYPES: Dict<string>
Map of video MIME types that can't be directly derived from file extensions.
static TYPES: Array<string>
List of common video file extensions supported by VideoResource.
autoUpdate: boolean
Should the base texture automatically update itself, set to true by default.
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
protected _autoUpdate: boolean = true
true to use PIXI.Ticker.shared to auto update the base texture.
protected _isConnectedToTicker: boolean = false
true if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.
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
static test(source: unknown, extension: string) → {boolean}
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 |
| Type | Description |
|---|---|
| boolean |
|
dispose() → {void}
Destroys this texture.
| Type | Description |
|---|---|
| void |
load() → {Promise<void>}
Start preloading the video resource.
| Type | Description |
|---|---|
| Promise<void> |
Handle the validate event |
update(_deltaTime: number) → {void}
Trigger updating of the texture.
| Name | Type | Default | Description |
|---|---|---|---|
| _deltaTime | number | 0 |
time delta since last tick |
| Type | Description |
|---|---|
| void |