diff --git a/infodisplay/infodisplay.js b/infodisplay/infodisplay.js index 0f252d4..976e539 100644 --- a/infodisplay/infodisplay.js +++ b/infodisplay/infodisplay.js @@ -78,6 +78,16 @@ function DisplayParticipant(broker, role, defaultUrls, timer) { clearTimeout(timeout); } 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)); }, timer); callback('opened', null, next.getAttribute('src')); diff --git a/video/index.html b/video/index.html index 654a12e..d8adae5 100644 --- a/video/index.html +++ b/video/index.html @@ -62,6 +62,10 @@ video.setAttribute('src', prefix + file + '.mp4'); video.autoplay = 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); var time = document.getElementById('current-time');