HLS VOD playback for browser (supplements MP4 proxy) #170
2 changed files with 16 additions and 2 deletions
|
|
@ -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`,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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(() => {});
|
||||
|
|
|
|||
Loading…
Reference in a new issue