Skip to content

Commit

Permalink
Merge branch 'x3dom:master' into x3dom#1220,x3dom#1221
Browse files Browse the repository at this point in the history
  • Loading branch information
microaaron committed Jul 25, 2022
2 parents f8f45d9 + 835ef69 commit 1495d05
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: X3DOM CI

on:
workflow_dispatch:
pull_request:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 20 additions & 4 deletions src/Texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++ )
Expand Down Expand Up @@ -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 );
};

Expand Down
3 changes: 2 additions & 1 deletion src/nodes/Texturing/Texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions test/regression-suite/test/cases/movieTexture/movietexture.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<html>
<head>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
<script type="text/javascript" src="../../../../x3dom-include.js"></script>
</head>
<body>
<p>
videos as texture
</p>
<x3d width='500px' height='400px' showlog='true'>
<scene>
<shape>
<appearance>
<MovieTexture repeatS="false" repeatT="false" loop='true' url='https://upload.wikimedia.org/wikipedia/commons/e/ee/Lava_Hijzelaar_-_Imagine_%282020%29.webm'></MovieTexture>
</appearance>
<box></box>
</shape>
</scene>
</x3d>
<a href="https://commons.wikimedia.org/wiki/File:Lava_Hijzelaar_-_Imagine_(2020).webm">Lava Hijzelaar (Lava Art)</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>, via Wikimedia Commons
</body>
</html>

0 comments on commit 1495d05

Please sign in to comment.