You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Seeking to EOF does not update state to .ended, causing play/pause controls to stall #164
When scrubbing or programmatically seeking directly to the end of a VOD media stream (seek(to: duration)), AetherEngine's state does not automatically transition to .ended or .paused. Instead, engine.state remains .playing, causing downstream UI wrappers (such as ZeoPlayerView or custom media controls) to remain stuck on the "Pause" state. Subsequent calls to play() or togglePlayPause() at EOF fail to respond or resume playback because the engine does not automatically seek back to 0.
Expected Behavior
When seeking to or near EOF (targetTime >= duration), AetherEngine should transition its state / playbackPhase to .ended (or .paused) and publish the state update to subscribers.
Invoking play() or togglePlayPause() when the engine is at .ended / EOF should automatically perform an internal seek back to 0.0 seconds before starting playback.
Actual Behavior
Seeking to EOF leaves engine.state set to .playing.
Calling play() or togglePlayPause() while at EOF results in no response (the player remains frozen on the final frame).
Suggested Fix / Implementation Idea
Seek Completion Handling: In seek(to:) completion, verify the landed time / target time. If targetTime >= duration - 0.1 (or at EOF), pause the internal rendering pipeline and update state to .ended.
Auto-rewind on Replay: In play() / togglePlayPause(), check if state == .ended or if the playhead is at EOF. If so, perform an internal seek(to: 0) before setting playback rate to 1.0.
Root cause: a programmatic seek(to: duration) never fires AVPlayerItem.didPlayToEndTime (that notification only fires when playback reaches the end on its own), so the seek settled the engine to a phantom .playing while AVPlayer sat parked, frozen on the final frame. And because AVPlayer.play() at end-of-media is itself a no-op, the transport controls then had no way to resume.
I took a slightly different route than the two suggestions, for one important reason:
.ended is a terminal state with a deliberate contract (#63). Hosts run their end-of-playback handling off it (mark-watched, autoplay-next, dismiss), and in that state seek() / togglePlayPause() are intentional no-ops so a play press racing an "up next" card cannot silently revive a finished session. Firing .ended on a manual scrub-to-end would misfire all of that, and being terminal it would also strand the playhead with no way to scrub back.
So instead:
Seeking a VOD to (or past) the end now parks it at .paused: honest (nothing is playing), non-terminal (the scrubber stays live, you can scrub back), and replayable.
play() / togglePlayPause() now rewind to 0 before resuming when the playhead is parked at end-of-media, so the button works exactly as you expected.
.ended (organic completion) stays unchanged.
Net effect matches your expected behavior (the state no longer stays stuck reporting "playing", and play resumes from the start), while keeping the finished-session semantics intact. Covered by SeekToEndOfMediaTests.
If you get a chance to retest on 5.15.3 with ZeoPlayerView / your custom controls, let me know how it behaves on your side.
Activity
superuser404notfound commentedon Jul 20, 2026
Fixed in 5.15.3.
Root cause: a programmatic
seek(to: duration)never firesAVPlayerItem.didPlayToEndTime(that notification only fires when playback reaches the end on its own), so the seek settled the engine to a phantom.playingwhile AVPlayer sat parked, frozen on the final frame. And becauseAVPlayer.play()at end-of-media is itself a no-op, the transport controls then had no way to resume.I took a slightly different route than the two suggestions, for one important reason:
.endedis a terminal state with a deliberate contract (#63). Hosts run their end-of-playback handling off it (mark-watched, autoplay-next, dismiss), and in that stateseek()/togglePlayPause()are intentional no-ops so a play press racing an "up next" card cannot silently revive a finished session. Firing.endedon a manual scrub-to-end would misfire all of that, and being terminal it would also strand the playhead with no way to scrub back.So instead:
.paused: honest (nothing is playing), non-terminal (the scrubber stays live, you can scrub back), and replayable.play()/togglePlayPause()now rewind to0before resuming when the playhead is parked at end-of-media, so the button works exactly as you expected..ended(organic completion) stays unchanged.Net effect matches your expected behavior (the state no longer stays stuck reporting "playing", and play resumes from the start), while keeping the finished-session semantics intact. Covered by
SeekToEndOfMediaTests.If you get a chance to retest on 5.15.3 with ZeoPlayerView / your custom controls, let me know how it behaves on your side.
fix(transport): park VOD seek-to-EOF at .paused and rewind on replay (s…
jihongboo commentedon Jul 22, 2026
After checking, the issue has been resolved. Thank you.