Allow videos to block rotation until they're finished
This commit is contained in:
parent
22212e5612
commit
8bc5c1167a
2 changed files with 14 additions and 0 deletions
|
@ -78,6 +78,16 @@ function DisplayParticipant(broker, role, defaultUrls, timer) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
|
const now = new Date();
|
||||||
|
if (next.contentWindow
|
||||||
|
&& next.contentWindow.waitUntil
|
||||||
|
&& next.contentWindow.waitUntil > now.getTime()) {
|
||||||
|
// This view wants more time, let it run to completion
|
||||||
|
setTimeout(() => {
|
||||||
|
participant.send('open', getRotationUrl(urls, indata));
|
||||||
|
}, next.contentWindow.waitUntil - now.getTime());
|
||||||
|
return;
|
||||||
|
}
|
||||||
participant.send('open', getRotationUrl(urls, indata));
|
participant.send('open', getRotationUrl(urls, indata));
|
||||||
}, timer);
|
}, timer);
|
||||||
callback('opened', null, next.getAttribute('src'));
|
callback('opened', null, next.getAttribute('src'));
|
||||||
|
|
|
@ -62,6 +62,10 @@
|
||||||
video.setAttribute('src', prefix + file + '.mp4');
|
video.setAttribute('src', prefix + file + '.mp4');
|
||||||
video.autoplay = true;
|
video.autoplay = true;
|
||||||
video.loop = true;
|
video.loop = true;
|
||||||
|
video.addEventListener('playing', function () {
|
||||||
|
var now = new Date();
|
||||||
|
window.waitUntil = now.getTime() + ((video.duration - video.currentTime) * 1000);
|
||||||
|
});
|
||||||
document.body.appendChild(video);
|
document.body.appendChild(video);
|
||||||
|
|
||||||
var time = document.getElementById('current-time');
|
var time = document.getElementById('current-time');
|
||||||
|
|
Loading…
Reference in a new issue