allow goto to specify if it should play or pause

This commit is contained in:
Justin Halsall
2021-02-19 12:50:22 +01:00
parent 2982a55279
commit aee3c1605c
3 changed files with 10 additions and 9 deletions

View File

@@ -141,13 +141,14 @@
replayer.pause();
};
export const goto = (timeOffset: number) => {
export const goto = (timeOffset: number, play?: boolean) => {
currentTime = timeOffset;
const isPlaying = playerState === 'playing';
replayer.pause();
replayer.play(timeOffset);
if (!isPlaying) {
replayer.pause();
const resumePlaying =
typeof play === 'boolean' ? play : playerState === 'playing';
if (resumePlaying) {
replayer.play(timeOffset);
} else {
replayer.pause(timeOffset);
}
};