feat: remember playback progress across player restarts
Persist authoritative per-video positions in UserDefaults. Save periodic checkpoints, pause, close, replacement, and quit; restore a validated position before autoplay. Canonical YouTube webpage URLs survive fresh stream extraction, and local symlinks share file progress. Clear completed or out-of-duration bookmarks. Leave failed opens and live/non-seekable inputs out of persistence. Pending opens hide errors belonging to the previous source. Verified separate-process restart, source replacement, failed-open recovery, completion, checkpoints, real YouTube short-link resume, live exclusion, and make all check.
This commit is contained in:
@@ -7,10 +7,10 @@ ARCH := $(shell uname -m)
|
||||
CXXFLAGS := -std=c++20 -mmacosx-version-min=15.0 -O2 -g -Wall -Wextra -Wno-unused-parameter $(FF_CFLAGS)
|
||||
FRAMEWORKS := -framework AppKit -framework AudioToolbox -framework CoreAudio -framework Metal -framework MetalKit -framework QuartzCore
|
||||
OBJECTS := .build/player.o .build/Output.o
|
||||
SWIFT_SOURCES := Sources/App/TerebiApp.swift Sources/App/CompactWindow.swift Sources/App/YouTubeResolver.swift
|
||||
SWIFT_SOURCES := Sources/App/TerebiApp.swift Sources/App/CompactWindow.swift Sources/App/YouTubeResolver.swift Sources/App/PlaybackProgress.swift
|
||||
APP := .build/terebi.app
|
||||
|
||||
.PHONY: all run check check-fixtures check-audio check-window check-youtube check-network
|
||||
.PHONY: all run check check-fixtures check-audio check-window check-youtube check-network check-progress
|
||||
all: $(APP)/Contents/MacOS/terebi $(APP)/Contents/Info.plist
|
||||
|
||||
.build:
|
||||
@@ -36,7 +36,7 @@ run: all
|
||||
.build/playback-check: Checks/playback.mm $(OBJECTS) Makefile
|
||||
$(CXX) $(CXXFLAGS) -fobjc-arc $< $(OBJECTS) $(FF_LIBS) $(FRAMEWORKS) -o $@
|
||||
|
||||
check: .build/playback-check check-fixtures check-audio check-window check-youtube check-network
|
||||
check: .build/playback-check check-fixtures check-audio check-window check-youtube check-network check-progress
|
||||
.build/playback-check .build/fixtures
|
||||
|
||||
check-fixtures:
|
||||
@@ -90,3 +90,9 @@ check-network: .build/network-playback-check check-fixtures
|
||||
ffmpeg -hide_banner -loglevel error -y -f lavfi -i testsrc2=size=320x180:rate=24 -f lavfi -i sine=frequency=440:sample_rate=44100 -t 30 -c:v mpeg4 -q:v 2 -bf 2 -c:a aac -movflags +faststart .build/fixtures/streaming.mp4
|
||||
ffmpeg -hide_banner -loglevel error -y -i .build/fixtures/av.mp4 -c:v libx264 -g 24 -keyint_min 24 -sc_threshold 0 -c:a aac -hls_time 1 -hls_playlist_type vod -hls_segment_filename .build/fixtures/network-vod-%d.ts .build/fixtures/network-vod.m3u8
|
||||
python3 Checks/streaming.py .build/network-playback-check .build/fixtures
|
||||
|
||||
.build/playback-progress-check: Checks/playback-progress.swift Sources/App/PlaybackProgress.swift Makefile | .build
|
||||
$(SWIFT) -target $(ARCH)-apple-macosx15.0 -swift-version 6 -parse-as-library -O -g Checks/playback-progress.swift Sources/App/PlaybackProgress.swift -framework Foundation -o $@
|
||||
|
||||
check-progress: .build/playback-progress-check
|
||||
.build/playback-progress-check
|
||||
|
||||
Reference in New Issue
Block a user