refactor(viewer): modularize HLS playback tracking with per-panel state machine
CI / test (pull_request) Successful in 27s

Decompose monolithic wirePlaybackTracking() into single-responsibility modules:

- PanelState: per-panel playback state (phase, segments, buffer, quality)
- EventWiring: attaches hls.js + video element event listeners
- BufferMonitor: periodic buffer health check with timer lifecycle
- PanelRenderer: per-panel overlay rendering (phase, quality, segments)
- AggregateRenderer: global status bar aggregating all panel states
- PanelFactory: DOM panel creation + HLS/direct playback routing

Each module handles one concern: state tracking, event registration,
buffer monitoring, overlay rendering, aggregate rendering, or DOM creation.

Also fix: walk() dead code bug in m3u8DeepProbeFn where the string check
was unreachable behind the object-type guard.
This commit is contained in:
robot committed 2026-08-12 13:43:42 +00:00
1 parent a128babde0
commit bd093be652
4 files changed
+1351 -144

No files matched your search

+2 -1
View File
@@ -105,7 +105,7 @@ function m3u8DeepProbeFn() {
const seen = new Set();
function walk(obj, path, depth) {
if (!obj || typeof obj !== 'object' || depth > 5) return;
if (depth > 5) return;
if (typeof obj === 'string') {
const match = obj.match(/https?:\/\/[^"'\s`)]+\.m3u8[^"'\s`)]*/gi);
if (match) {
@@ -115,6 +115,7 @@ function m3u8DeepProbeFn() {
}
return;
}
if (!obj || typeof obj !== 'object') return;
for (const k of Object.keys(obj)) {
walk(obj[k], `${path}.${k}`, depth + 1);
}