fix(viewer): fallback to src as HLS manifest when hlsManifest is missing
CI / test (pull_request) Successful in 19s
CI / test (pull_request) Successful in 19s
When mediaType=hls but hlsManifest field is absent (e.g. lost during storage serialization), fall back to src if it looks like a manifest URL (.m3u8 with http scheme). This prevents the video from silently failing to play on Chrome where there is no native HLS support.
This commit is contained in:
1 parent
02498f2694
commit
11e697915e
1 file changed
+20
-11
+20
-11
@@ -642,18 +642,27 @@ function createPanel(entry, tag) {
|
||||
|
||||
if (poster) video.poster = poster;
|
||||
|
||||
if (mediaType === 'hls' && hlsManifest) {
|
||||
video.dataset.hlsManifest = hlsManifest;
|
||||
video.dataset.mediaType = 'hls';
|
||||
console.log('[goon-viewer] HLS detected, manifest:', hlsManifest);
|
||||
panel.appendChild(video);
|
||||
if (tag) {
|
||||
const label = document.createElement('div');
|
||||
label.className = 'panel-label';
|
||||
label.textContent = tag;
|
||||
panel.appendChild(label);
|
||||
if (mediaType === 'hls') {
|
||||
// Use explicit hlsManifest field, or fall back to src if it looks like a manifest URL.
|
||||
// This handles the case where hlsManifest was lost in storage serialization but src
|
||||
// still points to the .m3u8 playlist.
|
||||
const manifestUrl = hlsManifest || (src.includes('.m3u8') && src.startsWith('http') ? src : null);
|
||||
if (manifestUrl) {
|
||||
video.dataset.hlsManifest = manifestUrl;
|
||||
video.dataset.mediaType = 'hls';
|
||||
console.log('[goon-viewer] HLS detected, manifest:', manifestUrl);
|
||||
panel.appendChild(video);
|
||||
if (tag) {
|
||||
const label = document.createElement('div');
|
||||
label.className = 'panel-label';
|
||||
label.textContent = tag;
|
||||
panel.appendChild(label);
|
||||
}
|
||||
return { panel, hlsEntry: { video, manifest: manifestUrl, panel } };
|
||||
}
|
||||
return { panel, hlsEntry: { video, manifest: hlsManifest, panel } };
|
||||
// mediaType says HLS but we have no manifest URL — fall through to native playback.
|
||||
// On Safari this may still work for .m3u8; on Chrome it will fail.
|
||||
console.warn('[goon-viewer] HLS entry missing manifest URL, src:', src);
|
||||
}
|
||||
|
||||
video.src = src;
|
||||
|
||||
Reference in new issue
Block a user