videoTexture does not appear on iPhone (iOs)

I have a video texture that doesn’t appear or play when activated on an iPhone and it gives off this WebGL error

(anonymous)	@	sse-hooks.f742b80f43…19b0d97b5886cd.js:2
texImage2D	@	three.module.js:21276
uploadTexture	@	three.module.js:22207
setTexture2D	@	three.module.js:21734
safeSetTexture2D	@	three.module.js:22627
setValueT1	@	three.module.js:17147
(anonymous)	@	three.module.js:17651
setProgram	@	three.module.js:26039
(anonymous)	@	three.module.js:24882
renderObject	@	three.module.js:25631
renderObjects	@	three.module.js:25601
(anonymous)	@	three.module.js:25398
render	@	app.js:376
  function render() {
    let deltaTime = clock.getDelta();
    if (resizeRendererToDisplaySize(renderer)) {
      const canvas = renderer.domElement; = "black";
      camera.aspect = canvas.clientWidth / canvas.clientHeight;

    water.position.z += movementSpeed * deltaTime;
    modelLoader.frontFoam_L ? animateFrontFoam(deltaTime) : null;
    modelLoader.frontFoam_R ? animateFrontFoam(deltaTime) : null;
    modelLoader.FoamAnimMat.needsUpdate = true;


    renderer.render(scene, camera);
// this is line 376
    renderer.clearDepth(); // important! clear the depth buffer

    //renderer.render(scene2, camera);

    modelLoader.modelAnimationMixers.forEach((_mixer) => {


I followed this example on threejs and it still does not work.

Below I’ll be comparing my code to the one on github.

It states that I need a startButton variable which has an eventlistener

			const startButton = document.getElementById( 'startButton' );
			startButton.addEventListener( 'click', function () {


			} );

This is between line 71 - 77

This is my code

$("#launch").click(function () {


I call the render function inside of main.start function and it looks like this

  function onWindowResize() {
    camera.aspect = window.innerWidth / window.innerHeight;

    renderer.setSize(window.innerWidth, window.innerHeight);


Next up it tells me I need to fetch the video from a html tag, play it, add an eventlistener to it and assign it to a texture that then gets assigned to an object material. Like so:

				video = document.getElementById( 'video' );;
				video.addEventListener( 'play', function () {

					this.currentTime = 3;

				} );

				texture = new THREE.VideoTexture( video );

				const parameters = { color: 0xffffff, map: texture };

This is what I have done

let video = document.getElementById("video"); // link video HMTL element to JS;
video.addEventListener( 'play', function () {

  this.currentTime = 3;

} );

let videoTexture = new THREE.VideoTexture(video); // create texture for video

export let FoamAnimMat = new THREE.MeshBasicMaterial({
  alphaMap: videoTexture,
  alphaTest: 0.45,
  side: THREE.DoubleSide,
  fog: false

This is my HTML tag

      style="display: none;"
        type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'

This is what I get

This is what appears in the browser(windows/mac)

Why isn’t it working?

I forked the threejs example and re-built it in codesandbox because I wanted to see if it my video file was corrupt or if the code didn’t work as intended. You can test it here

It didn’t work. But when I visit the same example on the examples page it works. Is sandbox as a platform the problem or I am still missing something?

Solved it. Seems to be a codesandbox issue. I set up a nodejs project and hosted it on heroku. The hosted version works on mobile devices ( and it is exactly the same.
I suspect some kind of CORS-error that does not get displayed or something. Because something blocks the video from correctly loading (as you can’t see any images, but the sound plays) and that issue resides within the code editor.