Better hls warn/error logging

pull/4000/head
Chocobozzz 2021-04-21 10:02:28 +02:00
parent e8bb5b6b3a
commit 48d7e4ad13
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 6 additions and 2 deletions

View File

@ -259,13 +259,17 @@ class Html5Hlsjs {
const error: { message: string, code?: number } = {
message: `HLS.js error: ${data.type} - fatal: ${data.fatal} - ${data.details}`
}
console.error(error.message)
// increment/set error count
if (this.errorCounts[ data.type ]) this.errorCounts[ data.type ] += 1
else this.errorCounts[ data.type ] = 1
if (!data.fatal) return
if (!data.fatal) {
console.warn(error.message)
return
}
console.error(error.message)
if (data.type === Hlsjs.ErrorTypes.NETWORK_ERROR) {
error.code = 2