mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-23 17:25:14 +02:00
fix: Watch state not saving on some items
This commit is contained in:
@@ -52,9 +52,9 @@
|
||||
});
|
||||
|
||||
function reportProgress() {
|
||||
if (video?.readyState === 4 && progressTime > 0 && videoDuration > 0)
|
||||
if (video?.readyState === 4 && video?.currentTime > 0 && video?.duration > 0)
|
||||
reiverrApiNew.users.updateMoviePlayStateByTmdbId($user?.id as string, tmdbId, {
|
||||
progress: progressTime / videoDuration,
|
||||
progress: video.currentTime / video?.duration,
|
||||
watched: progressTime > 0.9
|
||||
});
|
||||
}
|
||||
@@ -135,7 +135,7 @@
|
||||
// ? `${$user?.settings.jellyfin.baseUrl}/Items/${item?.Id}/Images/Backdrop?quality=100&tag=${item?.BackdropImageTags?.[0]}`
|
||||
// :
|
||||
'',
|
||||
startTime: stream.progress * stream.duration
|
||||
progress: stream.progress
|
||||
// (options.playbackPosition || 0) / 10_000_000 ||
|
||||
// (item?.UserData?.PlaybackPositionTicks || 0) / 10_000_000 ||
|
||||
// undefined
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// video.srcObject = null;
|
||||
// hls?.destroy();
|
||||
|
||||
const { playbackUrl, directPlay, backdrop, startTime } = playbackInfo;
|
||||
const { playbackUrl, directPlay, backdrop, progress } = playbackInfo;
|
||||
|
||||
if (backdrop) {
|
||||
video.poster = backdrop;
|
||||
@@ -55,9 +55,9 @@
|
||||
video.src = playbackUrl;
|
||||
}
|
||||
|
||||
if (startTime) {
|
||||
progressTime = startTime;
|
||||
}
|
||||
// if (progress) {
|
||||
// progressTime = startTime;
|
||||
// }
|
||||
}
|
||||
|
||||
function handleProgress() {
|
||||
@@ -104,8 +104,14 @@
|
||||
on:timeupdate={() => (progressTime = !seeking && videoDidLoad ? video.currentTime : progressTime)}
|
||||
on:progress={handleProgress}
|
||||
on:loadeddata={() => {
|
||||
video.currentTime = progressTime;
|
||||
// console.log('video loaded', video.currentTime, video.duration, playbackInfo?.progress);
|
||||
// video.currentTime = progressTime;
|
||||
videoDidLoad = true;
|
||||
|
||||
if (video.currentTime < video.duration * (playbackInfo?.progress || 0)) {
|
||||
video.currentTime = video.duration * (playbackInfo?.progress || 0);
|
||||
}
|
||||
|
||||
console.log('Video loaded');
|
||||
}}
|
||||
on:waiting={() => (buffering = true)}
|
||||
|
||||
@@ -36,7 +36,7 @@ export type PlaybackInfo = {
|
||||
playbackUrl: string;
|
||||
directPlay: boolean;
|
||||
backdrop?: string;
|
||||
startTime?: number;
|
||||
progress?: number;
|
||||
|
||||
audioStreamIndex: number;
|
||||
audioTracks: AudioTrack[];
|
||||
|
||||
Reference in New Issue
Block a user