Fix sponsorblock set progress onVideoEnd

This commit is contained in:
MerlinScheurer 2025-01-31 17:56:35 +01:00
parent 168412724e
commit 45da47f99b
1 changed files with 10 additions and 4 deletions

View File

@ -158,10 +158,16 @@ const VideoPlayer = ({
watched: boolean,
setSponsorSegmentSkipped?: Dispatch<SetStateAction<SponsorSegmentsSkippedType>>,
) =>
async () => {
if (!watched) {
// Check if video is already marked as watched
await updateWatchedState({ id: youtubeId, is_watched: true });
async (videoTag: VideoTag) => {
const currentTime = Number(videoTag.currentTarget.currentTime);
const videoProgressResponse = await updateVideoProgressById({
youtubeId,
currentProgress: currentTime,
});
if (videoProgressResponse.watched && watched !== videoProgressResponse.watched) {
onWatchStateChanged?.(true);
}
setSponsorSegmentSkipped?.((segments: SponsorSegmentsSkippedType) => {