ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix viewers for lives
Chocobozzz10f26f4203b8
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.tsindex 9407cf123e..1ff3a010e8 100644--- a/client/src/assets/player/peertube-player-manager.ts+++ b/client/src/assets/player/peertube-player-manager.ts@@ -229,7 +229,8 @@ export class PeertubePlayerManager {userWatching: commonOptions.userWatching,subtitle: commonOptions.subtitle,videoCaptions: commonOptions.videoCaptions,- stopTime: commonOptions.stopTime+ stopTime: commonOptions.stopTime,+ isLive: commonOptions.isLive}}diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.tsindex a2b038b775..75a6e662eb 100644--- a/client/src/assets/player/peertube-plugin.ts+++ b/client/src/assets/player/peertube-plugin.ts@@ -32,6 +32,8 @@ class PeerTubePlugin extends Plugin {private userWatchingVideoInterval: anyprivate lastResolutionChange: ResolutionUpdateData+ private isLive: boolean+private menuOpened = falseprivate mouseInControlBar = falseprivate readonly savedInactivityTimeout: number@@ -42,6 +44,7 @@ class PeerTubePlugin extends Plugin {this.videoViewUrl = options.videoViewUrlthis.videoDuration = options.videoDurationthis.videoCaptions = options.videoCaptions+ this.isLive = options.isLivethis.savedInactivityTimeout = player.options_.inactivityTimeout@@ -152,7 +155,9 @@ class PeerTubePlugin extends Plugin {// After 30 seconds (or 3/4 of the video), add a view to the videolet minSecondsToView = 30- if (this.videoDuration < minSecondsToView) minSecondsToView = (this.videoDuration * 3) / 4+ if (!this.isLive && this.videoDuration < minSecondsToView) {+ minSecondsToView = (this.videoDuration * 3) / 4+ }let secondsViewed = 0this.videoViewInterval = setInterval(() => {@@ -160,7 +165,12 @@ class PeerTubePlugin extends Plugin {secondsViewed += 1if (secondsViewed > minSecondsToView) {- this.clearVideoViewInterval()+ // Restart the loop if this is a live+ if (this.isLive) {+ secondsViewed = 0+ } else {+ this.clearVideoViewInterval()+ }this.addViewToVideo().catch(err => console.error(err))}diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.tsindex f1e6144992..e5259092c6 100644--- a/client/src/assets/player/peertube-videojs-typings.ts+++ b/client/src/assets/player/peertube-videojs-typings.ts@@ -106,6 +106,8 @@ type PeerTubePluginOptions = {videoCaptions: VideoJSCaption[]stopTime: number | string++ isLive: boolean}type PlaylistPluginOptions = {