Add self-hosted Mimir live edge

This commit is contained in:
Meta Vens 2026-05-30 22:04:54 +01:00
commit 1e4ab94776
12 changed files with 610 additions and 0 deletions

37
static/live/index.html Normal file
View file

@ -0,0 +1,37 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mimir Live</title>
<link rel="stylesheet" href="/static/live/player.css">
</head>
<body class="mimir-live-page">
<main class="mimir-live-shell">
<section class="mimir-live-stage" aria-label="Mimir live stream">
<video id="mimir-live-video" controls playsinline preload="metadata" poster="/Mimir.png"></video>
<div class="mimir-live-status" id="mimir-live-status">Waiting for the live edge.</div>
</section>
<section class="mimir-live-panel">
<p class="mimir-live-kicker">Self-hosted broadcast</p>
<h1>Mimir Live</h1>
<p>
Starfire encodes the final Mimir program once. Yggdrasil receives that
stream, rotates HLS segments, and serves this player over public HTTPS.
</p>
<dl>
<div>
<dt>Playlist</dt>
<dd><a id="mimir-live-playlist-link" href="https://live.mimir.gamecult.org/hls/mimir.m3u8">live.mimir.gamecult.org/hls/mimir.m3u8</a></dd>
</div>
<div>
<dt>Authority</dt>
<dd>Mimir encodes. Yggdrasil distributes. The static site only watches.</dd>
</div>
</dl>
</section>
</main>
<script src="https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js" crossorigin="anonymous"></script>
<script src="/static/live/player.js"></script>
</body>
</html>

104
static/live/player.css Normal file
View file

@ -0,0 +1,104 @@
.mimir-live-page,
.mimir-live-shell {
color-scheme: dark;
font-family: Ubuntu, system-ui, sans-serif;
color: #f3fbff;
}
.mimir-live-page *,
.mimir-live-shell * {
box-sizing: border-box;
}
.mimir-live-page {
margin: 0;
min-height: 100vh;
background: #05090d;
}
.mimir-live-shell a {
color: #9bd887;
}
.mimir-live-shell {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
gap: 24px;
align-items: start;
min-height: 100vh;
padding: clamp(16px, 3vw, 42px);
}
.mimir-live-stage {
display: grid;
gap: 10px;
}
.mimir-live-shell video {
width: 100%;
aspect-ratio: 16 / 9;
background: #020507;
border: 1px solid rgba(100, 183, 255, 0.28);
border-radius: 6px;
}
.mimir-live-status {
min-height: 1.4rem;
color: #c4dce5;
font-size: 0.92rem;
}
.mimir-live-panel {
display: grid;
gap: 14px;
padding-top: 4px;
}
.mimir-live-kicker {
margin: 0;
color: #64b7ff;
font-size: 0.78rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.mimir-live-panel h1,
.mimir-live-panel h2 {
margin: 0;
font-family: Montserrat, system-ui, sans-serif;
font-size: clamp(2rem, 5vw, 4.2rem);
font-weight: 200;
letter-spacing: 0;
}
.mimir-live-panel p {
margin: 0;
color: #c4dce5;
line-height: 1.55;
}
.mimir-live-panel dl {
display: grid;
gap: 14px;
margin: 6px 0 0;
}
.mimir-live-panel dt {
color: #6d8792;
font-size: 0.78rem;
font-weight: 700;
text-transform: uppercase;
}
.mimir-live-panel dd {
margin: 4px 0 0;
color: #f3fbff;
overflow-wrap: anywhere;
}
@media (max-width: 840px) {
.mimir-live-shell {
grid-template-columns: 1fr;
}
}

43
static/live/player.js Normal file
View file

@ -0,0 +1,43 @@
(function () {
const playlistUrl = "https://live.mimir.gamecult.org/hls/mimir.m3u8"
const video = document.getElementById("mimir-live-video")
const status = document.getElementById("mimir-live-status")
const link = document.getElementById("mimir-live-playlist-link")
if (!video || !status || !link) {
return
}
link.href = playlistUrl
link.textContent = playlistUrl.replace(/^https?:\/\//, "")
function setStatus(message) {
status.textContent = message
}
if (video.canPlayType("application/vnd.apple.mpegurl")) {
video.src = playlistUrl
setStatus("Using native HLS playback.")
return
}
if (window.Hls && window.Hls.isSupported()) {
const hls = new window.Hls({
lowLatencyMode: false,
backBufferLength: 30,
maxBufferLength: 18,
})
hls.loadSource(playlistUrl)
hls.attachMedia(video)
hls.on(window.Hls.Events.MANIFEST_PARSED, () => {
setStatus("Live edge found. Playback is ready.")
})
hls.on(window.Hls.Events.ERROR, (_event, data) => {
const detail = data && data.details ? ` ${data.details}` : ""
setStatus(`Waiting for stream.${detail}`)
})
return
}
setStatus("This browser cannot play HLS here. Try Safari, Edge, or Chrome with hls.js available.")
})()