Capture dash on video errors

This commit is contained in:
Brahim Hadriche committed 2025-09-04 21:06:14 -04:00
1 parent f0d516d194
commit 63cf9a5e56
3 files changed
+28 -10

No files matched your search

@@ -17,6 +17,8 @@ function ExecuteJob() as void
return
end if
DeleteFile("tmp:/last_generated_dash.xml")
if StringUtils.IsNullOrEmpty(contentNode.videoId)
JobError("Can't load video information: videoId is missing")
return
@@ -447,11 +447,7 @@ function OnVideoPlayerStateChange() as void
errorData = GetPlayerErrorData(content.videoId, errorInfo)
LogErrorNoTelemetry(errorData.title, errorData.body)
m.global.telemetry.LogEvent = {
level: "error"
message: errorData.title + " " + errorData.body
fingerprint: errorData.fingerprint
}
ReportVideoError(errorData)
errorReported = true
if m.videoPlayingSuccess <> true
@@ -503,11 +499,7 @@ function OnVideoPlayerStateChange() as void
LogErrorNoTelemetry(errorData.title, errorData.body)
if not errorReported
m.global.telemetry.LogEvent = {
level: "error"
message: errorData.title + " " + errorData.body
fingerprint: errorData.fingerprint
}
ReportVideoError(errorData)
end if
buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)]
@@ -555,6 +547,28 @@ function GetPlayerErrorData(videoId as string, errorInfo as object) as object
}
end function
function ReportVideoError(errorData as object) as void
attachments = invalid
if errorData.body.Instr("malformed data") <> -1 or errorData.body.Instr("invalid pathname") <> -1
lastGeneratedDash = ReadAsciiFile("tmp:/last_generated_dash.xml")
if not StringUtils.IsNullOrEmpty(lastGeneratedDash)
attachments = [{
filename: "last_generated_dash.xml"
content_type: "application/dash+xml"
data: lastGeneratedDash
}]
DeleteFile("tmp:/last_generated_dash.xml")
end if
end if
m.global.telemetry.LogEvent = {
level: "error"
message: errorData.title + " " + errorData.body
fingerprint: errorData.fingerprint
attachments: attachments
}
end function
function OnVideoFinished() as void
if not VideoQueueUtils.PlayNext(m.videoQueue, m.invidious, m.preferences)
m.videoQueue.closePlayer = true
@@ -51,6 +51,8 @@ namespace Http
response.SetBodyDataString(xmlContent)
response.ContentType("application/dash+xml")
WriteAsciiFile("tmp:/last_generated_dash.xml", xmlContent)
return true
end function