Probe video durations at scan time

Parse the mp4 mvhd box in pure PHP (ffprobe fallback) for videos with no
stored duration, so folder listings show durations before first play.
This commit is contained in:
Harwinder Sekhon
2026-07-11 11:38:41 -04:00
parent c6a970880c
commit 45e7465f7b
2 changed files with 101 additions and 2 deletions
+4 -2
View File
@@ -106,8 +106,10 @@ attempt, and quiz scores count toward folder progress alongside videos.
Completion is sticky — rewatching doesn't un-complete it.
- Folder progress is computed over the folder's entire subtree using a path
prefix match, with partial credit for videos in progress.
- Video duration is captured from the browser on first play (no ffprobe
dependency) and cached on the `videos` row.
- Video duration is read at scan time by parsing the mp4's `mvhd` header in
pure PHP (ffprobe fallback if the parse fails), so listings show durations
before anyone plays the video. The browser still reports the duration on
first play as a last-resort fallback.
## Production notes