diff --git a/playlet-lib/src/components/ContentNode/FeedContentNode.bs b/playlet-lib/src/components/ContentNode/FeedContentNode.bs new file mode 100644 index 00000000..ff7465e9 --- /dev/null +++ b/playlet-lib/src/components/ContentNode/FeedContentNode.bs @@ -0,0 +1,21 @@ +import "pkg:/components/VideoFeed/VideoRowCell/FeedContentNodeUtils.bs" +import "pkg:/source/utils/Types.bs" + +function OnReactivity() + if m.reactivity <> invalid + for each item in m.reactivity + item.node.unobserveFieldScoped(item.field) + end for + end if + + m.reactivity = m.top.reactivity + if m.reactivity <> invalid + for each item in m.reactivity + item.node.observeFieldScoped(item.field, FuncName(ResetNode)) + end for + end if +end function + +function ResetNode() + FeedContentNodeUtils.ResetSelf(m.top) +end function diff --git a/playlet-lib/src/components/ContentNode/FeedContentNode.xml b/playlet-lib/src/components/ContentNode/FeedContentNode.xml index 88ae1c5e..e86f83c9 100644 --- a/playlet-lib/src/components/ContentNode/FeedContentNode.xml +++ b/playlet-lib/src/components/ContentNode/FeedContentNode.xml @@ -3,5 +3,6 @@ + \ No newline at end of file diff --git a/playlet-lib/src/components/ContentNode/VideoContentNode.xml b/playlet-lib/src/components/ContentNode/VideoContentNode.xml index fe82985b..f4215916 100644 --- a/playlet-lib/src/components/ContentNode/VideoContentNode.xml +++ b/playlet-lib/src/components/ContentNode/VideoContentNode.xml @@ -5,6 +5,7 @@ + diff --git a/playlet-lib/src/components/ContentNode/VideoProgressContentNode.xml b/playlet-lib/src/components/ContentNode/VideoProgressContentNode.xml new file mode 100644 index 00000000..80cc620a --- /dev/null +++ b/playlet-lib/src/components/ContentNode/VideoProgressContentNode.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/playlet-lib/src/components/MainScene.transpiled.xml b/playlet-lib/src/components/MainScene.transpiled.xml index be0af11e..c641d430 100644 --- a/playlet-lib/src/components/MainScene.transpiled.xml +++ b/playlet-lib/src/components/MainScene.transpiled.xml @@ -44,6 +44,7 @@ + diff --git a/playlet-lib/src/components/MainScene.xml b/playlet-lib/src/components/MainScene.xml index 8b992195..e213ca17 100644 --- a/playlet-lib/src/components/MainScene.xml +++ b/playlet-lib/src/components/MainScene.xml @@ -52,12 +52,15 @@ + preferences="bind:../Preferences" + continueWatching="bind:../ContinueWatching" /> + + bookmarks="bind:../Bookmarks" + continueWatching="bind:../ContinueWatching" /> \ No newline at end of file diff --git a/playlet-lib/src/components/MainScene_bindings.transpiled.brs b/playlet-lib/src/components/MainScene_bindings.transpiled.brs index 63f05726..ad66de5d 100644 --- a/playlet-lib/src/components/MainScene_bindings.transpiled.brs +++ b/playlet-lib/src/components/MainScene_bindings.transpiled.brs @@ -16,11 +16,15 @@ function InitializeBindings() "PlayQueue": { "invidious": "../Invidious", "notifications": "../Notifications", - "preferences": "../Preferences" + "preferences": "../Preferences", + "continueWatching": "../ContinueWatching" }, "SearchHistory": { "preferences": "../Preferences" }, + "ContinueWatching": { + "preferences": "../Preferences" + }, "Invidious": { "webServer": "../WebServer", "applicationInfo": "../ApplicationInfo", @@ -32,7 +36,8 @@ function InitializeBindings() "invidious": "../Invidious", "preferences": "../Preferences", "playQueue": "../PlayQueue", - "bookmarks": "../Bookmarks" + "bookmarks": "../Bookmarks", + "continueWatching": "../ContinueWatching" } } } diff --git a/playlet-lib/src/components/PlayQueue/PlayQueue.bs b/playlet-lib/src/components/PlayQueue/PlayQueue.bs index 01fbbfc6..a55a133f 100644 --- a/playlet-lib/src/components/PlayQueue/PlayQueue.bs +++ b/playlet-lib/src/components/PlayQueue/PlayQueue.bs @@ -192,6 +192,7 @@ function LoadPlaylist(playlist as object) as void task = AsyncTask.Start(Tasks.PlaylistContentTask, { content: playlist invidious: m.top.invidious + continueWatchingContent: m.top.continueWatching.content }, OnPlaylistContentTaskResult) m.pendingLoadTasks[task.id] = task end function diff --git a/playlet-lib/src/components/PlayQueue/PlayQueue.xml b/playlet-lib/src/components/PlayQueue/PlayQueue.xml index 1d3f7afd..aee219ac 100644 --- a/playlet-lib/src/components/PlayQueue/PlayQueue.xml +++ b/playlet-lib/src/components/PlayQueue/PlayQueue.xml @@ -4,6 +4,7 @@ + diff --git a/playlet-lib/src/components/PlaylistView/PlaylistContentTask.bs b/playlet-lib/src/components/PlaylistView/PlaylistContentTask.bs index 6c69a0ad..f3bcadc2 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistContentTask.bs +++ b/playlet-lib/src/components/PlaylistView/PlaylistContentTask.bs @@ -6,6 +6,7 @@ import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs" function PlaylistContentTask(input as object) as object contentNode = input.content invidiousNode = input.invidious + continueWatchingContent = input.continueWatchingContent if m.top.cancel contentNode.loadState = FeedLoadState.None @@ -33,7 +34,7 @@ function PlaylistContentTask(input as object) as object end if instance = service.GetInstance() - InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance) + InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance, continueWatchingContent) childCount = contentNode.getChildCount() if metadata.videos.Count() > 0 or childCount < metadata.videoCount diff --git a/playlet-lib/src/components/PlaylistView/PlaylistView.bs b/playlet-lib/src/components/PlaylistView/PlaylistView.bs index 1157ef60..c41460d7 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistView.bs +++ b/playlet-lib/src/components/PlaylistView/PlaylistView.bs @@ -226,6 +226,7 @@ function LoadPlaylist() as void m.playlistLoadTask = AsyncTask.Start(Tasks.PlaylistContentTask, { content: m.top.content invidious: m.top.invidious + continueWatchingContent: m.top.continueWatching.content }, OnPlaylistContentTaskResult) end function diff --git a/playlet-lib/src/components/PlaylistView/PlaylistView.xml b/playlet-lib/src/components/PlaylistView/PlaylistView.xml index ddc6f216..0e167304 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistView.xml +++ b/playlet-lib/src/components/PlaylistView/PlaylistView.xml @@ -5,6 +5,7 @@ + diff --git a/playlet-lib/src/components/PlaylistView/PlaylistViewCell.bs b/playlet-lib/src/components/PlaylistView/PlaylistViewCell.bs index b478ace9..17cbc4c9 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistViewCell.bs +++ b/playlet-lib/src/components/PlaylistView/PlaylistViewCell.bs @@ -4,6 +4,7 @@ import "pkg:/source/utils/Types.bs" function Init() m.durationRect = m.top.FindNode("durationRect") m.durationLabel = m.top.FindNode("durationLabel") + m.progressRect = m.top.FindNode("progressRect") end function function OnContentSet() as void @@ -23,6 +24,8 @@ function OnContentSet() as void else m.top.durationRectVisible = false end if + + SetupProgress(content) end function function SetDurationText(text as string) as void @@ -41,3 +44,31 @@ function SetDurationText(text as string) as void rect.width = size.width + 16 rect.translation = [rectParent.width - rect.width, rect.translation[1]] end function + +function SetupProgress(content as object) + if m.progressNode <> invalid + m.progressNode.unobserveFieldScoped("timestamp") + m.progressNode = invalid + end if + + m.progressNode = content.progressNode + if m.progressNode <> invalid + m.progressNode.observeFieldScoped("timestamp", FuncName(SetProgress)) + end if + SetProgress() +end function + +function SetProgress() as void + if m.progressNode = invalid + m.progressRect.scale = [0, 1] + return + end if + + duration = m.progressNode.duration + timestamp = m.progressNode.timestamp + progress = 0 + if duration > 0 + progress = timestamp / duration + end if + m.progressRect.scale = [progress, 1] +end function diff --git a/playlet-lib/src/components/PlaylistView/PlaylistViewCell.xml b/playlet-lib/src/components/PlaylistView/PlaylistViewCell.xml index a42793c5..05851ebc 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistViewCell.xml +++ b/playlet-lib/src/components/PlaylistView/PlaylistViewCell.xml @@ -29,7 +29,13 @@ font="font:SmallestSystemFont" translation="[8, 0]" /> - + + + + + + + + + diff --git a/playlet-web/src/lib/Screens/Settings/SettingControls/NumberControl.svelte b/playlet-web/src/lib/Screens/Settings/SettingControls/NumberControl.svelte index b005297a..774cbe0a 100644 --- a/playlet-web/src/lib/Screens/Settings/SettingControls/NumberControl.svelte +++ b/playlet-web/src/lib/Screens/Settings/SettingControls/NumberControl.svelte @@ -1,17 +1,21 @@ diff --git a/playlet-web/src/lib/Stores.ts b/playlet-web/src/lib/Stores.ts index cda0be34..cbf028f3 100644 --- a/playlet-web/src/lib/Stores.ts +++ b/playlet-web/src/lib/Stores.ts @@ -15,6 +15,8 @@ export const userPreferencesStore = writable({} as any); export const invidiousVideoApiStore = writable({} as any); +export const localVideoApiStore = writable({} as any); + export const homeLayoutStore = writable([] as any); export const homeLayoutFileStore = writable([] as any); diff --git a/playlet-web/src/lib/VideoFeed/VideoListRow.svelte b/playlet-web/src/lib/VideoFeed/VideoListRow.svelte index d6a02824..3dd6c030 100644 --- a/playlet-web/src/lib/VideoFeed/VideoListRow.svelte +++ b/playlet-web/src/lib/VideoFeed/VideoListRow.svelte @@ -1,6 +1,10 @@