feat(hls): return type='hls' in stream endpoint and add audio sync placeholders in editor
This commit is contained in:
parent
a1b8211ea1
commit
d58982ad18
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) {
|
if (a.hls_s3_key) {
|
||||||
return res.json({
|
return res.json({
|
||||||
url: `/api/v1/assets/${id}/video`,
|
url: `/api/v1/assets/${id}/video`,
|
||||||
type: 'mp4',
|
type: 'hls',
|
||||||
source: a.proxy_s3_key ? 'proxy' : 'original',
|
source: a.proxy_s3_key ? 'proxy' : 'original',
|
||||||
hls_url: `/api/v1/assets/${id}/hls/playlist.m3u8`,
|
hls_url: `/api/v1/assets/${id}/hls/playlist.m3u8`,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -647,8 +647,14 @@ function ProgramMonitor({ videoRef, currentSeq, playheadFrames, setPlayheadFrame
|
||||||
if (vid) vid.pause();
|
if (vid) vid.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Audio track refs for playback
|
||||||
|
const pgmAudioRefs = React.useRef([]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
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];
|
const clip = pgmClips[pgmClipIdx];
|
||||||
if (!clip) { stopPgm(); return; }
|
if (!clip) { stopPgm(); return; }
|
||||||
const vid = videoRef.current;
|
const vid = videoRef.current;
|
||||||
|
|
@ -676,6 +682,14 @@ function ProgramMonitor({ videoRef, currentSeq, playheadFrames, setPlayheadFrame
|
||||||
}
|
}
|
||||||
vid.load();
|
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);
|
const srcInSecs = clip.source_in_frames / (window.TC ? window.TC.FPS : 59.94);
|
||||||
vid.currentTime = srcInSecs;
|
vid.currentTime = srcInSecs;
|
||||||
vid.play().catch(() => {});
|
vid.play().catch(() => {});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue