diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b8155e9c25..30ea8d3198 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,6 +1,7 @@ name: X3DOM CI on: + workflow_dispatch: pull_request: branches: - master diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f9a7d432a..25218b8658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Version 1.8.3-dev * Bugfixes + * MovieTexture: autostart, ios and removal * support url field change for AudioClip * better indices for textured IFS with creases * ensure correct children order after ExternProto instancing diff --git a/src/Texture.js b/src/Texture.js index e522b3ddc5..ab5bc8c287 100755 --- a/src/Texture.js +++ b/src/Texture.js @@ -428,9 +428,15 @@ x3dom.Texture.prototype.updateTexture = function () tex._video = document.createElement( "video" ); tex._video.setAttribute( "preload", "auto" ); tex._video.setAttribute( "muted", "muted" ); - p.appendChild( tex._video ); - tex._video.style.visibility = "hidden"; - tex._video.style.display = "none"; + tex._video.setAttribute( "autoplay", "" ); + tex._video.setAttribute( "playsinline", "" ); + tex._video.crossOrigin = "anonymous"; + tex._video.retryInterval = 1000; + tex._video.retryGrowth = 0.2; + // p.appendChild( tex._video ); + // tex._video.style.visibility = "hidden"; + // tex._video.style.display = "none"; + tex._video.load(); } for ( var i = 0; i < tex._vf.url.length; i++ ) @@ -458,7 +464,17 @@ x3dom.Texture.prototype.updateTexture = function () var startVideo = function () { - tex._video.play(); + tex._video.play() + .then( function fulfilled () + { + tex._intervalID = setInterval( updateMovie, 16 ); + } ) + .catch( function rejected ( err ) + { + x3dom.debug.logInfo( "retrying: " + err ); + setTimeout( startVideo, tex._video.retryInterval ); + tex._video.retryInterval *= 1.0 + tex._video.retryGrowth; + } ); tex._intervalID = setInterval( updateMovie, 16 ); }; diff --git a/src/nodes/Texturing/Texture.js b/src/nodes/Texturing/Texture.js index 878d40b126..50f26d2bb1 100644 --- a/src/nodes/Texturing/Texture.js +++ b/src/nodes/Texturing/Texture.js @@ -109,8 +109,9 @@ x3dom.registerNodeType( { this._video.removeChild( this._video.firstChild ); } - document.body.removeChild( this._video ); + //document.body.removeChild( this._video ); this._video = null; + clearInterval( this._intervalID ); } } } diff --git a/test/regression-suite/test/cases/movieTexture/movietexture.html b/test/regression-suite/test/cases/movieTexture/movietexture.html new file mode 100644 index 0000000000..008040d8ac --- /dev/null +++ b/test/regression-suite/test/cases/movieTexture/movietexture.html @@ -0,0 +1,23 @@ + + + + + + + +

+ videos as texture +

+ + + + + + + + + + +Lava Hijzelaar (Lava Art), CC BY 3.0, via Wikimedia Commons + +