diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-29 13:49:48 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-29 14:05:41 +0100 |
commit | e25f83ce2106750b552133da232a9a0810ceb9b0 (patch) | |
tree | 5dea86f0ce531daac259fa387c656b1a637cb92b /client/src/assets/player/p2p-media-loader | |
parent | ffd970faf9c6c67dc3fc3d27069393bf1c76b379 (diff) | |
download | PeerTube-e25f83ce2106750b552133da232a9a0810ceb9b0.tar.gz PeerTube-e25f83ce2106750b552133da232a9a0810ceb9b0.tar.zst PeerTube-e25f83ce2106750b552133da232a9a0810ceb9b0.zip |
Correctlu throws an error on manifestIncompatibleCodecsError
Diffstat (limited to 'client/src/assets/player/p2p-media-loader')
-rw-r--r-- | client/src/assets/player/p2p-media-loader/hls-plugin.ts | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/client/src/assets/player/p2p-media-loader/hls-plugin.ts b/client/src/assets/player/p2p-media-loader/hls-plugin.ts index ca7a341b4..4283fc7dd 100644 --- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts | |||
@@ -243,30 +243,21 @@ class Html5Hlsjs { | |||
243 | if (this.errorCounts[ data.type ]) this.errorCounts[ data.type ] += 1 | 243 | if (this.errorCounts[ data.type ]) this.errorCounts[ data.type ] += 1 |
244 | else this.errorCounts[ data.type ] = 1 | 244 | else this.errorCounts[ data.type ] = 1 |
245 | 245 | ||
246 | // Implement simple error handling based on hls.js documentation | 246 | if (!data.fatal) return |
247 | // https://github.com/dailymotion/hls.js/blob/master/API.md#fifth-step-error-handling | ||
248 | if (data.fatal) { | ||
249 | switch (data.type) { | ||
250 | case Hlsjs.ErrorTypes.NETWORK_ERROR: | ||
251 | console.info('bubbling network error up to VIDEOJS') | ||
252 | error.code = 2 | ||
253 | this.tech.error = () => error as any | ||
254 | this.tech.trigger('error') | ||
255 | break | ||
256 | |||
257 | case Hlsjs.ErrorTypes.MEDIA_ERROR: | ||
258 | error.code = 3 | ||
259 | this._handleMediaError(error) | ||
260 | break | ||
261 | 247 | ||
262 | default: | 248 | if (data.type === Hlsjs.ErrorTypes.NETWORK_ERROR) { |
263 | // cannot recover | 249 | console.info('bubbling network error up to VIDEOJS') |
264 | this.hls.destroy() | 250 | error.code = 2 |
265 | console.info('bubbling error up to VIDEOJS') | 251 | this.tech.error = () => error as any |
266 | this.tech.error = () => error as any | 252 | this.tech.trigger('error') |
267 | this.tech.trigger('error') | 253 | } else if (data.type === Hlsjs.ErrorTypes.MEDIA_ERROR && data.details !== 'manifestIncompatibleCodecsError') { |
268 | break | 254 | error.code = 3 |
269 | } | 255 | this._handleMediaError(error) |
256 | } else { | ||
257 | this.hls.destroy() | ||
258 | console.info('bubbling error up to VIDEOJS') | ||
259 | this.tech.error = () => error as any | ||
260 | this.tech.trigger('error') | ||
270 | } | 261 | } |
271 | } | 262 | } |
272 | 263 | ||