Capítulo 239 de 859

Chapter 239: VideoFrameTexture

Core Idea

This class can be used as an alternative way to define video data. Instead of using an instance of HTMLVideoElement like with VideoTexture, VideoFrameTexture expects each frame is defined manually via VideoFrameTexture#setFrame. A typical use case for this module is when video frames are decoded with the WebCodecs API.

Key Concepts

  • isVideoFrameTexture : boolean (readonly): This flag can be used for type testing.

Code Examples

const texture = new THREE.VideoFrameTexture();
texture.setFrame( frame );
  • What it demonstrates: Typical usage of VideoFrameTexture.

Reference Tables

Constructor

Signature
new VideoFrameTexture( mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number )

Properties

PropertyDescription
.isVideoFrameTexture : boolean (readonly)This flag can be used for type testing.

Methods

MethodDescription
.setFrame( frame : VideoFrame )Sets the current frame of the video. This will automatically update the texture so the data can be used for rendering.
.update()This method overwritten with an empty implementation since this type of texture is updated via setFrame().

Key Takeaways

  1. VideoFrameTexture extends: EventDispatcher → Texture → VideoTexture
  2. Most relevant properties: isVideoFrameTexture.
  3. Key methods: setFrame, update.

Connects To