|
89 | 89 | <body> |
90 | 90 | <canvas id="c"></canvas> |
91 | 91 | <div id="b"><a href="http://twgljs.org">twgl.js</a> - video texture</div> |
92 | | - <video id="vid" style="display: none;"> |
93 | | - <source src="../color-adjust/sample-video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /> |
94 | | - <source src="../color-adjust/sample-video.theora.ogv" type='video/ogg; codecs="theora, vorbis"' /> |
95 | | - <source src="../color-adjust/sample-video.webmvp8.webm" type='video/webm; codecs="vp8, vorbis"' /> |
96 | | - </video> |
97 | 92 | <div id="start" class="fulldialog"> |
98 | 93 | <div> |
99 | 94 | <img src="start.svg" /> |
|
170 | 165 | <script src="../js/twgl-full.min.js"></script> |
171 | 166 | <script> |
172 | 167 | "use strict"; |
173 | | - var isiOS = window.navigator.userAgent.match(/iPhone|iPad|iPod/i); |
174 | 168 | twgl.setDefaults({attribPrefix: "a_"}); |
175 | 169 | var m4 = twgl.m4; |
176 | 170 | var gl = twgl.getWebGLContext(document.getElementById("c")); |
|
244 | 238 | var audio; |
245 | 239 | var copyVideo; |
246 | 240 | var setVideo; |
247 | | - var video = document.getElementById("vid"); |
| 241 | + var video = document.createElement("video"); |
| 242 | + video.playsInline = true; |
| 243 | + video.src = "../color-adjust/sample-video.mp4"; |
248 | 244 | video.addEventListener("playing", function() { |
249 | 245 | copyVideo = true; |
250 | 246 | }, true); |
|
271 | 267 | } |
272 | 268 | once = true; |
273 | 269 | start.style.display = "none"; |
274 | | - if (isiOS) { |
275 | | - // iOS9 doesn't let us play video without going fullscreen :( |
276 | | - // so a workaround, which I'm sure Apple will *fix* as in "make it not work" |
277 | | - // is to create an audio tag using the same video |
278 | | - // play the audio. DON'T PLAY THE VIDEO. Set the video's currentTime to match |
279 | | - // the audio. I can't believe this works |
280 | | - audio = document.createElement("audio"); |
281 | | - audio.src = "../color-adjust/sample-video.mp4"; |
282 | | - audio.addEventListener("ended", function() { |
283 | | - audio.currentTime = 0; |
284 | | - audio.play(); |
285 | | - }); |
286 | | - audio.play(); |
287 | | - video.addEventListener("canplaythrough", function() { |
288 | | - setVideo = true; |
289 | | - }, true); |
290 | | - video.load(); |
291 | | - } else { |
292 | | - video.play(); |
293 | | - } |
| 270 | + video.play(); |
294 | 271 | } |
295 | 272 | } |
296 | 273 |
|
|
0 commit comments