mirror of
https://github.com/yattee/yattee.git
synced 2026-08-05 23:01:28 +00:00
Fix autoplay countdown showing in repeat one queue mode
When queue mode was set to repeat one, the "Playing in N seconds" countdown still appeared after a video ended, showing the next queued video - then restarting the current one anyway. The video-end path never consulted the queue mode; only playNext() did, after the countdown had already run. - PlayerService.backendDidFinishPlaying: restart immediately in repeat one mode, regardless of queue contents, player visibility, background, or PiP. This also fixes repeat one never looping with an empty queue. - ExpandedPlayerSheet.isAutoPlayEnabled: false in repeat one mode, which gates all countdown triggers (start on ended, overlay render, re-arm on appear) on iOS/macOS. - TVPlayerView.handleVideoEnded: early-return in repeat one mode so tvOS shows neither the countdown nor the replay controls.
This commit is contained in:
@@ -3126,6 +3126,15 @@ extension PlayerService: PlayerBackendDelegate {
|
|||||||
saveProgressAsCompleted()
|
saveProgressAsCompleted()
|
||||||
delegate?.playerServiceDidFinishPlaying(self)
|
delegate?.playerServiceDidFinishPlaying(self)
|
||||||
|
|
||||||
|
// Repeat one: restart immediately - no countdown, independent of queue contents
|
||||||
|
// and the auto-play-next setting (that setting governs advancing to the next video)
|
||||||
|
if state.queueMode == .repeatOne {
|
||||||
|
Task {
|
||||||
|
await playNext()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-play immediately if player is not visible (no point showing countdown)
|
// Auto-play immediately if player is not visible (no point showing countdown)
|
||||||
// UI (ExpandedPlayerSheet) will handle countdown when player is visible
|
// UI (ExpandedPlayerSheet) will handle countdown when player is visible
|
||||||
let autoPlayEnabled = settingsManager?.queueAutoPlayNext ?? true
|
let autoPlayEnabled = settingsManager?.queueAutoPlayNext ?? true
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ struct ExpandedPlayerSheet: View {
|
|||||||
|
|
||||||
var isAutoPlayEnabled: Bool {
|
var isAutoPlayEnabled: Bool {
|
||||||
(appEnvironment?.settingsManager.queueEnabled ?? true) &&
|
(appEnvironment?.settingsManager.queueEnabled ?? true) &&
|
||||||
(appEnvironment?.settingsManager.queueAutoPlayNext ?? true)
|
(appEnvironment?.settingsManager.queueAutoPlayNext ?? true) &&
|
||||||
|
playerState?.queueMode != .repeatOne
|
||||||
}
|
}
|
||||||
|
|
||||||
var autoPlayCountdownDuration: Int {
|
var autoPlayCountdownDuration: Int {
|
||||||
|
|||||||
@@ -1046,6 +1046,11 @@ struct TVPlayerView: View {
|
|||||||
controlsVisible = false
|
controlsVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repeat one: PlayerService restarts the video itself - no countdown, no replay controls
|
||||||
|
if playerState?.queueMode == .repeatOne {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Check if autoplay is enabled and there's a next video
|
// Check if autoplay is enabled and there's a next video
|
||||||
let autoPlayEnabled = appEnvironment?.settingsManager.queueAutoPlayNext ?? true
|
let autoPlayEnabled = appEnvironment?.settingsManager.queueAutoPlayNext ?? true
|
||||||
let hasNextVideo = playerState?.hasNext ?? false
|
let hasNextVideo = playerState?.hasNext ?? false
|
||||||
|
|||||||
Reference in New Issue
Block a user