Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop sponsorblock on playback preview videos #104

Merged
merged 1 commit into from
Oct 19, 2024

Conversation

alyyousuf7
Copy link

@alyyousuf7 alyyousuf7 commented Nov 3, 2023

Symptom

  1. Open the app
  2. Select and play a video (try a video that has a skippable part early in the video - try this one maybe)
  3. Go back to home and press left/right/up/down button to hover over another video
  4. You will notice that any video you hover over, skips the same time segments as the one you opened earlier in step 2.
    i. You'll also see the notification for it as well
    ii. In console, you'll see the logs for the previous video ID, confirming that its executing previous video's skip segments

Cause

When a video is loaded, we initialize SponsorBlock. However, if you go back to YouTube homepage, and hover on a video tile, it starts to play a video.

Since SponsorBlock is already initialized, the listeners for video element are still listening to video's play, pause, timeupdate and durationchange listener - technically, the video element on a /watch page is the same video element on home page for preview playback.

This causes it to execute back the scheduleSkipHandler.

Ideal Solution

IDEALLY, we would want to load SponsorBlock for the video being played in the preview on homepage.

However, there is no way (or should I say an easy way) to know the video ID for the preview playback video.

Proposed Solution

When the page is changed, and it is not the video page, uninitialize SponsorBlock.

@fire332
Copy link

fire332 commented Nov 4, 2023

However, there is no way (or should I say an easy way) to know the video ID for the preview playback video.

You can access the player API from the #ytlr-player__player-container-player element.
I.E. document.getElementById('ytlr-player__player-container-player').getVideoData().video_id

@alyyousuf7
Copy link
Author

Interesting, will take a look

@cremor
Copy link

cremor commented Mar 16, 2024

I've noticed a similar bug. If you replace step 3 in your steps above with "play any short" then the app will skip the same time segments in the short. Is this also fixed by this PR?

@alyyousuf7
Copy link
Author

alyyousuf7 commented Mar 16, 2024

I've noticed a similar bug. If you replace step 3 in your steps above with "play any short" then the app will skip the same time segments in the short. Is this also fixed by this PR?

I haven't tried it, but the symptom that you're describing is exactly the same and this PR should fix it.

As described in the PR - the SponsorBlock was still loaded with previous video's time segment details - and the skipping logic would continue on any video the app plays - including the shorts.

@cremor
Copy link

cremor commented Mar 25, 2024

@Informatic @throwaway96 I've tested this on an LG OLED C9 (webOS 4.9.7) and it it looks like it works fine. Meaning I've not seen any unexpected skips in shorts any more. Would be great if it could be merged.

@throwaway96 throwaway96 added this to the v0.3.4 milestone Mar 30, 2024
@throwaway96 throwaway96 modified the milestones: v0.3.4, future Apr 8, 2024
@throwaway96 throwaway96 merged commit bd7e72c into webosbrew:main Oct 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants