Fix video does not continuing from previous progress when opened

This commit is contained in:
Brahim Hadriche committed 2025-05-20 12:27:21 -04:00
1 parent f681a7024c
commit d2fbd59d6a
6 files changed
+31 -2

No files matched your search

+4 -1
View File
@@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
- Fix cache issue for watch history ### Fixed
- Cache issue for watch history
- Video progress not showing in web app - Video progress not showing in web app
- Video does not continuing from previous progress when opened
## [0.38.0] - 2025-05-19 ## [0.38.0] - 2025-05-19
@@ -471,7 +471,6 @@ function SeekToPercentOfDuration() as void
if seekToPercent = invalid if seekToPercent = invalid
return return
end if end if
m.seekToPercent = invalid
duration = m.top.duration duration = m.top.duration
if duration = 0 if duration = 0
@@ -485,6 +484,7 @@ function SeekToPercentOfDuration() as void
return return
end if end if
m.seekToPercent = invalid
seek = (MathUtils.Clamp(seekToPercent, 0, 100) / 100.0) * duration seek = (MathUtils.Clamp(seekToPercent, 0, 100) / 100.0) * duration
if seek > 0 if seek > 0
LogInfo("Seeking to percent duration watched", seek) LogInfo("Seeking to percent duration watched", seek)
@@ -44,6 +44,12 @@ namespace Http
return true return true
end if 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() instance = m.invidiousService.GetInstance()
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance) contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
@@ -79,6 +85,8 @@ namespace Http
if IsString(payload.timestamp) if IsString(payload.timestamp)
payload.timestamp = payload.timestamp.toInt() payload.timestamp = payload.timestamp.toInt()
else if IsString(payload.percentDurationWatched)
payload.percentDurationWatched = payload.percentDurationWatched.toFloat()
end if end if
instance = m.invidiousService.GetInstance() instance = m.invidiousService.GetInstance()
+14
View File
@@ -78,6 +78,13 @@ export class PlayletApi {
args.timestamp = parseInt(args.timestamp); 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); await PlayletApi.postJson(`${PlayletApi.host()}/api/queue/play`, args);
} }
@@ -99,6 +106,13 @@ export class PlayletApi {
args.timestamp = parseInt(args.timestamp); 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); await PlayletApi.postJson(`${PlayletApi.host()}/api/queue`, args);
} }
@@ -14,6 +14,7 @@
export let viewCount: number | undefined = undefined; export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean = undefined; export let isUpcoming: boolean = undefined;
export let premiereTimestamp: number | undefined = undefined; export let premiereTimestamp: number | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
export let videoStartAtChecked; export let videoStartAtChecked;
export let videoStartAtTimestamp; export let videoStartAtTimestamp;
@@ -69,6 +70,7 @@
liveNow, liveNow,
viewCount, viewCount,
timestamp, timestamp,
percentDurationWatched,
}; };
} }
@@ -103,6 +105,7 @@
bind:isUpcoming bind:isUpcoming
bind:premiereTimestamp bind:premiereTimestamp
bind:invidiousInstance bind:invidiousInstance
bind:percentDurationWatched
/> />
</div> </div>
<div class="m-4">{title || ""}</div> <div class="m-4">{title || ""}</div>
@@ -245,6 +245,7 @@
bind:isUpcoming bind:isUpcoming
bind:premiereTimestamp bind:premiereTimestamp
bind:viewCount bind:viewCount
bind:percentDurationWatched
videoStartAtChecked={false} videoStartAtChecked={false}
videoStartAtTimestamp={0} videoStartAtTimestamp={0}
/> />