WesselKroos / youtube-ambilight

This browser extension adds ambient light to YouTube videos
MIT License
87 stars 8 forks source link

Ambient light not loaded because the video cannot be found on the watch page #154

Closed Nate-Zephyr closed 1 year ago

Nate-Zephyr commented 1 year ago

Hello! YouTube have added their own ambient to some videos. Now your extension is overridden by that and doesn't work at all, even the settings button disappears. Please do something with that because your version of ambient is much better.

WesselKroos commented 1 year ago

You might have the same issue as #153 Make sure that you are on version 2.37.7 or higher.

Nate-Zephyr commented 1 year ago

image

Nate-Zephyr commented 1 year ago

The thread you sent me didn't give me anything. I attached a screenshot from the console window, this is the only error related to this extension or WebGL.

Also, I checked even small channels and unpopular videos, it looks like YouTube finally introduced its own ambient feature for everyone.

WesselKroos commented 1 year ago

On what version of the extension and on what browser are you?

Nate-Zephyr commented 1 year ago

I have the latest version of an Extension 2.37.7 and Chrome 109.0.5414.120. image image UI is Russian, but I'm not from Russia and I don't stand for this war xD

WesselKroos commented 1 year ago

In case that can only mean that the ambient light extension cannot find the <video> element in the webpage. But then it should, or not exist, or be at a location that is unknown to me.

Can you make a screenshot of the html structure with the location of the <video> in it?

For example: image

WesselKroos commented 1 year ago

Or it's maybe because of this setting. Can you turn of "Inline playback" in the YouTube settings and check if that fixes it if you refresh the page?

image

WesselKroos commented 1 year ago

Also, I checked even small channels and unpopular videos, it looks like YouTube finally introduced its own ambient feature for everyone.

Btw, that's true. But my extension overrides YouTube's ambient feature even when it is enabled.

WesselKroos commented 1 year ago

Another thing that we can check is if you can find the video element on the video webpage yourself by executing the javascript query selector: document.querySelector('ytd-app ytd-watch-flexy video.html5-main-video')

It should return the video element like this: image

Nate-Zephyr commented 1 year ago

image image image

Sorry but everything is same

WesselKroos commented 1 year ago
  1. Can you answer this question from me as well?

    Another thing that we can check is if you can find the video element on the video webpage yourself by executing the javascript query selector: document.querySelector('ytd-app ytd-watch-flexy video.html5-main-video')

    It should return the video element like this: image

  2. I can only see the video element in your html screenshot. Can you re-take the screenshot of the html with all these 3 elements in it: <body>, <ytd-watch-flexy> and <video>?

  3. I notice that there is a zoom-to-fill class on the <video>. That is a difference that I notice between your and mine html. It could indicate that YouTube is A/B testing a new feature that I do not have yet. Can you explain to me what this "zoom to fill" feature does? image

  4. Are you using other extensions as well? If that's the case, does it work in incognito mode with only my extension enabled?

Nate-Zephyr commented 1 year ago

1. image

  1. image image image

  2. This is another extension that I use for freely scaling videos because my monitor is 32:9 xD

  3. Funny, your extension works in incognito mode, both if I enable only yours, and if I enable all my extensions in incognito mode...

WesselKroos commented 1 year ago
  1. Funny, your extension works in incognito mode, both if I enable only yours, and if I enable all my extensions in incognito mode...

Aha, Then it's probably caused by a setting/feature of another extension. Let me know when you have figured out which extension setting/feature is causing it. Then I can reproduce it in my browser and see if I can fix it for you.

Nate-Zephyr commented 1 year ago

DUDE! You won't believe me, but I found a solution (but I don't like it)

How it was:

In incognito mode, I decided to try to log into my YouTube account. After logging into my account, your extension stopped working. Then I logged out of my account, and the extension worked again.

Then I tried to log out of the account in "non-incognito" mode. The extension started to work. But when I logged back into my account, the extension stopped working again.

Everything is cool, but it is extremely inconvenient for me to watch YouTube without my account. Is there something wrong with my account settings?

Nate-Zephyr commented 1 year ago

About your question:

Your extension works in incognito mode (and not incognito also), with ALL of my extensions, I've allowed them ALL to run in incognito mode.

However, if I'm logged in, the extension stops working.

Nate-Zephyr commented 1 year ago

Sadly, it's definitely something related to my account. I tried to log into my other YouTube account, it's clean, there is no channel created, and the extension started to work...

WesselKroos commented 1 year ago

Wow, that's strange. Then it could be a specific setting account setting or something YouTube is A/B testing on your account. You could check if the PREF cookie value is the same for both accounts. And if they are different, check what happens when you set switch the cookie values for both accounts. For example, my PREF cookie value is: f6=40000080&tz=Europe.Amsterdam&f7=151&f5=30000&hl=en
YouTube builds up the webpage by reading this cookie. So if that works for you could you share the value for your 2 account? Then I might be able to reproduce it.


Alos... looking at the extension code the only theoretical way it cannot find the video is if there are multiple ytd-app elements in the html. Then it could be possible that the video is in a second or third ytd-app element. But normally there is only one ytd-app element.

Since I do not have your account... You could try to debug it yourself: Set a breakpoint in this line in the extension code (the line numbers might be different from yours): image

Then check if the ytdAppElem is linking to the correct element in the html: image

Or you could execute document.querySelectorAll('ytd-app') to check if there are multiple ytd-app elements.

Alternatively we we could have call, via Discord or another chat app, in which you can share your screen so that we can debug it together .

Nate-Zephyr commented 1 year ago
  1. PREF cookie is not a problem i think. The value is the same for both accounts. I've tried to swap cookies of my accounts, I've tried to paste your cookie in my account.. Everything same. Here is my PREF cookie value: tz=Europe.Warsaw&f6=40000000&f5=30000&f7=150&f3=8&f4=4000000

  2. Debugging xD I just don't understand what I'am doing. image

  3. Ofc we could have a call via Discord. Here is my username. Натаниэль Хуй#7740 Today I have a day off. But please first text, then call.

WesselKroos commented 1 year ago

After analyzing the crash reports, I come to the conclusion that there are at least 400 users with this issue. Because a specific crash report is now gone for Opera and Firefox (2.37.14) users but is still being reported by users of the Chrome and Edge browsers (2.37.13).

Probably most of them didn't notice it when the extension suddenly disappeared. And some of them are users that tried the extension, saw that it does not work and then uninstalled it.