Fix broken player on broken video

This commit is contained in:
Chocobozzz 2024-02-28 10:02:49 +01:00
parent 4434e78c56
commit 568726e48d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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 () {

View File

@ -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')
}