playlist timer pause/resume without affecting active feeds

This commit is contained in:
Dmitry Sergeev
2026-09-01 22:32:19 +03:00
parent b0e7bc4cc3
commit ca25bf88a7
11 changed files with 371 additions and 28 deletions
+14 -3
View File
@@ -111,6 +111,14 @@ func (p *playerPlaylist) Previous() bool {
return p.enqueue(playback.PlaylistCommand{Kind: playback.PlaylistPrevious})
}
func (p *playerPlaylist) Pause() bool {
return p.enqueue(playback.PlaylistCommand{Kind: playback.PlaylistPause})
}
func (p *playerPlaylist) Resume() bool {
return p.enqueue(playback.PlaylistCommand{Kind: playback.PlaylistResume})
}
func (p *playerPlaylist) enqueue(command playback.PlaylistCommand) bool {
select {
case p.Commands <- command:
@@ -154,11 +162,14 @@ func playlistTimingProgress(
if timing.Expired {
return 1, 0
}
if !timing.Started {
remaining := timing.Remaining
if timing.Paused {
// Retain the remaining time captured when the owned timer stopped.
} else if !timing.Started {
return 0, timing.Duration
} else {
remaining = timing.Deadline.Sub(now)
}
remaining := timing.Deadline.Sub(now)
if remaining < 0 {
remaining = 0
}