Consider re-implementing THREE.VideoTexture to use `tick` since each one creates its own RAF
Open
Nobody has claimed this yet.
help wanted (easy)
perf
video
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 4.4k
- PR merge metrics
- No merged PRs in 30d
Description
Description: We could reduce the number of requestAnimationFrame if we implement THREE.VideoTexture ourselves using tick. Here is the source of three.js VideoTexture
THREE.VideoTexture = function ( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
THREE.Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
this.generateMipmaps = false;
var scope = this;
function update() {
requestAnimationFrame( update );
if ( video.readyState === video.HAVE_ENOUGH_DATA ) {
scope.needsUpdate = true;
}
}
update();
};
THREE.VideoTexture.prototype = Object.create( THREE.Texture.prototype );
THREE.VideoTexture.prototype.constructor = THREE.VideoTexture;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the THREE.VideoTexture implementation and the existing tick mechanism, then compare them with the three.js source shown in the issue. Done means VideoTexture updates through the shared tick path instead of creating an individual requestAnimationFrame loop, while retaining its video-ready update behavior; no test file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100