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;
|
this.playerController.currentTime = seekSeconds;
|
||||||
|
|
||||||
if (play) {
|
if (play) {
|
||||||
// use timeout to avoid race condition with other data loading
|
this.waitAndPlay();
|
||||||
setTimeout(() => this.playerController.play()), 1;
|
|
||||||
} else {
|
} else {
|
||||||
this.playerController.pause();
|
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) {
|
seekToTimelineItem(timeline: Timeline) {
|
||||||
this.playerController.pause();
|
this.playerController.pause();
|
||||||
this.seekToTimestamp(timeline.timestamp + this.annotationOffset);
|
this.seekToTimestamp(timeline.timestamp + this.annotationOffset);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user