playlist timer pause/resume without affecting active feeds
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user