three.js: VideoTexture crashes after changing the video element src in chrome in r119 and r120

Describe the bug In r119 and r120, VideoTexture is crashing the site with an ‘aw snap! something went wrong’ when I change the video element’s src. This worked fine for me in previous releases and it still seems to work in firefox but it’s crashing in chrome. I’ve been able to reproduce this with the codepen below.

Code

var video = document.getElementById( 'video' );
var vidTexture = new THREE.VideoTexture( video );
vidTexture.minFilter = THREE.LinearFilter;
vidTexture.magFilter = THREE.LinearFilter;
vidTexture.format = THREE.RGBFormat;

var startButton = document.getElementById( 'startButton' );

var urlOne = 'http://learn.shayhowe.com/assets/misc/courses/html-css/adding-media/earth.mp4'
var urlTwo = 'https://vjs.zencdn.net/v/oceans.mp4'
var toggle = false
startButton.addEventListener( 'click', function () {
    
    toggle = !toggle
    video.src = toggle ? urlOne : urlTwo;

    video.play();
    startButton.innerHTML = 'keep pressing a bunch of times and it crashes in chrome Version 85.0.4183.121 in THREE r119 & r120'

}, false );

Live example https://codepen.io/laserberg/pen/wvGRdxr

Expected behavior If I switch to THREE r118 it seems to work fine, the VideoTexture updates and the site doesn’t crash.

Screenshots oh sanp

Platform:

  • Device: Desktop
  • OS: MacOS
  • Browser: Chrome Version 85.0.4183.121
  • Three.js version: r119^

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Unfortunately, this didn’t make the cut for a merge to M88, since it’s so close to stable cut. The first stable release that will have this fix remains M89.

I think this issue is fixed on Canary, as of today, thanks to patch from the Edge team.

https://bugs.chromium.org/p/chromium/issues/detail?id=1158160

I will hopefully get it merged into M88.

If you get a crash ID and open a bug at crbug.com, I can take a look at it from the video.rVFC POV.

Otherwise, I’ll try out the repro case when I have a chance.

@Mugen87 sorry I haven’t had a chance to test that yet. I’ve been on a deadline so I just reverted to last version that worked for me. I understand why you’re asking though, I will as soon as I can

@larsberg Have you already tested?

BTW: Does it happen on your system if you use a VideoTexture per video? This will require that you also swap the video textures of your box.