crazyrabbit0 / UserScripts

UserScripts for Browser Extensions
GNU General Public License v3.0
5 stars 0 forks source link

Firefox - Random Video Skip #1

Closed Fantazstic closed 6 months ago

Fantazstic commented 7 months ago

I wanted to firstly thank you for creating this script, I can't imagine using my large (almost 600 items) music playlist without it.

I noticed that before using the script, Youtube can automatically move to next song up to a certain point (I remember similar reports of around video number 400+) which is when I started to look for and found this script to solve that issue.

It works really well for those videos where it just pauses at the end without moving to next song.

However, when viewing the first few videos (up to around 400), the script tends to trigger after/at the same time as when Youtube was already moving to next song anyway, and this results in a video being skipped. Unfortunately, it seems inconsistent as I assume it depends on network and hardware as well.

I find that it is more reproducible when you start the playlist and then open a new tab (I'm using Firefox browser on Windows 10) but it can still occur while you are directly viewing the Youtube tab.

I've tried my own edits to the script, such as waiting for the "Replay" button before pressing the next button, which works exactly as this script does, but this skipping bug still exists.

I think the solution is to find out a specific tag when Youtube is going to automatically move on to next song, which doesn't appear when the playlist abruptly stops. My limited knowledge prevents me from approaching this problem and generating solutions for it.

Another idea I tried to implement was to track any changes to the Youtube video title, but I cannot make this work well enough to overcome the bug and keep the playlist movement at the same time.

Thank you for reading my bug report and hopefully we can fix this as a community. Please let me know if you need any further information.

Fantazstic commented 7 months ago

I believe I am mistaken. The bug only occurs when the browser tab/window is in the background. If you are directly viewing the tab, the bug does not occur.

crazyrabbit0 commented 7 months ago

You are welcome!

Thanks for your elaborate testing, the main issue is: I can't reproduce the bug on my pc.

Nevertheless, I made some changes based on a hunch, can you try this test and let me know if it works correctly ?

Fantazstic commented 7 months ago

@crazyrabbit0

Hi, thanks for the quick testing branch release. Unfortunately, the bug still occurs.

Following my last message, I think it should be reproducible on stable and testing branch if you do the following:

  1. Find a large playlist that is affected by the playlist stop issue.
  2. Play the first song in the playlist and skip to near the end of the video.
  3. Quickly open a new tab and wait.
  4. You will see the Youtube tab move on to the second song but only very briefly.
  5. It then moves to the third song, therefore missing out the second song.

This only occurs if you open a new tab/browser window (basically the Youtube tab/browser window is in the background).

Fantazstic commented 7 months ago

@crazyrabbit0

I have found a solution!

It seems to be caused by browser throttling the webpage when it's in the background, therefore the efficiency of the script is reduced and causes unintended bugs.

In Firefox, the following setting in about:config can be used to fix the issue:

dom.min_background_timeout_value_without_budget_throttling should be set to 10 (default is 1000).

Source - reddit (ignore the other boolean-type settings, they don't seem to have an effect)

So current stable branch is now working fine, there's no need to switch over to playback percentage tracking if we don't have to.

crazyrabbit0 commented 7 months ago

Maybe that's why I don't have the problem. I use Chrome, not Firefox. This is not an actual fix to the script though, meaning I can't do something about it. Thanks again for your contribution! 🙏

crazyrabbit0 commented 7 months ago

@Fantazstic Do you happen to use the Adblock Plus extension ?

Fantazstic commented 7 months ago

@crazyrabbit0

I use uBlock Origin in Firefox.

crazyrabbit0 commented 7 months ago

Pity, I hoped it was the same bug as this one: #2 Nevermind, thanks for letting me know.