diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc8830f..77112799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Fix cache issue for watch history +### Fixed + +- Cache issue for watch history - Video progress not showing in web app +- Video does not continuing from previous progress when opened ## [0.38.0] - 2025-05-19 diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs index 76d27276..cb39a7ab 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs @@ -471,7 +471,6 @@ function SeekToPercentOfDuration() as void if seekToPercent = invalid return end if - m.seekToPercent = invalid duration = m.top.duration if duration = 0 @@ -485,6 +484,7 @@ function SeekToPercentOfDuration() as void return end if + m.seekToPercent = invalid seek = (MathUtils.Clamp(seekToPercent, 0, 100) / 100.0) * duration if seek > 0 LogInfo("Seeking to percent duration watched", seek) diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs index 5b10ccef..d02a4dff 100644 --- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs +++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/VideoQueueRouter.bs @@ -44,6 +44,12 @@ namespace Http return true end if + if IsString(payload.timestamp) + payload.timestamp = payload.timestamp.toInt() + else if IsString(payload.percentDurationWatched) + payload.percentDurationWatched = payload.percentDurationWatched.toFloat() + end if + instance = m.invidiousService.GetInstance() contentNode = InvidiousContent.ToRowCellContentNode(payload, instance) @@ -79,6 +85,8 @@ namespace Http if IsString(payload.timestamp) payload.timestamp = payload.timestamp.toInt() + else if IsString(payload.percentDurationWatched) + payload.percentDurationWatched = payload.percentDurationWatched.toFloat() end if instance = m.invidiousService.GetInstance() diff --git a/playlet-web/src/lib/Api/PlayletApi.ts b/playlet-web/src/lib/Api/PlayletApi.ts index bdad4dc7..9d11835c 100644 --- a/playlet-web/src/lib/Api/PlayletApi.ts +++ b/playlet-web/src/lib/Api/PlayletApi.ts @@ -78,6 +78,13 @@ export class PlayletApi { args.timestamp = parseInt(args.timestamp); } } + + if (args.percentDurationWatched !== undefined) { + if (typeof args.percentDurationWatched === "string") { + args.percentDurationWatched = parseFloat(args.percentDurationWatched); + } + } + await PlayletApi.postJson(`${PlayletApi.host()}/api/queue/play`, args); } @@ -99,6 +106,13 @@ export class PlayletApi { args.timestamp = parseInt(args.timestamp); } } + + if (args.percentDurationWatched !== undefined) { + if (typeof args.percentDurationWatched === "string") { + args.percentDurationWatched = parseFloat(args.percentDurationWatched); + } + } + await PlayletApi.postJson(`${PlayletApi.host()}/api/queue`, args); } diff --git a/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte b/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte index 838f62fd..3d0010cb 100644 --- a/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte +++ b/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte @@ -14,6 +14,7 @@ export let viewCount: number | undefined = undefined; export let isUpcoming: boolean = undefined; export let premiereTimestamp: number | undefined = undefined; + export let percentDurationWatched: number | undefined = undefined; export let videoStartAtChecked; export let videoStartAtTimestamp; @@ -69,6 +70,7 @@ liveNow, viewCount, timestamp, + percentDurationWatched, }; } @@ -103,6 +105,7 @@ bind:isUpcoming bind:premiereTimestamp bind:invidiousInstance + bind:percentDurationWatched />
{title || ""}
diff --git a/playlet-web/src/lib/VideoFeed/VideoCell.svelte b/playlet-web/src/lib/VideoFeed/VideoCell.svelte index 85682485..f11bc61a 100644 --- a/playlet-web/src/lib/VideoFeed/VideoCell.svelte +++ b/playlet-web/src/lib/VideoFeed/VideoCell.svelte @@ -245,6 +245,7 @@ bind:isUpcoming bind:premiereTimestamp bind:viewCount + bind:percentDurationWatched videoStartAtChecked={false} videoStartAtTimestamp={0} />