Class: VideoSource
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:49
A texture source that uses a video as its resource. It automatically resizes the texture based on the video dimensions. It also provides methods to control playback and handle video events. This class supports automatic loading, playback, and frame updates. It can also handle cross-origin videos and provides options for looping, muting, and inline playback.
Advanced
Extends
Constructors
Constructor
> new VideoSource(options): VideoSource
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:85
Parameters
options
Returns
VideoSource
Overrides
Properties
_batchTick
> protected _batchTick: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:203
Used by the batcher to build texture batches. faster to have the variable here!
Inherited from
_gcData?
> optional _gcData?: GCData
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:105
GC tracking data, undefined if not being tracked
Inherited from
_gcLastUsed
> _gcLastUsed: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:107
Internal
Inherited from
_gpuData
> _gpuData: Record<number, GlTexture | GPUTextureGpuData>
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:103
Internal
Inherited from
_resolution
> _resolution: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:132
Internal
Inherited from
_resourceId
> _resourceId: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:123
Internal
i unique resource id, used by the bind group systems. This can change if the texture is resized or its resource changes
Inherited from
_resourceType
> readonly _resourceType: "textureSource" = "textureSource"
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:117
Internal
The resource type used by this TextureSource. This is used by the bind groups to determine how to handle this resource.
Inherited from
_textureBindLocation
> protected _textureBindLocation: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:208
A temporary batch location for the texture batching. Here for performance reasons only!
Inherited from
TextureSource._textureBindLocation
_touched
> protected _touched: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:198
Used by automatic texture Garbage Collection, stores last GC tick when it was bound
Inherited from
alphaMode
> alphaMode: ALPHA_MODES
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:181
the alpha mode of the texture
Inherited from
antialias
> antialias: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:188
Only really affects RenderTextures. Should we use antialiasing for this texture. It will look better, but may impact performance as a Blit operation will be required to resolve the texture.
Inherited from
arrayLayerCount
> arrayLayerCount: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:179
how many array layers this texture has (WebGPU depthOrArrayLayers)
Inherited from
autoGarbageCollect
> autoGarbageCollect: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:211
If true, the Garbage Collector will unload this texture if it is not used after a period of time
Inherited from
TextureSource.autoGarbageCollect
autoGenerateMipmaps
> autoGenerateMipmaps: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:171
Should we auto generate mipmaps for this texture? This will automatically generate mipmaps for this texture when uploading to the GPU. Mipmapped textures take up more memory, but can look better when scaled down.
For performance reasons, it is recommended to NOT use this with RenderTextures, as they are often updated every frame.
If you do, make sure to call updateMipmaps after you update the texture.
Inherited from
TextureSource.autoGenerateMipmaps
autoPlay
> protected autoPlay: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:62
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
true
destroyed
> readonly destroyed: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:193
Has the source been destroyed?
Inherited from
dimension
> dimension: TEXTURE_DIMENSIONS
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:175
how many dimensions does this texture have? currently v8 only supports 2d
Inherited from
format
> format: TEXTURE_FORMATS
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:173
the format that the texture data has
Inherited from
height
> height: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:146
the height of this texture source, accounting for resolution eg pixelHeight 200, resolution 2, then height will be 100
Inherited from
isPowerOfTwo
> isPowerOfTwo: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:209
Inherited from
isReady
> isReady: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:54
Whether or not the video is ready to play.
label
> label: string
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:111
optional label, can be used for debugging
Inherited from
mipLevelCount
> mipLevelCount: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:162
The number of mip levels to generate for this texture. this is overridden if autoGenerateMipmaps is true. it is read only!
Inherited from
options
> protected readonly options: TextureSourceOptions<HTMLVideoElement>
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:99
Inherited from
pixelHeight
> pixelHeight: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:136
the pixel height of this texture source. This is the REAL pure number, not accounting resolution
Inherited from
pixelWidth
> pixelWidth: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:134
the pixel width of this texture source. This is the REAL pure number, not accounting resolution
Inherited from
resource
> resource: HTMLVideoElement
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:151
the resource that will be uploaded to the GPU. This is where we get our pixels from eg an ImageBimt / Canvas / Video etc
Inherited from
sampleCount
> sampleCount: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:157
Internal
The number of samples of a multisample texture. This is always 1 for non-multisample textures. To enable multisample for a texture, set antialias to true
Inherited from
uid
> readonly uid: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:109
unique id for this Texture source
Inherited from
uploadMethodId
> uploadMethodId: string
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:56
The upload method for this texture.
Overrides
viewDimension
> viewDimension: TEXTURE_VIEW_DIMENSIONS
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:177
how this texture is viewed/sampled by shaders (WebGPU view dimension)
Inherited from
width
> width: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:141
the width of this texture source, accounting for resolution eg pixelWidth 200, resolution 2, then width will be 100
Inherited from
defaultOptions
> static defaultOptions: VideoSourceOptions
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:52
The default options for video sources.
Overrides
extension
> static extension: ExtensionMetadata
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:50
from
> static from: (resource) => TextureSource
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:307
A helper function that creates a new TextureSource based on the resource you provide.
Parameters
resource
The resource to create the texture source from.
Returns
Inherited from
MIME_TYPES
> readonly static MIME_TYPES: Dict<string>
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:156
Map of video MIME types that can't be directly derived from file extensions.
prefixed
> static prefixed: string | boolean
Defined in: node_modules/eventemitter3/index.d.ts:9
Inherited from
Accessors
addressMode
Get Signature
> get addressMode(): WRAP_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:230
setting this will set wrapModeU, wrapModeV and wrapModeW all at once!
Returns
Set Signature
> set addressMode(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:231
Parameters
value
Returns
void
Inherited from
autoUpdate
Get Signature
> get autoUpdate(): boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:130
Should the base texture automatically update itself, set to true by default.
Returns
boolean
Set Signature
> set autoUpdate(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:131
Parameters
value
boolean
Returns
void
isValid
Get Signature
> get isValid(): boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:94
Checks if the resource has valid dimensions.
Returns
boolean
True if width and height are set, otherwise false.
lodMaxClamp
Get Signature
> get lodMaxClamp(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:248
Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.
Returns
number
Set Signature
> set lodMaxClamp(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:249
Parameters
value
number
Returns
void
Inherited from
lodMinClamp
Get Signature
> get lodMinClamp(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:245
Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.
Returns
number
Set Signature
> set lodMinClamp(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:246
Parameters
value
number
Returns
void
Inherited from
magFilter
Get Signature
> get magFilter(): SCALE_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:236
Specifies the sampling behavior when the sample footprint is smaller than or equal to one texel.
Returns
Set Signature
> set magFilter(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:237
Parameters
value
Returns
void
Inherited from
maxAnisotropy
Get Signature
> get maxAnisotropy(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:228
Returns
number
Set Signature
> set maxAnisotropy(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:227
Specifies the maximum anisotropy value clamp used by the sampler.
Parameters
value
number
Returns
void
Inherited from
minFilter
Get Signature
> get minFilter(): SCALE_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:239
Specifies the sampling behavior when the sample footprint is larger than one texel.
Returns
Set Signature
> set minFilter(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:240
Parameters
value
Returns
void
Inherited from
mipmapFilter
Get Signature
> get mipmapFilter(): SCALE_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:242
Specifies behavior for sampling between mipmap levels.
Returns
Set Signature
> set mipmapFilter(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:243
Parameters
value
Returns
void
Inherited from
repeatMode
Get Signature
> get repeatMode(): WRAP_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:233
setting this will set wrapModeU, wrapModeV and wrapModeW all at once!
Returns
Set Signature
> set repeatMode(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:234
Parameters
value
Returns
void
Inherited from
resolution
Get Signature
> get resolution(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:271
the resolution of the texture. Changing this number, will not change the number of pixels in the actual texture but will the size of the texture when rendered.
changing the resolution of this texture to 2 for example will make it appear twice as small when rendered (as pixel density will have increased)
Returns
number
Set Signature
> set resolution(resolution): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:272
Parameters
resolution
number
Returns
void
Inherited from
resourceHeight
Get Signature
> get resourceHeight(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:263
the height of the resource. This is the REAL pure number, not accounting resolution
Returns
number
Inherited from
resourceWidth
Get Signature
> get resourceWidth(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:261
the width of the resource. This is the REAL pure number, not accounting resolution
Returns
number
Inherited from
scaleMode
Get Signature
> get scaleMode(): SCALE_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:296
setting this will set magFilter,minFilter and mipmapFilter all at once!
Returns
Set Signature
> set scaleMode(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:294
Parameters
value
Returns
void
Inherited from
source
Get Signature
> get source(): TextureSource
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:222
returns itself
Returns
Inherited from
style
Get Signature
> get style(): TextureStyle
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:224
the style of the texture
Returns
Set Signature
> set style(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:225
Parameters
value
Returns
void
Inherited from
updateFPS
Get Signature
> get updateFPS(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:137
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.
Returns
number
Set Signature
> set updateFPS(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:138
Parameters
value
number
Returns
void
wrapMode
Get Signature
> get wrapMode(): WRAP_MODE
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:293
Returns
Set Signature
> set wrapMode(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:292
Parameters
value
Returns
void
Inherited from
Methods
addListener()
> addListener<T>(event, fn, context?): this
Defined in: node_modules/eventemitter3/index.d.ts:45
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
fn
(...args) => void
context?
any
Returns
this
Inherited from
TextureSource.addListener
destroy()
> destroy(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:128
Cleans up resources and event listeners associated with this texture.
Returns
void
Overrides
emit()
> emit<T>(event, ...args): boolean
Defined in: node_modules/eventemitter3/index.d.ts:32
Calls each of the listeners registered for a given event.
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
args
...ArgumentMap<{ change: BindResource; destroy: TextureSource; error: Error; resize: TextureSource; styleChange: TextureSource; unload: TextureSource; update: TextureSource; updateMipmaps: TextureSource; }>[Extract<T, "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps">]
Returns
boolean
Inherited from
TextureSource.emit
eventNames()
> eventNames(): ("error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps")[]
Defined in: node_modules/eventemitter3/index.d.ts:15
Return an array listing the events for which the emitter has registered listeners.
Returns
("error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps")[]
Inherited from
TextureSource.eventNames
listenerCount()
> listenerCount(event): number
Defined in: node_modules/eventemitter3/index.d.ts:27
Return the number of listeners listening to a given event.
Parameters
event
"error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Returns
number
Inherited from
TextureSource.listenerCount
listeners()
> listeners<T>(event): (...args) => void[]
Defined in: node_modules/eventemitter3/index.d.ts:20
Return the listeners registered for a given event.
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
Returns
(...args) => void[]
Inherited from
TextureSource.listeners
load()
> load(): Promise<VideoSource>
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:99
Start preloading the video resource.
Returns
Promise<VideoSource>
Handle the validate event
off()
> off<T>(event, fn?, context?, once?): this
Defined in: node_modules/eventemitter3/index.d.ts:69
todo
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
fn?
(...args) => void
context?
any
once?
boolean
Returns
this
Inherited from
TextureSource.off
on()
> on<T>(event, fn, context?): this
Defined in: node_modules/eventemitter3/index.d.ts:40
Add a listener for a given event.
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
fn
(...args) => void
context?
any
Returns
this
Inherited from
TextureSource.on
once()
> once<T>(event, fn, context?): this
Defined in: node_modules/eventemitter3/index.d.ts:54
Add a one-time listener for a given event.
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
fn
(...args) => void
context?
any
Returns
this
Inherited from
TextureSource.once
removeAllListeners()
> removeAllListeners(event?): this
Defined in: node_modules/eventemitter3/index.d.ts:79
Remove all listeners, or those of the specified event.
Parameters
event?
"error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Returns
this
Inherited from
TextureSource.removeAllListeners
removeListener()
> removeListener<T>(event, fn?, context?, once?): this
Defined in: node_modules/eventemitter3/index.d.ts:63
Remove the listeners of a given event.
Type Parameters
T
T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"
Parameters
event
T
fn?
(...args) => void
context?
any
once?
boolean
Returns
this
Inherited from
TextureSource.removeListener
resize()
> resize(width?, height?, resolution?): boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:280
Resize the texture, this is handy if you want to use the texture as a render texture
Parameters
width?
number
the new width of the texture
height?
number
the new height of the texture
resolution?
number
the new resolution of the texture
Returns
boolean
- if the texture was resized
Inherited from
unload()
> unload(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:259
This will unload the Texture source from the GPU. This will free up the GPU memory As soon as it is required fore rendering, it will be re-uploaded.
Returns
void
Inherited from
update()
> update(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:252
call this if you have modified the texture outside of the constructor
Returns
void
Inherited from
updateFrame()
> protected updateFrame(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:87
Update the video frame if the source is not destroyed and meets certain conditions.
Returns
void
updateMipmaps()
> updateMipmaps(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:291
Lets the renderer know that this texture has been updated and its mipmaps should be re-generated. This is only important for RenderTexture instances, as standard Texture instances will have their mipmaps generated on upload. You should call this method after you make any change to the texture
The reason for this is is can be quite expensive to update mipmaps for a texture. So by default, We want you, the developer to specify when this action should happen.
Generally you don't want to have mipmaps generated on Render targets that are changed every frame,
Returns
void
Inherited from
test()
> static test(resource): resource is HTMLVideoElement
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.d.ts:157
Parameters
resource
any
Returns
resource is HTMLVideoElement