Skip to content

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

Fix broken player on broken video

Chocobozzz568726e48dbc
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index df0cc15e74..084ef965d0 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -124,7 +124,6 @@ export class PeerTubePlayer {
setPoster (url: string) {
this.player?.poster(url)
- this.options.playerElement().poster = url
}
enable () {
@@ -209,7 +208,8 @@ export class PeerTubePlayer {
}
}
- this.player.one('error', () => handleError())
+ this.player.on('video-change', () => alreadyFallback = false)
+ this.player.on('error', () => handleError())
this.player.on('network-info', (_, data: PlayerNetworkInfo) => {
if (data.source !== 'p2p-media-loader' || isNaN(data.bandwidthEstimate)) return
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index 90524ebb57..bc010dc829 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -187,6 +187,10 @@ class PeerTubePlugin extends Plugin {
this.player.removeChild(this.errorModal)
this.errorModal.close()
this.errorModal = undefined
+
+ if (this.player.loadingSpinner) {
+ this.player.loadingSpinner.show()
+ }
}
private initializePlayer () {
diff --git a/client/src/assets/player/shared/web-video/web-video-plugin.ts b/client/src/assets/player/shared/web-video/web-video-plugin.ts
index 0f5015c9a2..0a6063dcf4 100644
--- a/client/src/assets/player/shared/web-video/web-video-plugin.ts
+++ b/client/src/assets/player/shared/web-video/web-video-plugin.ts
@@ -87,9 +87,6 @@ class WebVideoPlugin extends Plugin {
const oldAutoplayValue = this.player.autoplay()
if (options.isUserResolutionChange) {
- // Prevent video source element displaying the poster when we change the resolution
- (this.player.el() as HTMLVideoElement).poster = ''
-
this.player.autoplay(false)
this.player.addClass('vjs-updating-resolution')
}