feat(playout): redesigned MCR screen + SCTE-35 end-to-end

Drop in the redesigned timeline-centric Playout (PGM monitor, transport,
SCTE-35 card, as-run drawer) from the on-node redesign, fully wired to the
real playout API (channels/transport/HLS preview w/ error-recovery/as-run);
no mock data. In-page ConfirmModal for destructive actions.

SCTE-35: new playout_scte_breaks table (migration 033), endpoints to
schedule/trigger/list/cancel breaks (POST/GET/DELETE /channels/:id/scte[/trigger]),
scheduler due-break sweep, engine triggerScte + auto-return + as-run 'scte'
rows + on-air SCTE-BREAK state and timeline AD markers. In-stream SCTE-35
cue injection is a documented stub (CasparCG FFMPEG consumer exposes no
scte35 muxer) — scheduling/triggering/countdown/as-run are functional.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Zac Gaetano 2026-05-31 19:58:02 -04:00
parent 8a958046ef
commit 984a73e8ec
7 changed files with 1399 additions and 287 deletions

View file

@ -0,0 +1,52 @@
-- Migration 033 — SCTE-35 ad-break markers for playout.
--
-- Adds the missing SCTE-35 splice feature to the playout (MCR) subsystem. An
-- operator can either schedule an ad break on a channel's timeline (relative to
-- the active playlist position, or at a wall-clock time) or fire one immediately
-- ("splice now"). Each break is recorded here and, when fired, also written to
-- the append-only as-run log so it shows in the compliance record alongside the
-- clips that aired.
--
-- type:
-- splice_insert — a scheduled break (out → return), duration_s seconds long
-- immediate — fire-now splice (operator pressed "Trigger ad break now")
-- splice_out — open-ended avail out (provider break start)
-- splice_in — return-to-network (provider break end)
--
-- status: pending → fired (when the engine acts on it) → done (when the break
-- window has elapsed). cancelled is set if the operator removes a pending break.
--
-- The engine (services/playout) acts on a break by logging the cue, marking the
-- as-run row, and — where the output path supports it — injecting a real
-- SCTE-35 cue (see playout-manager.triggerScte for the injection point/TODO).
CREATE TABLE IF NOT EXISTS playout_scte_breaks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
channel_id UUID NOT NULL REFERENCES playout_channels(id) ON DELETE CASCADE,
-- Position on the active playlist this break should fire after (0-based item
-- index). NULL for immediate/wall-clock breaks.
playlist_pos INTEGER,
-- Wall-clock fire time for scheduled breaks. NULL for immediate breaks.
scheduled_at TIMESTAMPTZ,
duration_s INTEGER NOT NULL DEFAULT 30,
-- SCTE-35 event id (the splice_event_id carried in the cue). Auto-assigned.
event_id INTEGER NOT NULL DEFAULT 1,
type TEXT NOT NULL DEFAULT 'splice_insert',
status TEXT NOT NULL DEFAULT 'pending',
fired_at TIMESTAMPTZ,
created_by UUID REFERENCES users(id) ON DELETE SET NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CHECK (type IN ('splice_insert','immediate','splice_out','splice_in')),
CHECK (status IN ('pending','fired','done','cancelled'))
);
CREATE INDEX IF NOT EXISTS idx_playout_scte_channel ON playout_scte_breaks (channel_id, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_playout_scte_status ON playout_scte_breaks (status);
-- As-run gains a 'scte' result so fired breaks land in the compliance log next to
-- the clips. The original migration constrained result to played/skipped/error;
-- widen it.
ALTER TABLE playout_as_run DROP CONSTRAINT IF EXISTS playout_as_run_result_check;
ALTER TABLE playout_as_run ADD CONSTRAINT playout_as_run_result_check
CHECK (result IN ('played','skipped','error','scte'));

View file

@ -476,6 +476,117 @@ router.get('/channels/:id/asrun', async (req, res, next) => {
} catch (err) { next(err); } } catch (err) { next(err); }
}); });
// ── SCTE-35 ad-break splices ───────────────────────────────────────────────
// Schedule, trigger, and list SCTE-35 ad breaks on a channel. A break can be
// scheduled (after a playlist position, or at a wall-clock time) or fired
// immediately. Firing tells the sidecar to splice the live output, marks the
// break 'fired', and stamps a row in the as-run compliance log.
const SCTE_TYPES = new Set(['splice_insert', 'immediate', 'splice_out', 'splice_in']);
// Fire a break row on the sidecar + record it. Shared by the immediate-trigger
// route and the scheduler's due-break sweep. Best-effort: a sidecar failure
// marks the break 'error' via error_message but never throws to the caller's
// HTTP path beyond what's handled here.
export async function fireScteBreak(channel, brk) {
const out = await callSidecar(channel, '/scte/trigger', 'POST', {
eventId: brk.event_id,
type: brk.type === 'immediate' ? 'splice_insert' : brk.type,
durationS: brk.duration_s,
});
await pool.query(
`UPDATE playout_scte_breaks SET status = 'fired', fired_at = NOW(), updated_at = NOW() WHERE id = $1`,
[brk.id]
);
// Stamp the compliance log. ended_at/duration are known up front for a
// fixed-duration break, so the row is written closed.
await pool.query(
`INSERT INTO playout_as_run
(channel_id, item_id, clip_name, started_at, ended_at, duration_s, result)
VALUES ($1, $2, $3, NOW(),
CASE WHEN $4 > 0 THEN NOW() + ($4 || ' seconds')::interval ELSE NULL END,
$4, 'scte')`,
[channel.id, brk.id, `SCTE-35 ${brk.type} (${brk.duration_s}s)`, brk.duration_s]
);
return out;
}
router.get('/channels/:id/scte', async (req, res, next) => {
try {
const { rows } = await pool.query(
`SELECT * FROM playout_scte_breaks WHERE channel_id = $1 ORDER BY created_at DESC LIMIT 200`,
[req.channel.id]);
res.json(rows);
} catch (err) { next(err); }
});
// Schedule a break. Body: { type, duration_s, playlist_pos?, scheduled_at? }.
// A pending break with a playlist_pos / scheduled_at is fired later by the
// scheduler; one with neither is fired immediately for convenience.
router.post('/channels/:id/scte', requireChannelEdit, async (req, res, next) => {
try {
const { type = 'splice_insert', duration_s = 30,
playlist_pos = null, scheduled_at = null } = req.body || {};
if (!SCTE_TYPES.has(type)) {
return res.status(400).json({ error: `type must be one of: ${[...SCTE_TYPES].join(', ')}` });
}
const dur = Math.max(0, parseInt(duration_s, 10) || 0);
// Auto-assign a monotonically increasing splice_event_id per channel.
const ev = await pool.query(
`SELECT COALESCE(MAX(event_id), 0) + 1 AS next FROM playout_scte_breaks WHERE channel_id = $1`,
[req.channel.id]);
const eventId = ev.rows[0].next;
const { rows } = await pool.query(
`INSERT INTO playout_scte_breaks
(channel_id, playlist_pos, scheduled_at, duration_s, event_id, type, created_by)
VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING *`,
[req.channel.id, playlist_pos, scheduled_at, dur, eventId, type, req.user?.id || null]);
res.status(201).json(rows[0]);
} catch (err) { next(err); }
});
// Fire an ad break immediately ("splice now"). Body: { type?, duration_s? }.
// Creates the break row and triggers the splice on the live output in one shot.
router.post('/channels/:id/scte/trigger', requireChannelEdit, async (req, res, next) => {
try {
if (req.channel.status !== 'running') {
return res.status(409).json({ error: 'Channel is not running' });
}
const { type = 'immediate', duration_s = 30 } = req.body || {};
if (!SCTE_TYPES.has(type)) {
return res.status(400).json({ error: `type must be one of: ${[...SCTE_TYPES].join(', ')}` });
}
const dur = Math.max(0, parseInt(duration_s, 10) || 0);
const ev = await pool.query(
`SELECT COALESCE(MAX(event_id), 0) + 1 AS next FROM playout_scte_breaks WHERE channel_id = $1`,
[req.channel.id]);
const eventId = ev.rows[0].next;
const { rows } = await pool.query(
`INSERT INTO playout_scte_breaks (channel_id, duration_s, event_id, type, status, created_by)
VALUES ($1,$2,$3,$4,'pending',$5) RETURNING *`,
[req.channel.id, dur, eventId, type, req.user?.id || null]);
try {
const out = await fireScteBreak(req.channel, rows[0]);
const updated = await pool.query('SELECT * FROM playout_scte_breaks WHERE id = $1', [rows[0].id]);
res.json({ break: updated.rows[0], engine: out });
} catch (err) {
await pool.query(`UPDATE playout_scte_breaks SET status = 'cancelled', updated_at = NOW() WHERE id = $1`,
[rows[0].id]).catch(() => {});
return res.status(502).json({ error: 'Sidecar unreachable: ' + err.message });
}
} catch (err) { next(err); }
});
router.delete('/channels/:id/scte/:scteId', requireChannelEdit, async (req, res, next) => {
try {
const { rows } = await pool.query(
`UPDATE playout_scte_breaks SET status = 'cancelled', updated_at = NOW()
WHERE id = $1 AND channel_id = $2 AND status = 'pending' RETURNING id`,
[req.params.scteId, req.channel.id]);
if (rows.length === 0) return res.status(404).json({ error: 'Pending break not found' });
res.json({ cancelled: true });
} catch (err) { next(err); }
});
async function loadChannelForBody(req, res, next) { async function loadChannelForBody(req, res, next) {
const channelId = req.body.channel_id || req.query.channel_id; const channelId = req.body.channel_id || req.query.channel_id;
if (!channelId) return res.status(400).json({ error: 'channel_id is required' }); if (!channelId) return res.status(400).json({ error: 'channel_id is required' });

View file

@ -9,7 +9,7 @@
import pool from './db/pool.js'; import pool from './db/pool.js';
import { syncToAmpp } from './routes/upload.js'; import { syncToAmpp } from './routes/upload.js';
import { restartChannel } from './routes/playout.js'; import { restartChannel, fireScteBreak } from './routes/playout.js';
import { INTERNAL_TOKEN } from './middleware/auth.js'; import { INTERNAL_TOKEN } from './middleware/auth.js';
const TICK_INTERVAL_MS = parseInt(process.env.SCHEDULER_TICK_MS || '15000', 10); const TICK_INTERVAL_MS = parseInt(process.env.SCHEDULER_TICK_MS || '15000', 10);
@ -289,6 +289,32 @@ async function playoutHealthTick(client) {
} catch (e) { } catch (e) {
console.warn(`[scheduler] as-run write failed for ${ch.id}: ${e.message}`); console.warn(`[scheduler] as-run write failed for ${ch.id}: ${e.message}`);
} }
// SCTE-35: fire any pending scheduled breaks now due. Position-based
// breaks (playlist_pos) fire when the engine reaches that item; wall-clock
// breaks fire at scheduled_at. Failures mark the break cancelled so a bad
// break never wedges the sweep.
try {
const { rows: due } = await client.query(
`SELECT * FROM playout_scte_breaks
WHERE channel_id = $1 AND status = 'pending'
AND ( (scheduled_at IS NOT NULL AND scheduled_at <= NOW())
OR (playlist_pos IS NOT NULL AND playlist_pos <= $2) )
ORDER BY created_at ASC`,
[ch.id, (engine && engine.currentIndex >= 0) ? engine.currentIndex : -1]
);
for (const brk of due) {
try { await fireScteBreak(ch, brk); }
catch (e2) {
console.warn(`[scheduler] scte fire failed for break ${brk.id}: ${e2.message}`);
await client.query(
`UPDATE playout_scte_breaks SET status = 'cancelled', updated_at = NOW() WHERE id = $1`,
[brk.id]).catch(() => {});
}
}
} catch (e) {
console.warn(`[scheduler] scte sweep failed for ${ch.id}: ${e.message}`);
}
} catch (err) { } catch (err) {
// When last_heartbeat_at is NULL (channel just spawned), fall back to // When last_heartbeat_at is NULL (channel just spawned), fall back to
// updated_at (set to NOW() by spawnChannelSidecar). This prevents a // updated_at (set to NOW() by spawnChannelSidecar). This prevents a

View file

@ -44,6 +44,20 @@ app.post('/transport/skip', async (req, res) => { try { res.json(await playout
app.post('/transport/pause', async (req, res) => { try { res.json(await playoutManager.pause()); } catch (e) { res.status(500).json({ error: e.message }); } }); app.post('/transport/pause', async (req, res) => { try { res.json(await playoutManager.pause()); } catch (e) { res.status(500).json({ error: e.message }); } });
app.post('/transport/resume', async (req, res) => { try { res.json(await playoutManager.resume()); } catch (e) { res.status(500).json({ error: e.message }); } }); app.post('/transport/resume', async (req, res) => { try { res.json(await playoutManager.resume()); } catch (e) { res.status(500).json({ error: e.message }); } });
// Fire an SCTE-35 ad-break splice on the live output. Body:
// { eventId, type: 'splice_insert'|'immediate'|'splice_out'|'splice_in', durationS }
// Returns the active-break descriptor (or the splice_in ack) so the mam-api can
// stamp the as-run log.
app.post('/scte/trigger', (req, res) => {
try {
const { eventId = 1, type = 'splice_insert', durationS = 30 } = req.body || {};
res.json(playoutManager.triggerScte({ eventId, type, durationS }));
} catch (err) {
console.error('[playout] /scte/trigger error:', err.message);
res.status(500).json({ error: err.message });
}
});
app.get('/status', (req, res) => res.json(playoutManager.getStatus())); app.get('/status', (req, res) => res.json(playoutManager.getStatus()));
// Auto-start: when the sidecar is spawned by mam-api with channel env, bring up // Auto-start: when the sidecar is spawned by mam-api with channel env, bring up

View file

@ -83,8 +83,13 @@ export class PlayoutManager {
currentClip: null, currentClip: null,
startedAt: null, startedAt: null,
lastError: null, lastError: null,
// SCTE-35: the currently-active ad break, if any. Set by triggerScte and
// cleared by a timer when the break window elapses. Surfaced in getStatus
// so the UI can render an "in break" state + countdown.
scteActive: null, // { eventId, type, durationS, firedAt(iso), endsAt(iso) }
}; };
this._advanceTimer = null; this._advanceTimer = null;
this._scteTimer = null;
this._hlsProc = null; // standalone ffmpeg re-mux child process this._hlsProc = null; // standalone ffmpeg re-mux child process
this._hlsRestartTimer = null; this._hlsRestartTimer = null;
} }
@ -305,6 +310,7 @@ export class PlayoutManager {
async stopChannel() { async stopChannel() {
this._clearAdvance(); this._clearAdvance();
this._clearScte();
this.state.running = false; // set first so the ffmpeg exit handler won't respawn this.state.running = false; // set first so the ffmpeg exit handler won't respawn
this._stopHlsRemux(); this._stopHlsRemux();
try { await this.amcp.send(`STOP ${CHANNEL}-${FG_LAYER}`); } catch (_) {} try { await this.amcp.send(`STOP ${CHANNEL}-${FG_LAYER}`); } catch (_) {}
@ -430,6 +436,92 @@ export class PlayoutManager {
return this.getStatus(); return this.getStatus();
} }
// ── SCTE-35 ad-break splice ──────────────────────────────────────────────
// Act on an ad-break cue. The mam-api owns scheduling + persistence; the
// sidecar performs the actual splice on the live output and tracks the active
// break locally so /status can report a countdown.
//
// What this does today, end to end:
// 1. Records the break as the active break (UI reads it from /status for the
// "SCTE BREAK" on-air state + countdown). A timer clears it after
// durationS so the UI returns to normal automatically.
// 2. Emits an operator-visible log line at the splice point.
// 3. Returns the cue descriptor so the mam-api can stamp the as-run log.
//
// ── Real in-stream SCTE-35 injection (the injection point) ─────────────────
// True SCTE-35 requires inserting a splice_info_section into the OUTPUT
// transport stream on a dedicated SCTE-35 PID, time-aligned to the splice
// point (pts_time). CasparCG 2.3's FFMPEG consumer does NOT expose an SCTE-35
// muxer option, so we cannot ask CasparCG to carry the cue. The two viable
// production paths, neither of which the current single-process CasparCG
// output supports out of the box, are:
//
// (a) ffmpeg-based output: when the primary consumer is replaced by a
// Node-spawned ffmpeg (as the HLS preview re-mux already is), mux an
// SCTE-35 data stream. ffmpeg can pass through a -map'd scte35 PID, and
// for HLS can emit #EXT-X-CUE-OUT/#EXT-X-CUE-IN (or DATERANGE) tags. The
// hook would build the splice_insert binary section here and feed it to
// that ffmpeg via a data input / sidecar packetizer.
// (b) A downstream SCTE-35 inserter (e.g. an OTT packager / encoder that
// accepts cue triggers over its own API). The hook would POST the cue
// to that device's API at the splice instant.
//
// Until one of those output paths is wired, the splice is faithfully
// scheduled, triggered, countdown-tracked, and as-run-logged — but the cue is
// NOT yet embedded in the SRT/RTMP/SDI/NDI elementary stream. Replace the body
// of _injectScteCue below to enable real injection.
triggerScte({ eventId = 1, type = 'splice_insert', durationS = 30 } = {}) {
const firedAt = new Date();
const endsAt = new Date(firedAt.getTime() + (durationS > 0 ? durationS * 1000 : 0));
// Build + emit the cue on the output (TODO injection point — see above).
this._injectScteCue({ eventId, type, durationS });
// A splice_in / return-to-network ends any active break immediately.
if (type === 'splice_in') {
this._clearScte();
console.log(`[playout][scte] splice_in event=${eventId} — return to network`);
return { eventId, type, durationS: 0, firedAt: firedAt.toISOString(), endsAt: firedAt.toISOString() };
}
this.state.scteActive = {
eventId, type, durationS,
firedAt: firedAt.toISOString(),
endsAt: endsAt.toISOString(),
};
console.log(`[playout][scte] ${type} event=${eventId} duration=${durationS}s — splice OUT at ${firedAt.toISOString()}`);
// Auto-clear the active break when its window elapses (splice_out is
// open-ended, so it stays until an explicit splice_in).
if (this._scteTimer) { clearTimeout(this._scteTimer); this._scteTimer = null; }
if (durationS > 0 && type !== 'splice_out') {
this._scteTimer = setTimeout(() => {
this._scteTimer = null;
console.log(`[playout][scte] break event=${eventId} ended — return to network`);
this._clearScte();
}, durationS * 1000);
}
return this.state.scteActive;
}
// The SCTE-35 cue packetizer / injection hook. See the long comment on
// triggerScte for why this is a stub on the current CasparCG output path and
// what to put here to enable real in-stream injection.
_injectScteCue({ eventId, type, durationS }) {
// TODO(scte-injection): build the splice_info_section (splice_insert with
// splice_event_id=eventId, out_of_network_indicator per type,
// break_duration=durationS*90000 ticks) and emit it on the output's SCTE-35
// PID via an ffmpeg-based output, or POST it to a downstream inserter's API.
// No-op until the output path supports it; the scheduling/trigger/as-run
// path above is fully functional regardless.
return null;
}
_clearScte() {
if (this._scteTimer) { clearTimeout(this._scteTimer); this._scteTimer = null; }
this.state.scteActive = null;
}
_reportAsRunStart(item) { _reportAsRunStart(item) {
// The mam-api owns the as-run table; the sidecar just logs locally. The API // The mam-api owns the as-run table; the sidecar just logs locally. The API
// polls /status and writes as-run rows on clip change. Keeping the DB write // polls /status and writes as-run rows on clip change. Keeping the DB write
@ -451,6 +543,7 @@ export class PlayoutManager {
loop: this.state.loop, loop: this.state.loop,
startedAt: this.state.startedAt, startedAt: this.state.startedAt,
lastError: this.state.lastError, lastError: this.state.lastError,
scteActive: this.state.scteActive || null,
}; };
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,139 +1,390 @@
/* Playout / Master Control (MCR) page styles. */ /* Playout / Master Control (MCR) page styles — redesigned. */
.po-page { display: flex; flex-direction: column; gap: 14px; } /* ── Page header ─────────────────────────────────────────────────────────────── */
.po-head {
display: flex; align-items: center; justify-content: space-between;
padding: 12px 16px 10px;
border-bottom: 1px solid var(--border);
background: var(--bg-1);
gap: 16px;
flex-wrap: wrap;
}
.po-head-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.po-head-title {
font-size: 15px; font-weight: 700; color: var(--text-1);
letter-spacing: 0.02em; white-space: nowrap;
}
.po-clock {
font-size: 22px; font-weight: 700; color: var(--text-1);
letter-spacing: 0.05em; min-width: 90px; text-align: right;
font-variant-numeric: tabular-nums;
}
/* Channel tab bar */ /* ── Channel tab bar ─────────────────────────────────────────────────────────── */
.po-channels-bar { .po-channels-bar {
display: flex; align-items: center; gap: 8px; flex-wrap: wrap; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
padding-bottom: 10px; border-bottom: 1px solid var(--border);
} }
.po-chan-tab { .po-chan-tab {
display: inline-flex; align-items: center; gap: 7px; display: inline-flex; align-items: center; gap: 7px;
padding: 6px 12px; border-radius: 8px; padding: 5px 12px; border-radius: 8px;
background: var(--bg-2); border: 1px solid var(--border); background: var(--bg-2); border: 1px solid var(--border);
color: var(--text-2); font-size: 13px; cursor: pointer; color: var(--text-2); font-size: 13px; cursor: pointer;
transition: background 0.15s, color 0.15s;
} }
.po-chan-tab:hover { background: var(--bg-3); color: var(--text-1); } .po-chan-tab:hover { background: var(--bg-3); color: var(--text-1); }
.po-chan-tab.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft-2); } .po-chan-tab.active {
background: var(--accent-soft); color: var(--accent-text);
border-color: var(--accent-soft-2);
}
.po-chan-dot { .po-chan-dot {
width: 8px; height: 8px; border-radius: 50%; width: 8px; height: 8px; border-radius: 50%;
background: var(--text-3); background: var(--text-3); flex-shrink: 0;
transition: background 0.3s, box-shadow 0.3s;
} }
.po-chan-dot.live { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); } .po-chan-dot.live {
background: var(--danger);
.po-empty { text-align: center; padding: 48px 0; display: flex; flex-direction: column; gap: 12px; align-items: center; } box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent);
animation: po-pulse 2s ease-in-out infinite;
/* Channel detail */
.po-detail { display: flex; flex-direction: column; gap: 14px; }
.po-detail-head { display: flex; justify-content: space-between; align-items: flex-start; }
.po-detail-actions { display: flex; gap: 8px; }
.po-grid {
display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px;
} }
@media (max-width: 900px) { .po-grid { grid-template-columns: 1fr; } } @keyframes po-pulse {
0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.po-section-label { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 10%, transparent); }
font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--text-3); font-weight: 600;
} }
/* Program monitor */ /* ── Page layout ─────────────────────────────────────────────────────────────── */
.po-monitor { .po-page { display: flex; flex-direction: column; gap: 0; padding: 0; }
background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; .po-root { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
display: flex; flex-direction: column; overflow: hidden;
.po-empty {
text-align: center; padding: 48px 0;
display: flex; flex-direction: column; gap: 12px; align-items: center;
} }
.po-monitor-head {
display: flex; justify-content: space-between; align-items: center; /* ── Top row: PGM + right rail ───────────────────────────────────────────────── */
padding: 10px 12px; border-bottom: 1px solid var(--border); .po-top {
display: grid;
grid-template-columns: 1fr 300px;
gap: 12px;
align-items: start;
} }
.po-onair { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: 0.04em; } @media (max-width: 960px) {
.po-onair.live { color: var(--danger); } .po-top { grid-template-columns: 1fr; }
.po-monitor-screen { }
position: relative; flex: 1; min-height: 220px; background: #000;
/* ── PGM monitor column ──────────────────────────────────────────────────────── */
.po-pgm-col {
display: flex; flex-direction: column; gap: 8px;
}
/* ── Screen ──────────────────────────────────────────────────────────────────── */
.po-pgm {
background: var(--bg-1);
border: 1px solid var(--border);
border-radius: 12px;
overflow: hidden;
display: flex; flex-direction: column;
}
.po-screen {
position: relative;
background: #0a0a0a;
aspect-ratio: 16 / 9;
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
overflow: hidden;
} }
.po-monitor-video { .po-monitor-video {
width: 100%; height: 100%; object-fit: contain; display: block; width: 100%; height: 100%; object-fit: contain; display: block;
} }
.po-monitor-overlay { .po-onair-badge {
position: absolute; inset: 0; position: absolute; top: 10px; left: 10px;
display: flex; align-items: center; justify-content: center; background: var(--danger); color: #fff;
background: rgba(0,0,0,0.6); color: var(--text-2); font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
pointer-events: none; padding: 3px 8px; border-radius: 4px;
animation: po-onair-blink 2s step-end infinite;
z-index: 2;
} }
.po-monitor-foot { @keyframes po-onair-blink {
display: flex; align-items: center; gap: 10px; 0%, 100% { opacity: 1; }
padding: 8px 12px; border-top: 1px solid var(--border); font-size: 11px; 50% { opacity: 0.6; }
}
.po-screen-offline {
position: absolute; inset: 0;
display: flex; align-items: center; justify-content: center; gap: 8px;
background: rgba(0,0,0,0.7); color: var(--text-3); font-size: 13px;
}
.po-screen-offline-dot {
width: 8px; height: 8px; border-radius: 50%; background: var(--text-3);
}
.po-tc-overlay {
position: absolute; bottom: 8px; left: 10px;
font-size: 12px; color: rgba(255,255,255,0.7);
letter-spacing: 0.06em; font-variant-numeric: tabular-nums;
text-shadow: 0 1px 3px rgba(0,0,0,0.9);
pointer-events: none; z-index: 2;
}
.po-meters-wrap {
position: absolute; right: 10px; bottom: 8px;
display: flex; align-items: flex-end;
z-index: 2;
}
.po-vu-meter { display: block; }
/* Clip progress bar (below video) */
.po-clip-progress {
height: 3px; background: var(--bg-3); flex-shrink: 0;
}
.po-clip-progress-fill {
height: 100%; background: var(--danger);
transition: width 0.1s linear;
}
/* Monitor metadata footer */
.po-monitor-meta {
display: flex; align-items: center; gap: 8px;
padding: 8px 12px;
border-top: 1px solid var(--border);
font-size: 11px; min-height: 32px;
} }
.po-monitor-clip-name { .po-monitor-clip-name {
flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
color: var(--text-1); color: var(--text-1);
} }
.po-monitor-right {
/* Media bin */ display: flex; align-items: center; gap: 8px;
.po-bin { flex-shrink: 0; color: var(--text-3);
display: flex; flex-direction: column; min-height: 260px; max-height: 360px; font-variant-numeric: tabular-nums;
border-radius: 12px; overflow: hidden; }
.po-clip-pos { color: var(--text-2); }
.po-clip-remain { color: var(--warning); }
/* ── Transport bar ───────────────────────────────────────────────────────────── */
.po-transport {
display: flex; align-items: center;
padding: 8px 10px;
background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;
}
.po-transport-group { display: flex; align-items: center; gap: 4px; }
.po-trans-btn {
display: inline-flex; align-items: center; gap: 5px;
padding: 7px 12px; border-radius: 8px;
border: 1px solid var(--border);
background: var(--bg-2); color: var(--text-1);
cursor: pointer; font-size: 13px;
transition: background 0.12s, border-color 0.12s, opacity 0.12s;
white-space: nowrap;
}
.po-trans-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.po-trans-btn:not(:disabled):hover { background: var(--bg-3); }
.po-trans-btn:not(:disabled):active { background: var(--bg-4, var(--bg-3)); }
.po-trans-play {
background: color-mix(in srgb, var(--accent) 15%, var(--bg-2));
border-color: var(--accent-soft-2);
color: var(--accent-text);
font-weight: 600;
}
.po-trans-play:not(:disabled):hover {
background: color-mix(in srgb, var(--accent) 25%, var(--bg-2));
}
.po-trans-stop {
color: var(--danger);
border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}
.po-trans-stop:not(:disabled):hover {
background: color-mix(in srgb, var(--danger) 10%, var(--bg-2));
}
.po-trans-icon { font-size: 14px; line-height: 1; }
.po-trans-label { font-size: 12px; }
/* ── Right rail ──────────────────────────────────────────────────────────────── */
.po-rail {
display: flex; flex-direction: column; gap: 10px;
}
/* Generic card */
.po-card {
background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;
overflow: hidden;
}
.po-card-head {
display: flex; align-items: center; gap: 8px;
padding: 9px 12px; border-bottom: 1px solid var(--border);
}
/* Channel card */
.po-channel-card {}
.po-channel-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.po-channel-meta {
padding: 8px 12px; font-size: 11px;
display: flex; align-items: center; gap: 8px;
}
.po-restart-badge {
font-size: 10px; color: var(--warning); font-weight: 600;
}
/* Now Playing card */
.po-nowplaying-card {}
.po-nowplaying-pos { margin-left: auto; font-size: 11px; }
.po-nowplaying-empty { padding: 16px 12px; font-size: 12px; }
.po-nowplaying-name {
padding: 8px 12px 6px;
font-size: 13px; font-weight: 600; color: var(--text-1);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.po-nowplaying-progress { padding: 0 12px 8px; }
.po-nowplaying-bar {
height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden;
margin-bottom: 4px;
}
.po-nowplaying-fill {
height: 100%; background: var(--danger); border-radius: 2px;
transition: width 0.5s linear;
}
.po-nowplaying-times {
display: flex; justify-content: space-between; font-size: 10px;
}
.po-nowplaying-elapsed { color: var(--text-2); }
.po-nowplaying-remain { color: var(--text-3); }
.po-nowplaying-next {
display: flex; align-items: center; gap: 6px;
padding: 6px 12px; border-top: 1px solid var(--border);
font-size: 11px;
}
.po-nowplaying-next-name {
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* SCTE-35 card */
.po-scte-card {}
.po-scte-stub-badge {
margin-left: auto;
font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, transparent);
padding: 2px 5px; border-radius: 3px;
}
.po-scte-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.po-scte-row { display: flex; gap: 6px; flex-wrap: wrap; }
.po-fire {
flex: 1; min-width: 0;
padding: 6px 10px; border-radius: 7px;
font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
cursor: pointer; border: 1px solid transparent;
transition: background 0.12s, opacity 0.12s;
white-space: nowrap;
}
.po-fire:disabled { opacity: 0.35; cursor: not-allowed; }
.po-fire.amber {
background: color-mix(in srgb, #f59e0b 18%, var(--bg-2));
border-color: color-mix(in srgb, #f59e0b 40%, transparent);
color: #f59e0b;
}
.po-fire.amber:not(:disabled):hover {
background: color-mix(in srgb, #f59e0b 28%, var(--bg-2));
}
.po-fire.in {
background: color-mix(in srgb, #22c55e 18%, var(--bg-2));
border-color: color-mix(in srgb, #22c55e 40%, transparent);
color: #22c55e;
}
.po-fire.in:not(:disabled):hover {
background: color-mix(in srgb, #22c55e 28%, var(--bg-2));
}
.po-fire.out {
background: color-mix(in srgb, var(--danger) 18%, var(--bg-2));
border-color: color-mix(in srgb, var(--danger) 40%, transparent);
color: var(--danger);
}
.po-fire.out:not(:disabled):hover {
background: color-mix(in srgb, var(--danger) 28%, var(--bg-2));
}
.po-scte-last {
font-size: 10px; color: var(--text-3); margin-top: 2px;
}
/* Rail quick-actions */
.po-rail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.po-rail-action-btn { flex: 1; text-align: center; }
/* ── Section label ───────────────────────────────────────────────────────────── */
.po-section-label {
font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--text-3); font-weight: 600;
}
/* ── Media bin ───────────────────────────────────────────────────────────────── */
.po-bin {
display: flex; flex-direction: column;
min-height: 180px; max-height: 280px;
border-radius: 10px; overflow: hidden;
background: var(--bg-1); border: 1px solid var(--border);
}
.po-bin-head {
display: flex; justify-content: space-between; align-items: center; gap: 8px;
padding: 8px 12px; border-bottom: 1px solid var(--border);
} }
.po-bin-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.po-bin-list { overflow-y: auto; flex: 1; } .po-bin-list { overflow-y: auto; flex: 1; }
.po-bin-item { .po-bin-item {
display: flex; justify-content: space-between; align-items: center; gap: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
padding: 8px 12px; border-bottom: 1px solid var(--border); padding: 7px 12px; border-bottom: 1px solid var(--border);
cursor: grab; user-select: none; cursor: grab; user-select: none;
} }
.po-bin-item:hover { background: var(--bg-3); } .po-bin-item:hover { background: var(--bg-3); }
.po-bin-item:active { cursor: grabbing; } .po-bin-item:active { cursor: grabbing; }
.po-bin-name { font-size: 13px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .po-bin-name {
font-size: 13px; color: var(--text-1);
/* Transport */ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
.po-transport {
display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
padding: 12px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px;
} }
/* Playlist */ /* ── Playlist ─────────────────────────────────────────────────────────────────── */
.po-playlist { .po-playlist {
border-radius: 12px; overflow: hidden; background: var(--bg-1); border: 1px solid var(--border);
min-height: 120px; border-radius: 10px; overflow: hidden;
min-height: 100px;
} }
.po-playlist-head { .po-playlist-head {
display: flex; align-items: center; gap: 10px; display: flex; align-items: center; gap: 10px;
padding: 8px 12px; border-bottom: 1px solid var(--border); padding: 8px 12px; border-bottom: 1px solid var(--border);
} }
.po-drop-err { font-size: 11px; color: var(--danger); } .po-drop-err { font-size: 11px; color: var(--danger); }
.po-playlist-empty { padding: 28px 12px; text-align: center; } .po-playlist-empty { padding: 24px 12px; text-align: center; color: var(--text-3); font-size: 13px; }
.po-pl-item { .po-pl-item {
position: relative; position: relative;
display: flex; align-items: center; gap: 10px; display: flex; align-items: center; gap: 10px;
padding: 9px 12px 13px; /* extra bottom padding for the staging bar */ padding: 9px 12px 13px;
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
cursor: grab; user-select: none; cursor: grab; user-select: none;
transition: background 0.1s;
} }
.po-pl-item:last-child { border-bottom: none; }
.po-pl-item:hover { background: var(--bg-3); } .po-pl-item:hover { background: var(--bg-3); }
.po-pl-item:active { cursor: grabbing; } .po-pl-item:active { cursor: grabbing; }
.po-pl-item--active { .po-pl-item--active {
background: color-mix(in srgb, var(--danger) 8%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent);
border-left: 3px solid var(--danger); border-left: 3px solid var(--danger);
} }
.po-pl-item--active:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); } .po-pl-item--active:hover {
background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.po-pl-index { .po-pl-index {
width: 22px; text-align: center; font-family: var(--font-mono); width: 22px; text-align: center; font-family: var(--font-mono);
font-size: 12px; color: var(--text-3); flex-shrink: 0; font-size: 12px; color: var(--text-3); flex-shrink: 0;
} }
.po-pl-onair { color: var(--danger); font-size: 11px; } .po-pl-onair { color: var(--danger); font-size: 11px; }
.po-pl-name { flex: 1; font-size: 13px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .po-pl-name {
.po-pl-dur { font-size: 11px; color: var(--text-3); flex-shrink: 0; min-width: 40px; text-align: right; } flex: 1; font-size: 13px; color: var(--text-1);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.po-pl-dur {
font-size: 11px; color: var(--text-3); flex-shrink: 0;
min-width: 40px; text-align: right;
font-variant-numeric: tabular-nums;
}
.po-pl-badge { flex-shrink: 0; } .po-pl-badge { flex-shrink: 0; }
/* Staging progress bar — sits flush at the bottom of each playlist item */ /* Staging progress bar */
.po-staging-bar { .po-staging-bar {
position: absolute; bottom: 0; left: 0; right: 0; height: 3px; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
} }
.po-staging-bar--pending { background: var(--text-3); opacity: 0.3; } .po-staging-bar--pending { background: var(--text-3); opacity: 0.25; }
.po-staging-bar--staging { .po-staging-bar--staging {
background: linear-gradient(90deg, transparent 0%, var(--warning) 50%, transparent 100%); background: linear-gradient(90deg, transparent 0%, var(--warning) 50%, transparent 100%);
background-size: 200% 100%; background-size: 200% 100%;
@ -141,26 +392,118 @@
} }
.po-staging-bar--ready { background: var(--success); opacity: 0.8; } .po-staging-bar--ready { background: var(--success); opacity: 0.8; }
.po-staging-bar--error { background: var(--danger); } .po-staging-bar--error { background: var(--danger); }
@keyframes po-staging-sweep { @keyframes po-staging-sweep {
0% { background-position: 200% 0; } 0% { background-position: 200% 0; }
100% { background-position: -200% 0; } 100% { background-position: -200% 0; }
} }
/* Playlist footer */ /* ── Timeline ─────────────────────────────────────────────────────────────────── */
.po-playlist-footer { .po-tl {
display: flex; justify-content: space-between; align-items: center; background: var(--bg-1); border: 1px solid var(--border);
padding: 8px 12px; border-top: 1px solid var(--border); border-radius: 10px; overflow: hidden;
font-size: 11px; color: var(--text-3); padding-bottom: 4px;
background: var(--bg-2); }
.po-tl-head {
display: flex; align-items: center; justify-content: space-between;
padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.po-tl-empty {
padding: 20px 12px; text-align: center; font-size: 12px; color: var(--text-3);
}
.po-tl-track-wrap {
position: relative; padding: 10px 12px 28px;
}
.po-tl-playhead {
position: absolute; top: 10px; bottom: 28px;
width: 2px; background: var(--danger);
z-index: 3; transform: translateX(-50%);
pointer-events: none;
}
.po-tl-playhead::before {
content: '';
position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 6px solid var(--danger);
}
.po-tl-track {
display: flex; height: 44px;
border-radius: 6px; overflow: hidden;
background: var(--bg-3);
gap: 1px;
}
.po-tl-clip {
position: relative; display: flex;
flex-direction: column; justify-content: center;
padding: 4px 6px; min-width: 0; overflow: hidden;
background: color-mix(in srgb, var(--clip-color, #3b82f6) 20%, var(--bg-2));
border-left: 2px solid var(--clip-color, #3b82f6);
cursor: default; transition: background 0.15s;
}
.po-tl-clip:hover {
background: color-mix(in srgb, var(--clip-color, #3b82f6) 30%, var(--bg-2));
}
.po-tl-clip--active {
background: color-mix(in srgb, var(--clip-color, #3b82f6) 35%, var(--bg-2));
border-left-color: var(--clip-color, #3b82f6);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--clip-color, #3b82f6) 50%, transparent);
}
.po-tl-clip-name {
font-size: 10px; font-weight: 600; color: var(--text-1);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.po-tl-clip-dur {
font-size: 9px; color: var(--text-3);
font-variant-numeric: tabular-nums;
}
.po-tl-staging-dot {
position: absolute; top: 3px; right: 4px;
width: 5px; height: 5px; border-radius: 50%;
background: var(--warning);
animation: po-staging-sweep 1s ease-in-out infinite alternate;
}
.po-tl-error-dot {
position: absolute; top: 3px; right: 4px;
width: 5px; height: 5px; border-radius: 50%;
background: var(--danger);
}
/* Time ruler */
.po-tl-ruler {
position: absolute; bottom: 4px; left: 12px; right: 12px; height: 18px;
}
.po-tl-ruler-mark {
position: absolute; font-size: 9px; color: var(--text-3);
transform: translateX(-50%);
white-space: nowrap;
font-variant-numeric: tabular-nums;
} }
.po-pl-total { color: var(--text-2); }
/* As-run log */ /* ── As-run drawer ────────────────────────────────────────────────────────────── */
.po-asrun { .po-drawer-backdrop {
display: flex; flex-direction: column; gap: 8px; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
padding: 12px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; z-index: 90; backdrop-filter: blur(2px);
} }
.po-drawer {
position: fixed; right: 0; top: 0; bottom: 0;
width: 420px; max-width: 95vw;
background: var(--bg-1); border-left: 1px solid var(--border);
display: flex; flex-direction: column;
z-index: 91;
transform: translateX(100%);
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: -4px 0 24px rgba(0,0,0,0.2);
}
.po-drawer--open { transform: translateX(0); }
.po-drawer-head {
display: flex; align-items: center;
padding: 14px 16px; border-bottom: 1px solid var(--border);
flex-shrink: 0;
gap: 4px;
}
.po-drawer-close { margin-left: auto; }
.po-drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
/* ── As-run table (shared by drawer) ─────────────────────────────────────────── */
.po-asrun-table { .po-asrun-table {
width: 100%; border-collapse: collapse; font-size: 12px; width: 100%; border-collapse: collapse; font-size: 12px;
} }
@ -168,19 +511,27 @@
text-align: left; font-weight: 600; color: var(--text-3); text-align: left; font-weight: 600; color: var(--text-3);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
padding: 4px 8px; border-bottom: 1px solid var(--border); padding: 4px 8px; border-bottom: 1px solid var(--border);
position: sticky; top: 0; background: var(--bg-1);
} }
.po-asrun-table td { .po-asrun-table td {
padding: 5px 8px; border-bottom: 1px solid var(--border); padding: 5px 8px; border-bottom: 1px solid var(--border);
color: var(--text-1); overflow: hidden; text-overflow: ellipsis; color: var(--text-1); overflow: hidden;
white-space: nowrap; max-width: 220px; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
} }
.po-asrun-table tr:last-child td { border-bottom: none; } .po-asrun-table tr:last-child td { border-bottom: none; }
.po-asrun-result { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; } .po-asrun-result {
font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.po-asrun-played { color: var(--success); } .po-asrun-played { color: var(--success); }
.po-asrun-skipped { color: var(--warning); } .po-asrun-skipped { color: var(--warning); }
.po-asrun-error { color: var(--danger); } .po-asrun-error { color: var(--danger); }
/* Downloads modal section header */ /* ── Utility overrides ───────────────────────────────────────────────────────── */
.btn.xs { padding: 2px 8px; font-size: 11px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.field-input.sm { padding: 5px 8px; font-size: 12px; }
/* Downloads modal section header (preserved from original) */
.downloads-section-head { .downloads-section-head {
display: flex; align-items: center; gap: 6px; display: flex; align-items: center; gap: 6px;
font-size: 11px; font-weight: 600; text-transform: uppercase; font-size: 11px; font-weight: 600; text-transform: uppercase;
@ -189,7 +540,19 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
/* Small button variants reused */ /* ── SCTE-35 additions (timeline marker + active-break line) ──────────────── */
.btn.xs { padding: 2px 8px; font-size: 11px; } .po-tl-scte-marker {
.btn.sm { padding: 5px 10px; font-size: 12px; } position: absolute; top: 10px; bottom: 28px;
.field-input.sm { padding: 5px 8px; font-size: 12px; } width: 0; border-left: 2px dashed #f59e0b;
z-index: 2; transform: translateX(-50%);
pointer-events: none;
}
.po-tl-scte-marker::before {
content: 'AD'; position: absolute; top: -2px; left: 2px;
font-size: 8px; font-weight: 800; letter-spacing: 0.06em; color: #f59e0b;
}
.po-scte-active {
padding: 6px 8px; border-radius: 6px;
background: color-mix(in srgb, #f59e0b 14%, transparent);
border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
}