Playback errors with a preferred quality set, on some devices

This commit is contained in:
Brahim Hadriche committed 2026-10-13 17:23:04 -04:00
1 parent 9200bd1c74
commit 367634fd94
4 files changed
+14 -28

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Small security fixes - Small security fixes
- SponsorBlock skip looping back to the start of a segment on some devices, and overlapping segments - SponsorBlock skip looping back to the start of a segment on some devices, and overlapping segments
- Live streams buffering on slow networks - Live streams buffering on slow networks
- Playback errors with a preferred quality set, on some devices
### Changed ### Changed
@@ -30,13 +30,13 @@ namespace ErrorDialogController
} }
end function end function
' A Video state=error. Retry the next stream URL only before the first successful play, only for a ' A Video state=error. Before the first successful play, whatever the error, retry the next stream URL if one
' stream/format error (http / mediaerror), and only if a next URL exists; otherwise a dialog. On retry the ' exists; otherwise a dialog. The URLs are variants of one source (quality-filtered first, then unfiltered,
' coordinator re-applies the initial seek (SeekToInitialPosition). ' then proxied), and a filtered manifest the device can't play fails under more than one category
function DecideVideoError(content as object, errorInfo as object, videoPlayedSuccessfully as boolean) as object ' (telemetry: mediaplayer and mediaerror). On retry the coordinator re-applies the initial seek
if not videoPlayedSuccessfully and content <> invalid and IsAssociativeArray(errorInfo) ' (SeekToInitialPosition).
category = ValidString(errorInfo.category) function DecideVideoError(content as object, videoPlayedSuccessfully as boolean) as object
if category = "http" or category = "mediaerror" if not videoPlayedSuccessfully and content <> invalid
nextUrl = ErrorDialogController.NextStreamUrl(content) nextUrl = ErrorDialogController.NextStreamUrl(content)
if nextUrl <> invalid if nextUrl <> invalid
return { return {
@@ -45,7 +45,6 @@ namespace ErrorDialogController
} }
end if end if
end if end if
end if
return { return {
action: ErrorDialogController.Action.Dialog action: ErrorDialogController.Action.Dialog
@@ -863,7 +863,7 @@ function OnVideoError() as void
failedUrl = content.url failedUrl = content.url
failedUrlIndex = content.playletStreamUrlIndex failedUrlIndex = content.playletStreamUrlIndex
decision = ErrorDialogController.DecideVideoError(content, errorInfo, m.videoPlayedSuccessfully) decision = ErrorDialogController.DecideVideoError(content, m.videoPlayedSuccessfully)
if decision.action = ErrorDialogController.Action.Retry if decision.action = ErrorDialogController.Action.Retry
LogInfo("error retry -> next stream url=", decision.nextUrl) LogInfo("error retry -> next stream url=", decision.nextUrl)
@@ -52,42 +52,28 @@ namespace Tests
@describe("playback error decision") @describe("playback error decision")
@it("retries the next stream url on an http error before playing") @it("retries the next stream url before the first play")
function _() function _()
content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" } content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" }
d = ErrorDialogController.DecideVideoError(content, { category: "http" }, false) d = ErrorDialogController.DecideVideoError(content, false)
m.assertEqual(d.action, ErrorDialogController.Action.Retry) m.assertEqual(d.action, ErrorDialogController.Action.Retry)
m.assertEqual(d.nextUrl, "b") m.assertEqual(d.nextUrl, "b")
m.assertEqual(content.url, "b") m.assertEqual(content.url, "b")
end function end function
@it("retries on a mediaerror category")
function _()
content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" }
d = ErrorDialogController.DecideVideoError(content, { category: "mediaerror" }, false)
m.assertEqual(d.action, ErrorDialogController.Action.Retry)
m.assertEqual(d.nextUrl, "b")
end function
@it("shows a dialog when no next url exists") @it("shows a dialog when no next url exists")
function _() function _()
content = { videoId: "v", playletStreamUrls: ["a"], playletStreamUrlIndex: 0, url: "a" } content = { videoId: "v", playletStreamUrls: ["a"], playletStreamUrlIndex: 0, url: "a" }
d = ErrorDialogController.DecideVideoError(content, { category: "http" }, false) d = ErrorDialogController.DecideVideoError(content, false)
m.assertEqual(d.action, ErrorDialogController.Action.Dialog) m.assertEqual(d.action, ErrorDialogController.Action.Dialog)
end function end function
@it("shows a dialog once the stream has already played (no stream-swap)") @it("shows a dialog once the stream has already played (no stream-swap)")
function _() function _()
content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" } content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" }
d = ErrorDialogController.DecideVideoError(content, { category: "http" }, true) d = ErrorDialogController.DecideVideoError(content, true)
m.assertEqual(d.action, ErrorDialogController.Action.Dialog)
end function
@it("shows a dialog for a non-stream error category")
function _()
content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" }
d = ErrorDialogController.DecideVideoError(content, { category: "drm" }, false)
m.assertEqual(d.action, ErrorDialogController.Action.Dialog) m.assertEqual(d.action, ErrorDialogController.Action.Dialog)
m.assertEqual(content.url, "a")
end function end function
end class end class