diff --git a/playlet-lib/src/components/VideoQueue/VideoQueueView.bs b/playlet-lib/src/components/VideoQueue/VideoQueueView.bs
index c498be33..41c02488 100644
--- a/playlet-lib/src/components/VideoQueue/VideoQueueView.bs
+++ b/playlet-lib/src/components/VideoQueue/VideoQueueView.bs
@@ -144,6 +144,7 @@ function LoadVideoDetailsIfNeeded() as void
m.loadDetailsTask = AsyncTask.Start(Tasks.VideoQueueViewContentTask, {
videoNodes: m.videosDetailsToLoad
invidious: m.top.invidious
+ preferences: m.top.preferences
index: indexInLoadingArray
})
end function
diff --git a/playlet-lib/src/components/VideoQueue/VideoQueueView.xml b/playlet-lib/src/components/VideoQueue/VideoQueueView.xml
index ac4cc6c9..70b9d044 100644
--- a/playlet-lib/src/components/VideoQueue/VideoQueueView.xml
+++ b/playlet-lib/src/components/VideoQueue/VideoQueueView.xml
@@ -5,6 +5,7 @@
+
diff --git a/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs b/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs
index 86b3b372..dd867fa9 100644
--- a/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs
+++ b/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs
@@ -1,3 +1,4 @@
+import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/source/services/HttpClient.bs"
@@ -7,12 +8,15 @@ import "pkg:/source/utils/MathUtils.bs"
function VideoQueueViewContentTask(input as object) as object
videoNodes = input.videoNodes
invidiousNode = input.invidious
+ preferencesNode = input.preferences
service = new Invidious.InvidiousService(invidiousNode)
instance = service.GetInstance()
cancellation = m.top.cancellation
index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1)
+ backend = preferencesNode["playback.backend"]
+
requestOptions = {
cacheSeconds: 8640000 ' 100 days
cancellation: cancellation
@@ -24,7 +28,7 @@ function VideoQueueViewContentTask(input as object) as object
' Need to change it to load on demand using render tracking
for i = index to videoNodes.Count() - 1
videoNode = videoNodes[i]
- if not LoadVideoDetail(videoNode, service, instance, requestOptions)
+ if not LoadVideoDetail(videoNode, service, instance, requestOptions, backend)
' Sleep for a bit to avoid creating too much traffic
sleep(500)
end if
@@ -36,7 +40,7 @@ function VideoQueueViewContentTask(input as object) as object
for i = index - 1 to 0 step -1
videoNode = videoNodes[i]
- if not LoadVideoDetail(videoNode, service, instance, requestOptions)
+ if not LoadVideoDetail(videoNode, service, instance, requestOptions, backend)
' Sleep for a bit to avoid creating too much traffic
sleep(1000)
end if
@@ -50,9 +54,15 @@ function VideoQueueViewContentTask(input as object) as object
end function
' Returns true if the video was loaded from cache.
-function LoadVideoDetail(videoNode as object, service as object, instance as string, requestOptions as object) as boolean
+function LoadVideoDetail(videoNode as object, service as object, instance as string, requestOptions as object, backend as string) as boolean
videoId = videoNode.videoId
- response = service.GetVideoMetadata(videoId, requestOptions)
+
+ if backend = "playlet"
+ response = InnertubeService.GetVideoMetadata(videoId, requestOptions)
+ else
+ response = service.GetVideoMetadata(videoId, requestOptions)
+ end if
+
metadata = response.Json()
if not response.IsSuccess() or metadata = invalid
diff --git a/playlet-lib/src/components/VideoQueue/VideoQueueViewUtils.bs b/playlet-lib/src/components/VideoQueue/VideoQueueViewUtils.bs
index 0162ba37..55e52695 100644
--- a/playlet-lib/src/components/VideoQueue/VideoQueueViewUtils.bs
+++ b/playlet-lib/src/components/VideoQueue/VideoQueueViewUtils.bs
@@ -7,6 +7,7 @@ namespace VideoQueueViewUtils
videoQueueView.videoQueue = videoQueue
videoQueueView.appController = appController
videoQueueView.invidious = videoQueue.invidious
+ videoQueueView.preferences = videoQueue.preferences
appController@.PushScreen(videoQueueView)
content = videoQueue.content