Debug ohne Embed
All checks were successful
release-tag / release-image (push) Successful in 1m56s

This commit is contained in:
2025-09-21 17:55:34 +02:00
parent d24eeb1c58
commit 4f8a2fd178
13 changed files with 47 additions and 47 deletions

1
web/static/js/hls.min.js vendored Normal file

File diff suppressed because one or more lines are too long

25
web/static/js/index.js Normal file
View File

@@ -0,0 +1,25 @@
async function load(){
const r = await fetch('/api/streams');
const data = await r.json();
const q = (document.getElementById('filter').value||'').toLowerCase();
const list = document.getElementById('list');
list.innerHTML = '';
data.items
.filter(it => !q || it.name.toLowerCase().includes(q))
.forEach(it => {
const a = document.createElement('a');
a.href = '/' + encodeURIComponent(it.name);
a.className = 'card';
a.innerHTML = `
<div class="row space-between">
<div>
<div class="title-strong">${it.name}</div>
<div class="muted">Zuschauer: ${it.viewers}</div>
</div>
<div class="pill ${it.live ? 'live':'off'}">${it.live ? 'LIVE' : 'Offline'}</div>
</div>`;
list.appendChild(a);
});
}
document.getElementById('filter').addEventListener('input', load);
load(); setInterval(load, 3000);

33
web/static/js/stream.js Normal file
View File

@@ -0,0 +1,33 @@
(function(){
const name = window.__STREAM_NAME__; // oder: document.body.dataset.name
const v = document.getElementById('v');
const liveEl = document.getElementById('live');
const viewersEl = document.getElementById('viewers');
const srcEl = document.getElementById('hlssrc');
function updateLive(live){
liveEl.className = 'pill ' + (live ? 'live' : 'off');
liveEl.textContent = live ? 'LIVE' : 'Offline';
}
async function refresh(){
const r = await fetch('/api/streams');
const d = await r.json();
const it = d.items.find(x=>x.name===name);
const live = !!(it && it.live);
updateLive(live);
viewersEl.textContent = 'Zuschauer: ' + (it ? it.viewers : 0);
if(live){
const src = '/hls/'+encodeURIComponent(name);
srcEl.textContent = src;
if (window.Hls && Hls.isSupported()){
if(!window._hls){ window._hls = new Hls(); window._hls.attachMedia(v); }
window._hls.loadSource(src);
} else if (v.canPlayType('application/vnd.apple.mpegurl')) {
v.src = src;
}
}
}
refresh(); setInterval(refresh, 2500);
})();