-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VideoTexture causes texture upload even when videos are paused #16946
Comments
If we support However, all these changes make the |
OK -- for those who do end up pausing the videos, the impact is significant -- particularly with vp8/9 encoded videos. Is the complexity concern here around performance? I believe it'd be possible to set up an event driven approach to capture state changes to the video to result in less branching if so. |
How would this look like? |
I was just referring to the fact that the media elements have events you can attach to be notified of pause/resume/etc, so (probably with a decent amount of incidental complexity) you could remove the net impact to the runtime of |
if having three.js manage a bunch of event handlers on video elements associated with video textures seem worth the benefits of reducing texture transfers for paused/ended videos then I'm happy to dig into it -- but not sure if that would pass muster. |
also part of the complexity here is that you want to draw the texture at least once after the video is paused or ends, because for videos that start out that way you end up never copying anything |
Since #19906 (which landed in |
For those getting here via Google... BUT I was pulling my hair out trying to figure out why I was having performance issues on Safari with many paused Unless Im mistaken (super possible, correct me!): |
Description of the problem
It looks like the
update
routine ofVideoTexture
setsthis.needsUpdate = true
even when a video is paused. This results in a continual texture transfer to or on the GPU even if the video is not changing.I quickly patched the function as such:
And performance significantly improved when videos were paused (particularly when viewing vp8 videos.) Previously, pausing them had no effect. I'm happy to open a PR if the approach above is reasonable.
Three.js version
r103
Browser
OS
The text was updated successfully, but these errors were encountered: