aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/assets/player/shared/peertube/peertube-plugin.ts22
-rw-r--r--client/src/assets/player/shared/web-video/web-video-plugin.ts7
2 files changed, 23 insertions, 6 deletions
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index 6c83d22bf..f93593415 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -36,6 +36,8 @@ class PeerTubePlugin extends Plugin {
36 private mouseInControlBar = false 36 private mouseInControlBar = false
37 private mouseInSettings = false 37 private mouseInSettings = false
38 38
39 private errorModal: videojs.ModalDialog
40
39 private videoViewOnPlayHandler: (...args: any[]) => void 41 private videoViewOnPlayHandler: (...args: any[]) => void
40 private videoViewOnSeekedHandler: (...args: any[]) => void 42 private videoViewOnSeekedHandler: (...args: any[]) => void
41 private videoViewOnEndedHandler: (...args: any[]) => void 43 private videoViewOnEndedHandler: (...args: any[]) => void
@@ -109,6 +111,8 @@ class PeerTubePlugin extends Plugin {
109 111
110 this.player.on('video-change', () => { 112 this.player.on('video-change', () => {
111 this.initOnVideoChange() 113 this.initOnVideoChange()
114
115 this.hideFatalError()
112 }) 116 })
113 }) 117 })
114 } 118 }
@@ -130,6 +134,11 @@ class PeerTubePlugin extends Plugin {
130 } 134 }
131 135
132 displayFatalError () { 136 displayFatalError () {
137 // Already displayed an error
138 if (this.errorModal) return
139
140 debugLogger('Display fatal error')
141
133 this.player.loadingSpinner.hide() 142 this.player.loadingSpinner.hide()
134 143
135 const buildModal = (error: MediaError) => { 144 const buildModal = (error: MediaError) => {
@@ -150,17 +159,24 @@ class PeerTubePlugin extends Plugin {
150 return wrapper 159 return wrapper
151 } 160 }
152 161
153 const modal = this.player.createModal(buildModal(this.player.error()), { 162 this.errorModal = this.player.createModal(buildModal(this.player.error()), {
154 temporary: false, 163 temporary: true,
155 uncloseable: true 164 uncloseable: true
156 }) 165 })
157 modal.addClass('vjs-custom-error-display') 166 this.errorModal.addClass('vjs-custom-error-display')
158 167
159 this.player.addClass('vjs-error-display-enabled') 168 this.player.addClass('vjs-error-display-enabled')
160 } 169 }
161 170
162 hideFatalError () { 171 hideFatalError () {
172 if (!this.errorModal) return
173
174 debugLogger('Hiding fatal error')
175
163 this.player.removeClass('vjs-error-display-enabled') 176 this.player.removeClass('vjs-error-display-enabled')
177 this.player.removeChild(this.errorModal)
178 this.errorModal.close()
179 this.errorModal = undefined
164 } 180 }
165 181
166 private initializePlayer () { 182 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 d09b5a724..b839062f2 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
@@ -65,9 +65,10 @@ class WebVideoPlugin extends Plugin {
65 const playbackRate = this.player.playbackRate() 65 const playbackRate = this.player.playbackRate()
66 const currentTime = this.player.currentTime() 66 const currentTime = this.player.currentTime()
67 67
68 // Enable error display now this is our last fallback 68 if (!this.onErrorHandler) {
69 this.onErrorHandler = () => this.player.peertube().displayFatalError() 69 this.onErrorHandler = () => this.player.peertube().displayFatalError()
70 this.player.one('error', this.onErrorHandler) 70 this.player.one('error', this.onErrorHandler)
71 }
71 72
72 let httpUrl = this.currentVideoFile.fileUrl 73 let httpUrl = this.currentVideoFile.fileUrl
73 74