diff --git a/api.go b/api.go index 11b28bc..ef1ffd8 100644 --- a/api.go +++ b/api.go @@ -479,11 +479,17 @@ func (s *Server) handleRecordings(w http.ResponseWriter, r *http.Request) { } name := entry.Name() - // Only process rec_*.mp4 files (not snap_*.jpg). + // Only process completed rec_*.mp4 files (not snap_*.jpg). if !strings.HasPrefix(name, "rec_") || !strings.HasSuffix(strings.ToLower(name), ".mp4") { continue } + // Skip in-progress segments. FFmpeg only writes the MP4 index (moov) + // when it finalizes the file, so a .part.mp4 cannot be played yet. + if strings.HasSuffix(strings.ToLower(name), ".part.mp4") { + continue + } + info, statErr := entry.Info() if statErr != nil { continue diff --git a/public/index.html b/public/index.html index 73ed87d..8ce18b9 100644 --- a/public/index.html +++ b/public/index.html @@ -51,7 +51,7 @@