I’m trying to get a video texture playing on iOS devices. But I keep just getting a black screen & no audio.
I’m not expecting it to autoplay. But I’m struggling to figure out what qualifies as ‘user interaction’.
The example here works fine on my iOS test device. Is there something specific about the example that made it work? For example, does the user interaction have to be a button specifically. Does that button have to be used to init and animate your whole app like the example? Why do apple want me to suffer.
<video id="video" loop crossOrigin="anonymous" playsinline style="display:none">
<source src="textures/whoops.ogv" type='video/ogg; codecs="theora, vorbis"'>
<source src="textures/whoops.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>
–
instructions.addEventListener( 'touchstart', function(evt){
video = document.getElementById( 'video' );
video.play();
video.addEventListener('play', function() {
this.currentTime = 3;
}, false);
texture = new THREE.VideoTexture( video );
var parameters = { color: 0xffffff, map: texture };
let videogeometry = new THREE.PlaneBufferGeometry(1280, 720);
let videomaterial = new THREE.MeshLambertMaterial ( parameters );
let videomesh = new THREE.Mesh( videogeometry, videomaterial );
scene.add(videomesh)
videomesh.scale.set(0.7,0.7,0.7);
videomesh.position.y = 500;
videomesh.position.z = -300;
});
For reference this is what I had to do to get device orientation permission working:
Device Orientation Permission
dcontrols = new DeviceOrientationControls ( camera );
dcontrols.disconnect();
instructions.addEventListener( 'touchend', function (evt) {
console.log ('touch test');
dcontrols.connect();
dcontrols.enabled = true;
instructions.style.display = 'none';
blocker.style.display = 'none';
Does anyone have recent experience with this?