regl-project / regl

👑 Functional WebGL
https://regl-project.github.io/
MIT License
5.21k stars 322 forks source link

Video texture example shows black screen #658

Open CarstenHoyer opened 1 year ago

CarstenHoyer commented 1 year ago

Hi

Video example shows balck screen: https://regl-project.github.io/regl/www/gallery/video.js.html

I looked at #469, and it seems like the fix is not working anymore. At least for me in Safari 15 and Chrome 105 I am seeing a black screen.

Autoplay without sound gives me a video that plays, but it doesn't seem to go into the sampler2D.

Shortened example:


const frag = glsl(`
  precision highp float;

  uniform float time;
  uniform sampler2D video;

  varying vec2 vUv;

  void main () {
    vec4 t = texture2D(video, vUv);
    vec3 color = 0.5 + 0.5 * cos(time + vUv.xyx + vec3(0.0, 2.0, 4.0));
    gl_FragColor = vec4(color, 1.0);
  }
`);

createShader({
    gl,
    frag,
    uniforms: {
      video: regl.texture(video).subimage(video),
      time: ({ time }) => time
    }
  });
}
CarstenHoyer commented 1 year ago

Chrome gives this error: Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

CarstenHoyer commented 1 year ago

Safari gives this error today: resl error: – "error loading asset \"video\""

But I got a black screen in Safari yesterday

CarstenHoyer commented 1 year ago

Tried loading an mp4 file in the example, and it worked without problems