diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f65db20..de4ba39d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Backend changes from Invidious to Playlet if no instance url is set. This is to avoid playback errors. + ## [0.48.7] - 2026-10-05 ### Added diff --git a/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs b/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs index a972ffba..86df4a56 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs @@ -1,4 +1,5 @@ import "pkg:/components/ContentNode/ProfileContentAuthTokenUtils.bs" +import "pkg:/components/Dialog/DialogUtils.bs" import "pkg:/components/Services/Innertube/InnertubeService.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/source/utils/CancellationUtils.bs" @@ -30,6 +31,10 @@ function ExecuteJob() as void return end if + if preferencesNode["backend.selected"] = "invidious" and StringUtils.IsNullOrEmpty(preferencesNode["invidious.instance"]) + SwitchBackendToPlaylet(preferencesNode) + end if + DeleteFile("cachefs:/last_generated_dash.xml") DeleteFile("cachefs:/last_generated_hls.m3u8") @@ -234,6 +239,23 @@ function SessionDataComplete(sessionData as object) as boolean return IsAssociativeArray(sessionData) and not StringUtils.IsNullOrEmpty(sessionData.visitorData) and not StringUtils.IsNullOrEmpty(sessionData.livingRoomPoTokenId) end function +function SwitchBackendToPlaylet(preferencesNode as object) as void + preferencesNode["backend.selected"] = "playlet" + + dialog = DialogUtils.ShowDialogEx({ + title: Tr(Locale.Dialogs.BackendSwitchedToPlayletTitle) + message: Tr(Locale.Dialogs.BackendSwitchedToPlayletMessage) + }) + if dialog = invalid + return + end if + + port = CreateObject("roMessagePort") + MessagePortUtils.ObserveFieldScopedExSafe(dialog, "wasClosed", port) + wait(0, port) + dialog.unobserveFieldScoped("wasClosed") +end function + function ResolveBackendId(backend as string, service as Invidious.InvidiousService) as string if backend = "playlet" return "playlet" diff --git a/playlet-lib/src/locale/en_US/translations.ts b/playlet-lib/src/locale/en_US/translations.ts index bfaf56eb..bdcb9ef4 100644 --- a/playlet-lib/src/locale/en_US/translations.ts +++ b/playlet-lib/src/locale/en_US/translations.ts @@ -240,6 +240,14 @@ Please sign in again with this profile, or switch to another profile. Please sign in again with this profile, or switch to another profile. + + Backend changed + Backend changed + + + Backend changed to Playlet, because no Invidious instance is set. + Backend changed to Playlet, because no Invidious instance is set. + Lounge service setup error Lounge service setup error diff --git a/playlet-lib/src/source/utils/Locale.bs b/playlet-lib/src/source/utils/Locale.bs index 001da540..a16c3194 100644 --- a/playlet-lib/src/source/utils/Locale.bs +++ b/playlet-lib/src/source/utils/Locale.bs @@ -80,6 +80,8 @@ namespace Locale ProfileNeedsReauthMessage = "The session has expired. Please sign in again with this profile, or switch to another profile." ProfileNeedsReauthMessageLine1 = "The session has expired." ProfileNeedsReauthMessageLine2 = "Please sign in again with this profile, or switch to another profile." + BackendSwitchedToPlayletTitle = "Backend changed" + BackendSwitchedToPlayletMessage = "Backend changed to Playlet, because no Invidious instance is set." LoungeServiceSetupError = "Lounge service setup error" LoungeFailedToGetScreenId = "Failed to get screen ID. Please restart Playlet to use the cast function." LoungeNotAValidScreenId = "Not a valid screen id: %1"