Merge branch 'feat/walker-cache-seek-marker'
@@ -175,7 +175,7 @@
175
175
- Standalone public share page served at /share/:token; no auth required.
176
176
- Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
177
177
- tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
178
- Share video preview - Uses the shared browser video-player helper used by app previews: VOD UI enforcement, long forward buffer, forced caption overrides (text background opacity transparent + text edge style uniform), subtitle/audio track restore/save by matching track names, image-subtitle overlay support, background stream-ahead prefetch (session playlist/variant/segment fetches continue towards video end while playback reads cache), service-worker-backed HLS segment cache enablement during playback (with per-session cache cleanup on close), and explicit backend session release on unload.
178
- Share video preview - Uses the shared browser video-player helper used by app previews: VOD UI enforcement, long forward buffer, forced caption overrides (text background opacity transparent + text edge style uniform), subtitle/audio track restore/save by matching track names, image-subtitle overlay support, background stream-ahead prefetch (session playlist/variant/segment fetches continue towards video end while playback reads cache), seek-bar cache frontier marker (`:`) for walker progress, service-worker-backed HLS segment cache enablement during playback (with per-session cache cleanup on close), and explicit backend session release on unload.
179
179
- Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
180
180
- Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
181
181
@@ -183,13 +183,14 @@
183
183
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
184
184
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
185
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
186
- bindStreamAheadPrefetch(opts) - Starts a background HLS walker that repeatedly fetches the session playlist, discovers variant playlists and media segments, and prefetches those assets into the browser cache so playback can read already-fetched segments while the backend prunes old files; returns a controller with stop()/done().
186
- bindStreamAheadPrefetch(opts) - Starts a background HLS walker that repeatedly fetches the session playlist, discovers variant playlists and media segments, and prefetches those assets into the browser cache so playback can read already-fetched segments while the backend prunes old files; tracks cached-through timeline progress and returns a controller with stop()/done()/getStatus()/subscribe().
187
- bindStreamAheadSeekMarker(player, streamAheadPrefetch, opts) - Renders a non-interactive `:` marker on the playback seek bar showing how far the stream-ahead walker has cached through the timeline; subscribes to walker progress updates and removes itself on detach.
187
188
- enableVideoStreamClientCache() - Registers a shared service worker (`/stream-cache-sw.js`) that caches HLS playlist/segment responses so already-downloaded stream assets remain playable on rewind after server-side segment pruning.
188
189
- clearVideoStreamClientCache(playlistUrl) - Best-effort cache cleanup helper that removes cached HLS entries for one stream session when preview playback is closed.
189
190
190
191
## public/stream-cache-sw.js
191
192
- fetch handler - Caches successful segment/init GET responses for `/api/files/video-stream/*` and `/api/share/video-stream/*` (`.ts/.m4s/.mp4/.aac/.vtt`), intentionally skips `.m3u8` manifests to avoid stale-playlist seek regressions, warms full-body cache entries when playback uses byte-range requests, and can synthesize 206 partial responses from cached full segments so backward seeks keep working after server-side prune.
192
- configureVideoJsBuffering(videojs, opts) - Applies the long forward-buffer settings used for file playback when VHS exposes those knobs.
193
- configureVideoJsBuffering(videojs, opts) - Applies long forward-buffer settings used for file playback when VHS exposes those knobs (goal/max goal plus low-water-line thresholds) so clients keep larger forward buffers before needing network fetches.
193
194
- ensureVideoPlaybackUi(player, durationSeconds) - Forces file streams into VOD UI mode, normalises the reported duration, stops live-tracker state, and hides the live badge when present.
194
195
195
196
## public/index.html
@@ -175,7 +175,7 @@175
- Standalone public share page served at /share/:token; no auth required.
175
- Standalone public share page served at /share/:token; no auth required.
176
- Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
176
- Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
177
- tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
177
- tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
178
- Share video preview - Uses the shared browser video-player helper used by app previews: VOD UI enforcement, long forward buffer, forced caption overrides (text background opacity transparent + text edge style uniform), subtitle/audio track restore/save by matching track names, image-subtitle overlay support, background stream-ahead prefetch (session playlist/variant/segment fetches continue towards video end while playback reads cache), service-worker-backed HLS segment cache enablement during playback (with per-session cache cleanup on close), and explicit backend session release on unload.
178
- Share video preview - Uses the shared browser video-player helper used by app previews: VOD UI enforcement, long forward buffer, forced caption overrides (text background opacity transparent + text edge style uniform), subtitle/audio track restore/save by matching track names, image-subtitle overlay support, background stream-ahead prefetch (session playlist/variant/segment fetches continue towards video end while playback reads cache), seek-bar cache frontier marker (`:`) for walker progress, service-worker-backed HLS segment cache enablement during playback (with per-session cache cleanup on close), and explicit backend session release on unload.
179
- Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
179
- Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
180
- Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
180
- Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
181
181
@@ -183,13 +183,14 @@183
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
183
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
184
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
184
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
186
- bindStreamAheadPrefetch(opts) - Starts a background HLS walker that repeatedly fetches the session playlist, discovers variant playlists and media segments, and prefetches those assets into the browser cache so playback can read already-fetched segments while the backend prunes old files; returns a controller with stop()/done().
186
- bindStreamAheadPrefetch(opts) - Starts a background HLS walker that repeatedly fetches the session playlist, discovers variant playlists and media segments, and prefetches those assets into the browser cache so playback can read already-fetched segments while the backend prunes old files; tracks cached-through timeline progress and returns a controller with stop()/done()/getStatus()/subscribe().
187
- bindStreamAheadSeekMarker(player, streamAheadPrefetch, opts) - Renders a non-interactive `:` marker on the playback seek bar showing how far the stream-ahead walker has cached through the timeline; subscribes to walker progress updates and removes itself on detach.
187
- enableVideoStreamClientCache() - Registers a shared service worker (`/stream-cache-sw.js`) that caches HLS playlist/segment responses so already-downloaded stream assets remain playable on rewind after server-side segment pruning.
188
- enableVideoStreamClientCache() - Registers a shared service worker (`/stream-cache-sw.js`) that caches HLS playlist/segment responses so already-downloaded stream assets remain playable on rewind after server-side segment pruning.
188
- clearVideoStreamClientCache(playlistUrl) - Best-effort cache cleanup helper that removes cached HLS entries for one stream session when preview playback is closed.
189
- clearVideoStreamClientCache(playlistUrl) - Best-effort cache cleanup helper that removes cached HLS entries for one stream session when preview playback is closed.
189
190
190
## public/stream-cache-sw.js
191
## public/stream-cache-sw.js
191
- fetch handler - Caches successful segment/init GET responses for `/api/files/video-stream/*` and `/api/share/video-stream/*` (`.ts/.m4s/.mp4/.aac/.vtt`), intentionally skips `.m3u8` manifests to avoid stale-playlist seek regressions, warms full-body cache entries when playback uses byte-range requests, and can synthesize 206 partial responses from cached full segments so backward seeks keep working after server-side prune.
192
- fetch handler - Caches successful segment/init GET responses for `/api/files/video-stream/*` and `/api/share/video-stream/*` (`.ts/.m4s/.mp4/.aac/.vtt`), intentionally skips `.m3u8` manifests to avoid stale-playlist seek regressions, warms full-body cache entries when playback uses byte-range requests, and can synthesize 206 partial responses from cached full segments so backward seeks keep working after server-side prune.
192
- configureVideoJsBuffering(videojs, opts) - Applies the long forward-buffer settings used for file playback when VHS exposes those knobs.
193
- configureVideoJsBuffering(videojs, opts) - Applies long forward-buffer settings used for file playback when VHS exposes those knobs (goal/max goal plus low-water-line thresholds) so clients keep larger forward buffers before needing network fetches.
193
- ensureVideoPlaybackUi(player, durationSeconds) - Forces file streams into VOD UI mode, normalises the reported duration, stops live-tracker state, and hides the live badge when present.
194
- ensureVideoPlaybackUi(player, durationSeconds) - Forces file streams into VOD UI mode, normalises the reported duration, stops live-tracker state, and hides the live badge when present.
194
195
195
## public/index.html
196
## public/index.html
@@ -476,6 +476,13 @@ function bindStreamAheadPrefetch (playlistUrl)
476
476
});
477
477
}
478
478
479
function bindStreamAheadSeekMarker (player, streamAheadPrefetch)
480
{
481
const shared = sharedVideoPlayer();
482
if (!shared || typeof shared.bindStreamAheadSeekMarker !== 'function') return null;
483
return shared.bindStreamAheadSeekMarker(player, streamAheadPrefetch);
484
}
485
479
486
async function reportWatchProgress (filePath, progress)
480
487
{
481
488
if (!filePath || !Number.isFinite(progress)) return;
@@ -3978,6 +3985,7 @@ async function renderStreamedVideoPreview (item, targetEl)
3978
3985
});
3979
3986
3980
3987
const trackPrefs = bindUserVideoTrackPrefs(player, prefs);
3988
const streamAheadSeekMarker = bindStreamAheadSeekMarker(player, streamAheadPrefetch);
3981
3989
3982
3990
ensureVideoPlaybackUi(player, session.durationSeconds);
3983
3991
const imageSubtitleController = bindImageSubtitleOverlay(player, videojs, prefs, session, item);
@@ -4063,6 +4071,7 @@ async function renderStreamedVideoPreview (item, targetEl)
4063
4071
try { imageSubtitleController.captureSelectedTracks(); } catch { /* ignore */ }
4064
4072
try { imageSubtitleController.detach(); } catch { /* ignore */ }
4065
4073
}
4074
try { streamAheadSeekMarker && streamAheadSeekMarker.detach(); } catch { /* ignore */ }
4066
4075
try { streamAheadPrefetch && streamAheadPrefetch.stop(); } catch { /* ignore */ }
4067
4076
void clearVideoStreamClientCache(sessionPlaylistUrl);
4068
4077
releaseActivePreviewVideoStreamSession();
@@ -476,6 +476,13 @@ function bindStreamAheadPrefetch (playlistUrl)476
});476
});477
}477
}478
478
479
function bindStreamAheadSeekMarker (player, streamAheadPrefetch)480
{481
const shared = sharedVideoPlayer();482
if (!shared || typeof shared.bindStreamAheadSeekMarker !== 'function') return null;483
return shared.bindStreamAheadSeekMarker(player, streamAheadPrefetch);484
}485
479
async function reportWatchProgress (filePath, progress)486
async function reportWatchProgress (filePath, progress)480
{487
{481
if (!filePath || !Number.isFinite(progress)) return;488
if (!filePath || !Number.isFinite(progress)) return;@@ -3978,6 +3985,7 @@ async function renderStreamedVideoPreview (item, targetEl)3978
});3985
});3979
3986
3980
const trackPrefs = bindUserVideoTrackPrefs(player, prefs);3987
const trackPrefs = bindUserVideoTrackPrefs(player, prefs);3988
const streamAheadSeekMarker = bindStreamAheadSeekMarker(player, streamAheadPrefetch);3981
3989
3982
ensureVideoPlaybackUi(player, session.durationSeconds);3990
ensureVideoPlaybackUi(player, session.durationSeconds);3983
const imageSubtitleController = bindImageSubtitleOverlay(player, videojs, prefs, session, item);3991
const imageSubtitleController = bindImageSubtitleOverlay(player, videojs, prefs, session, item);@@ -4063,6 +4071,7 @@ async function renderStreamedVideoPreview (item, targetEl)4063
try { imageSubtitleController.captureSelectedTracks(); } catch { /* ignore */ }4071
try { imageSubtitleController.captureSelectedTracks(); } catch { /* ignore */ }4064
try { imageSubtitleController.detach(); } catch { /* ignore */ }4072
try { imageSubtitleController.detach(); } catch { /* ignore */ }4065
}4073
}4074
try { streamAheadSeekMarker && streamAheadSeekMarker.detach(); } catch { /* ignore */ }4066
try { streamAheadPrefetch && streamAheadPrefetch.stop(); } catch { /* ignore */ }4075
try { streamAheadPrefetch && streamAheadPrefetch.stop(); } catch { /* ignore */ }4067
void clearVideoStreamClientCache(sessionPlaylistUrl);4076
void clearVideoStreamClientCache(sessionPlaylistUrl);4068
releaseActivePreviewVideoStreamSession();4077
releaseActivePreviewVideoStreamSession();