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^

Author: Fantashit

4 thoughts on “VideoTexture crashes after changing the video element src in chrome in r119 and r120

  1. @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

  2. 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.

  3. 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.

Comments are closed.