mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 04:35:25 +03:00
Be wait for seek to show video player
This commit is contained in:
parent
4b30c5536b
commit
872dcb2139
@ -81,14 +81,27 @@ export class DynamicVideoController {
|
||||
this.playerController.currentTime = seekSeconds;
|
||||
|
||||
if (play) {
|
||||
// use timeout to avoid race condition with other data loading
|
||||
setTimeout(() => this.playerController.play()), 1;
|
||||
this.waitAndPlay();
|
||||
} else {
|
||||
this.playerController.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
waitAndPlay() {
|
||||
return new Promise((resolve) => {
|
||||
const onSeekedHandler = () => {
|
||||
this.playerController.removeEventListener("seeked", onSeekedHandler);
|
||||
this.playerController.play();
|
||||
resolve(undefined);
|
||||
};
|
||||
|
||||
this.playerController.addEventListener("seeked", onSeekedHandler, {
|
||||
once: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
seekToTimelineItem(timeline: Timeline) {
|
||||
this.playerController.pause();
|
||||
this.seekToTimestamp(timeline.timestamp + this.annotationOffset);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user