Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Avoid sending seek event on video start time

Chocobozzzd5fd8227b4eb
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index 30a2d8538f..1a7ca4d4d2 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -38,6 +38,8 @@ class PeerTubePlugin extends Plugin {
private errorModal: videojs.ModalDialog
+ private hasInitialSeek = false
+
private videoViewOnPlayHandler: (...args: any[]) => void
private videoViewOnSeekedHandler: (...args: any[]) => void
private videoViewOnEndedHandler: (...args: any[]) => void
@@ -253,6 +255,12 @@ class PeerTubePlugin extends Plugin {
}
this.videoViewOnSeekedHandler = () => {
+ // Bypass the first initial seek
+ if (this.hasInitialSeek) {
+ this.hasInitialSeek = false
+ return
+ }
+
const diff = Math.floor(this.player.currentTime()) - lastCurrentTime
// Don't take into account small forwards
@@ -418,6 +426,7 @@ class PeerTubePlugin extends Plugin {
if (startTime !== null && startTime !== undefined) {
debugLogger('Start the video at ' + startTime)
+ this.hasInitialSeek = true
this.player.currentTime(timeToInt(startTime))
}