diff --git a/CHANGELOG.md b/CHANGELOG.md index 92944172..34b8b7f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Small security fixes - SponsorBlock skip looping back to the start of a segment on some devices, and overlapping segments - Live streams buffering on slow networks +- Playback errors with a preferred quality set, on some devices ### Changed diff --git a/playlet-lib/src/components/VideoPlayerDev/ErrorDialogController.bs b/playlet-lib/src/components/VideoPlayerDev/ErrorDialogController.bs index 8c227d5e..6adf62fb 100644 --- a/playlet-lib/src/components/VideoPlayerDev/ErrorDialogController.bs +++ b/playlet-lib/src/components/VideoPlayerDev/ErrorDialogController.bs @@ -30,20 +30,19 @@ namespace ErrorDialogController } end function - ' A Video state=error. Retry the next stream URL only before the first successful play, only for a - ' stream/format error (http / mediaerror), and only if a next URL exists; otherwise a dialog. On retry the - ' coordinator re-applies the initial seek (SeekToInitialPosition). - function DecideVideoError(content as object, errorInfo as object, videoPlayedSuccessfully as boolean) as object - if not videoPlayedSuccessfully and content <> invalid and IsAssociativeArray(errorInfo) - category = ValidString(errorInfo.category) - if category = "http" or category = "mediaerror" - nextUrl = ErrorDialogController.NextStreamUrl(content) - if nextUrl <> invalid - return { - action: ErrorDialogController.Action.Retry - nextUrl: nextUrl - } - end if + ' A Video state=error. Before the first successful play, whatever the error, retry the next stream URL if one + ' exists; otherwise a dialog. The URLs are variants of one source (quality-filtered first, then unfiltered, + ' then proxied), and a filtered manifest the device can't play fails under more than one category + ' (telemetry: mediaplayer and mediaerror). On retry the coordinator re-applies the initial seek + ' (SeekToInitialPosition). + function DecideVideoError(content as object, videoPlayedSuccessfully as boolean) as object + if not videoPlayedSuccessfully and content <> invalid + nextUrl = ErrorDialogController.NextStreamUrl(content) + if nextUrl <> invalid + return { + action: ErrorDialogController.Action.Retry + nextUrl: nextUrl + } end if end if diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs index d7c9cc07..3436c750 100644 --- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs +++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs @@ -863,7 +863,7 @@ function OnVideoError() as void failedUrl = content.url failedUrlIndex = content.playletStreamUrlIndex - decision = ErrorDialogController.DecideVideoError(content, errorInfo, m.videoPlayedSuccessfully) + decision = ErrorDialogController.DecideVideoError(content, m.videoPlayedSuccessfully) if decision.action = ErrorDialogController.Action.Retry LogInfo("error retry -> next stream url=", decision.nextUrl) diff --git a/playlet-lib/src/source/tests/VideoPlayerDev/ErrorDialogController.spec.bs b/playlet-lib/src/source/tests/VideoPlayerDev/ErrorDialogController.spec.bs index 5e839bff..a06afb8d 100644 --- a/playlet-lib/src/source/tests/VideoPlayerDev/ErrorDialogController.spec.bs +++ b/playlet-lib/src/source/tests/VideoPlayerDev/ErrorDialogController.spec.bs @@ -52,42 +52,28 @@ namespace Tests @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 _() 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.nextUrl, "b") m.assertEqual(content.url, "b") 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") function _() 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) end function @it("shows a dialog once the stream has already played (no stream-swap)") function _() content = { videoId: "v", playletStreamUrls: ["a", "b"], playletStreamUrlIndex: 0, url: "a" } - d = ErrorDialogController.DecideVideoError(content, { category: "http" }, 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) + d = ErrorDialogController.DecideVideoError(content, true) m.assertEqual(d.action, ErrorDialogController.Action.Dialog) + m.assertEqual(content.url, "a") end function end class