Keep offset when taking over playback with roll v2 (#1184)

* pass on offset

* account for offset in roll

* prevent roll from overtime

* add test
This commit is contained in:
Alex Christoffer Rasmussen
2024-08-26 18:09:03 +02:00
committed by GitHub
parent 1b1823e0fe
commit ee1b5b7fdd
8 changed files with 160 additions and 51 deletions
@@ -1,13 +1,13 @@
import { Playback } from 'ontime-types';
import { Playback, TimerPhase } from 'ontime-types';
/**
* Simple rules to determine whether a playback action is valid
*/
export function validatePlayback(currentPlayback: Playback) {
export function validatePlayback(currentPlayback: Playback, timerPhase: TimerPhase) {
return {
start: currentPlayback !== Playback.Stop,
pause: currentPlayback === Playback.Play,
roll: currentPlayback !== Playback.Roll,
roll: currentPlayback !== Playback.Roll && timerPhase !== TimerPhase.Overtime,
stop: currentPlayback !== Playback.Stop,
reload: currentPlayback !== Playback.Stop && currentPlayback !== Playback.Roll,
};