From d58982ad18eccb34497fbd85272fe09de33bb4ab Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Wed, 3 Jun 2026 04:18:29 +0000 Subject: [PATCH] feat(hls): return type='hls' in stream endpoint and add audio sync placeholders in editor --- services/mam-api/src/routes/assets.js | 2 +- services/web-ui/public/screens-editor.jsx | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/services/mam-api/src/routes/assets.js b/services/mam-api/src/routes/assets.js index 8e3463d..81b20c7 100644 --- a/services/mam-api/src/routes/assets.js +++ b/services/mam-api/src/routes/assets.js @@ -674,7 +674,7 @@ router.get('/:id/stream', async (req, res, next) => { if (a.hls_s3_key) { return res.json({ url: `/api/v1/assets/${id}/video`, - type: 'mp4', + type: 'hls', source: a.proxy_s3_key ? 'proxy' : 'original', hls_url: `/api/v1/assets/${id}/hls/playlist.m3u8`, }); diff --git a/services/web-ui/public/screens-editor.jsx b/services/web-ui/public/screens-editor.jsx index 49c7145..b490096 100644 --- a/services/web-ui/public/screens-editor.jsx +++ b/services/web-ui/public/screens-editor.jsx @@ -647,8 +647,14 @@ function ProgramMonitor({ videoRef, currentSeq, playheadFrames, setPlayheadFrame if (vid) vid.pause(); } + // Audio track refs for playback + const pgmAudioRefs = React.useRef([]); + React.useEffect(() => { - if (!pgmPlaying || pgmClipIdx < 0 || pgmClipIdx >= pgmClips.length) return; + if (!pgmPlaying || pgmClipIdx < 0 || pgmClipIdx >= pgmClips.length) { + pgmAudioRefs.current.forEach(a => a.pause()); + return; + } const clip = pgmClips[pgmClipIdx]; if (!clip) { stopPgm(); return; } const vid = videoRef.current; @@ -676,6 +682,14 @@ function ProgramMonitor({ videoRef, currentSeq, playheadFrames, setPlayheadFrame } vid.load(); } + + // Sync audio tracks (A1/A2) + const asset = assetsRef.current.find(a => a.id === clip.asset_id); + if (asset && asset.media_type === 'video') { + // For now, simple video-track audio. Multi-track A1/A2 wiring planned. + vid.muted = false; + } + const srcInSecs = clip.source_in_frames / (window.TC ? window.TC.FPS : 59.94); vid.currentTime = srcInSecs; vid.play().catch(() => {});