fix: pick HLS player when index.m3u8 exists, not from DefaultVideo refs #4757

Closed events that have already had their DefaultVideo column rewritten to
the renamed mp4 (every event recorded before the C++ fix landed) need a
client-side fallback so the HLS player still gets picked up. Treat the
on-disk index.m3u8 as the source of truth for HLS availability and gate
on the codec choice — auto / MP4 / MP4HLS all use HLS when the manifest is
there; MJPEG and any other explicit non-video choice keep the old behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Isaac ConnorandClaude Opus 4.7 committed 2026-05-15 23:54:40 -04:00
1 parent 47d3af70c7
commit 10a4f9af13
1 file changed
+7 -3
+7 -3
View File
@@ -354,9 +354,13 @@ if (file_exists($Event->Path().'/objdetect.jpg')) {
<div id="zoompan" class="zoompan">
<?php
if ($video_tag) {
// Use HLS byte-range playback if m3u8 manifest exists on disk
$has_hls = (($codec == 'MP4HLS') || str_ends_with($Event->DefaultVideo(), '.m3u8'))
&& file_exists($Event->Path() . '/index.m3u8');
// Prefer HLS byte-range playback whenever the manifest exists on disk and the
// user hasn't explicitly opted into a non-HLS playback mode. Closed events
// have DefaultVideo rewritten to the renamed mp4, so checking the file system
// is what catches them.
$has_hls = file_exists($Event->Path() . '/index.m3u8')
&& (($codec == 'MP4HLS') || ($codec == 'MP4') || ($codec == 'auto')
|| str_ends_with($Event->DefaultVideo(), '.m3u8'));
if ($has_hls) {
$Server = $Event->Server();
$hlsSrc = $Server->PathToIndex() . '?view=view_hls&amp;eid=' . $Event->Id();