From e25f83ce2106750b552133da232a9a0810ceb9b0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Jan 2021 13:49:48 +0100 Subject: Correctlu throws an error on manifestIncompatibleCodecsError --- .../assets/player/p2p-media-loader/hls-plugin.ts | 37 ++++++++-------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'client/src/assets/player/p2p-media-loader') 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 { if (this.errorCounts[ data.type ]) this.errorCounts[ data.type ] += 1 else this.errorCounts[ data.type ] = 1 - // Implement simple error handling based on hls.js documentation - // https://github.com/dailymotion/hls.js/blob/master/API.md#fifth-step-error-handling - if (data.fatal) { - switch (data.type) { - case Hlsjs.ErrorTypes.NETWORK_ERROR: - console.info('bubbling network error up to VIDEOJS') - error.code = 2 - this.tech.error = () => error as any - this.tech.trigger('error') - break - - case Hlsjs.ErrorTypes.MEDIA_ERROR: - error.code = 3 - this._handleMediaError(error) - break + if (!data.fatal) return - default: - // cannot recover - this.hls.destroy() - console.info('bubbling error up to VIDEOJS') - this.tech.error = () => error as any - this.tech.trigger('error') - break - } + if (data.type === Hlsjs.ErrorTypes.NETWORK_ERROR) { + console.info('bubbling network error up to VIDEOJS') + error.code = 2 + this.tech.error = () => error as any + this.tech.trigger('error') + } else if (data.type === Hlsjs.ErrorTypes.MEDIA_ERROR && data.details !== 'manifestIncompatibleCodecsError') { + error.code = 3 + this._handleMediaError(error) + } else { + this.hls.destroy() + console.info('bubbling error up to VIDEOJS') + this.tech.error = () => error as any + this.tech.trigger('error') } } -- cgit v1.2.3