[skip ci] adjust player errors

This commit is contained in:
Brahim Hadriche committed 2025-11-07 15:55:24 -05:00
1 parent 9318db7762
commit 24cf06bf44
2 files changed
+23 -23

No files matched your search

+4
View File
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
- Nothing worth mentioning yet.
## [0.43.9] - 2025-11-07 ## [0.43.9] - 2025-11-07
### Fixed ### Fixed
@@ -441,32 +441,23 @@ function OnVideoPlayerStateChange() as void
m.videoPlayingSuccess = true m.videoPlayingSuccess = true
end if end if
errorReported = false errorData = invalid
if state = "error" if state = "error"
errorInfo = m.top.errorInfo errorInfo = m.top.errorInfo
errorData = GetPlayerErrorData(content.videoId, errorInfo) errorData = GetPlayerErrorData(content.videoId, errorInfo)
LogErrorNoTelemetry(errorData.title, errorData.body) LogErrorNoTelemetry(errorData.title, errorData.body)
ReportVideoError(errorData, content.url, content.playletStreamUrls, content.playletStreamUrlIndex)
errorReported = true
if m.videoPlayingSuccess <> true if m.videoPlayingSuccess <> true
' http for stream format, mediaerror for DASH ' http for stream format, mediaerror for DASH
if errorInfo.category = "http" or errorInfo.category = "mediaerror" if errorInfo.category = "http" or errorInfo.category = "mediaerror"
currentUrl = content.url
playletStreamUrls = content.playletStreamUrls playletStreamUrls = content.playletStreamUrls
playletStreamUrlIndex = content.playletStreamUrlIndex currentUrlIndex = content.playletStreamUrlIndex
playletStreamUrlIndex++ nextUrlIndex = currentUrlIndex + 1
content.playletStreamUrlIndex = playletStreamUrlIndex content.playletStreamUrlIndex = nextUrlIndex
if playletStreamUrlIndex < playletStreamUrls.Count() if nextUrlIndex < playletStreamUrls.Count()
nextUrl = playletStreamUrls[playletStreamUrlIndex] currentUrl = content.url
msg = `Stream ${currentUrl} failed to play. Trying next stream ${nextUrl}` nextUrl = playletStreamUrls[nextUrlIndex]
LogErrorNoTelemetry(msg)
LogTelemetryEvent({
level: "error"
message: msg
fingerprint: ["Stream <URL> failed to play. Trying next stream <URL>"]
})
if StringUtils.IsNullOrEmpty(nextUrl) if StringUtils.IsNullOrEmpty(nextUrl)
LogError("Next stream URL is empty, cannot try next stream") LogError("Next stream URL is empty, cannot try next stream")
@@ -487,6 +478,12 @@ function OnVideoPlayerStateChange() as void
if hasTimestamp and timestamp > 0 if hasTimestamp and timestamp > 0
m.top.seek = content.timestamp m.top.seek = content.timestamp
end if end if
msg = `Stream ${currentUrl} failed to play. Trying next stream ${nextUrl}`
LogErrorNoTelemetry(msg)
errorData.title = msg + `\n` + errorData.title
ReportVideoError(errorData, currentUrl, playletStreamUrls, currentUrlIndex, false)
return return
end if end if
end if end if
@@ -504,13 +501,8 @@ function OnVideoPlayerStateChange() as void
end if end if
if state = "error" if state = "error"
errorInfo = m.top.errorInfo
errorData = GetPlayerErrorData(content.videoId, errorInfo)
LogErrorNoTelemetry(errorData.title, errorData.body) LogErrorNoTelemetry(errorData.title, errorData.body)
if not errorReported ReportVideoError(errorData, content.url, content.playletStreamUrls, content.playletStreamUrlIndex, true)
ReportVideoError(errorData, content.url, content.playletStreamUrls, content.playletStreamUrlIndex)
end if
buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)] buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)]
@@ -557,7 +549,7 @@ function GetPlayerErrorData(videoId as string, errorInfo as object) as object
} }
end function end function
function ReportVideoError(errorData as object, url as string, urls as object, urlIndex as dynamic) as void function ReportVideoError(errorData as object, url as dynamic, urls as object, urlIndex as dynamic, shownInDialog as boolean) as void
attachments = invalid attachments = invalid
if errorData.body.Instr("malformed data") <> -1 or errorData.body.Instr("invalid pathname") <> -1 if errorData.body.Instr("malformed data") <> -1 or errorData.body.Instr("invalid pathname") <> -1
lastGeneratedDash = ValidString(ReadAsciiFile("cachefs:/last_generated_dash.xml")) lastGeneratedDash = ValidString(ReadAsciiFile("cachefs:/last_generated_dash.xml"))
@@ -584,12 +576,16 @@ function ReportVideoError(errorData as object, url as string, urls as object, ur
message = [ message = [
errorData.title errorData.title
errorData.body errorData.body
`Dialog shown: ${shownInDialog}`
`Position: ${position}` `Position: ${position}`
`Duration: ${duration}` `Duration: ${duration}`
`Url: ${url}` `Url: ${url}`
`Urls: ` + ToString(urls) `Urls: ` + ToString(urls)
`Url index: ${urlIndex}` `Url index: ${urlIndex}`
].Join(`\n`) ].Join(`\n`)
errorData.fingerprint.push(shownInDialog)
LogTelemetryEvent({ LogTelemetryEvent({
level: "error" level: "error"
message: message message: message