Update app
This commit is contained in:
@@ -7,16 +7,62 @@
|
||||
<style>
|
||||
html, body { height: 100%; width: 100%; margin: 0; background: #000; overflow: hidden; }
|
||||
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; background: #000; }
|
||||
#notice {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.86);
|
||||
font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
|
||||
z-index: 10;
|
||||
text-align: center;
|
||||
}
|
||||
#notice .box {
|
||||
max-width: 720px;
|
||||
}
|
||||
#notice .title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
#notice .msg {
|
||||
font-size: 18px;
|
||||
line-height: 1.4;
|
||||
margin: 0;
|
||||
opacity: 0.95;
|
||||
}
|
||||
img, video, iframe { width: 100%; height: 100%; object-fit: contain; border: 0; }
|
||||
/* removed bottom-left status text */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="notice" role="alert" aria-live="assertive">
|
||||
<div class="box">
|
||||
<p class="title" id="noticeTitle">Notice</p>
|
||||
<p class="msg" id="noticeText"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="stage"></div>
|
||||
<script>
|
||||
const token = "{{ display.token }}";
|
||||
const stage = document.getElementById('stage');
|
||||
function setNotice(_text) { /* intentionally no-op: notice UI removed */ }
|
||||
const noticeEl = document.getElementById('notice');
|
||||
const noticeTitleEl = document.getElementById('noticeTitle');
|
||||
const noticeTextEl = document.getElementById('noticeText');
|
||||
function setNotice(text, { title } = {}) {
|
||||
const t = (text || '').trim();
|
||||
if (!t) {
|
||||
noticeEl.style.display = 'none';
|
||||
noticeTextEl.textContent = '';
|
||||
return;
|
||||
}
|
||||
noticeTitleEl.textContent = title || 'Notice';
|
||||
noticeTextEl.textContent = t;
|
||||
noticeEl.style.display = 'flex';
|
||||
}
|
||||
|
||||
const isPreview = new URLSearchParams(window.location.search).get('preview') === '1';
|
||||
|
||||
@@ -55,7 +101,7 @@
|
||||
|
||||
function next() {
|
||||
if (!playlist || !playlist.items || playlist.items.length === 0) {
|
||||
setNotice('No playlist assigned.');
|
||||
setNotice('No playlists assigned.');
|
||||
clearStage();
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +110,7 @@
|
||||
idx = (idx + 1) % playlist.items.length;
|
||||
|
||||
clearStage();
|
||||
setNotice(playlist.playlist ? `${playlist.display} — ${playlist.playlist.name}` : playlist.display);
|
||||
setNotice('');
|
||||
|
||||
if (item.type === 'image') {
|
||||
const el = document.createElement('img');
|
||||
@@ -108,7 +154,14 @@
|
||||
next();
|
||||
} catch (e) {
|
||||
clearStage();
|
||||
setNotice(e && e.message ? e.message : 'Unable to load playlist.');
|
||||
if (e && e.code === 'LIMIT') {
|
||||
setNotice(
|
||||
(e && e.message) ? e.message : 'This display cannot start because the concurrent display limit has been reached.',
|
||||
{ title: 'Display limit reached' }
|
||||
);
|
||||
} else {
|
||||
setNotice(e && e.message ? e.message : 'Unable to load playlist.', { title: 'Playback error' });
|
||||
}
|
||||
// keep retrying; if a slot frees up the display will start automatically.
|
||||
}
|
||||
|
||||
@@ -138,7 +191,14 @@
|
||||
}
|
||||
} catch(e) {
|
||||
clearStage();
|
||||
setNotice(e && e.message ? e.message : 'Unable to load playlist.');
|
||||
if (e && e.code === 'LIMIT') {
|
||||
setNotice(
|
||||
(e && e.message) ? e.message : 'This display cannot start because the concurrent display limit has been reached.',
|
||||
{ title: 'Display limit reached' }
|
||||
);
|
||||
} else {
|
||||
setNotice(e && e.message ? e.message : 'Unable to load playlist.', { title: 'Playback error' });
|
||||
}
|
||||
}
|
||||
}, pollSeconds * 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user