Greasy Fork is available in English.

Youtube HD

Select a youtube resolution and resize the player.

< Feedback on Youtube HD

Soru/yorum

§
Gönderildi: 19.10.2023

Is there a way to enable 1080p enhanced bitrate for Premium users?

Here's a random Youtube video that supports enhanced bitrate.

https://www.youtube.com/watch?v=r6Rp-uo6HmI

adisibSahip
§
Gönderildi: 20.10.2023

Hey, thanks for the interest in improving the script. This was requested before, but unfortunately I didn't have the time to take a look until recently, so thanks for the reminder.

Youtube does not offer a way to choose the premium quality through the API that I have been using. So I have tried to workaround that by writing in another method that just simulates clicking the buttons. It will likely break pretty often as youtube makes layout changes, but should work for now. I pushed the update to Greasyfork only for now so people can try it out. I do not actually have premium myself right now, so I haven't been able to test it very thoroughly.

Please update and give it a try and let me know how it works.

§
Gönderildi: 20.10.2023
Düzenlendi: 20.10.2023

For me, this is hit or miss. Sometimes the page loads slowly (due to lots of tabs open) and when it does the userscript can leave the YouTube settings menu open, having not selected anything. The menu is just left open, blocking the video.

I don't have Premium, so don't care about that, I just use this userscript to make all videos be explicitly set to whatever the highest resolution is at 1080p or lower instead of Auto so that it buffers instead of playing at lower resolution/bitrate until it realizes that I have enough bandwidth to do 1080p (or whatever the highest resolution is that is lower than 1080p).

Will the script still work if I revert back to the previous one (as long as I don't need Premium)?
Firefox on Windows 11.

adisibSahip
§
Gönderildi: 20.10.2023

Thanks for the feedback. It should only use the settings menu if you have premium and the video supports premium. What I suspect happened is that I had initially pushed this with the wrong configuration and then quickly fixed the configuration without updating the version number. It is possible you auto-updated but then didn't get the configuration fix (you can check this by checking the "useAPI" configuration option). I did just update the version number before writing this out to make sure people will get the configuration update. As long as "useAPI" is set to true then it should never open the youtube settings menu for non-premium (if it does then there is a bug). I suspect it will only leave it open if an advertisement plays (which shouldn't happen with premium). It will still work on the previous version, but if you updated to today's version you shouldn't have that issue.

§
Gönderildi: 20.10.2023
Düzenlendi: 20.10.2023

What do you mean by the "useAPI" configuration option? The setting of the variable in the script, or is there some other external setting that does not require modifying the script to change it? I would think that changing variables in the script wouldn't be a great way to change these options, as an update of the script would overwrite them. Is there some external way of maintaining these settings (I use Violentmonkey; not sure if that is a factor)?

In any case, I had reverted back to the older version of the script so can't check that option (although I THINK when I looked at it before reverting, it was set to "true"), but now since seeing your response, have re-updated to the latest release.

Preliminary testing seems to look good. I will let you know if I see any further anomalies.

Thanks for your quick support!

adisibSahip
§
Gönderildi: 20.10.2023

I did in fact mean editing the script to change the value. You are right, it isn't a good system. Overwriting normally isn't an issue because userscript managers should not auto-update a modified script, but you will need to know to manually check for updates and need to remember to apply your configuration again when manually updating.

Someone did open up a discussion very recently on configuration here, so maybe things will change:
https://greasyfork.org/en/scripts/23661-youtube-hd/discussions/207792#comment-437768

Glad to hear things seem to be working fine so far, please let me know if you do find any more issues.

§
Gönderildi: 22.10.2023

The userscript seems to be working, however, since updating to the new version, I occasionally see a rectangle with rounded corners in the lower right area of the video, taking up about 1/4 of the screen. This rectangle has the top left quarter of itself shaded in red.

I have no idea if it is caused by this userscript, I don't even know what it is, but if I click on the gear icon on the video, it goes away.

Note that this has only happened about 5 times out of about the 40-50 videos I have watched and I cannot reproduce it if I purposely try, but in the few times it did happen, and I remembered to look, they were all videos that had the "1080p Premium" quality option available.

I have attached a photo of what the video looks like when this strange pop-up appears.

§
Gönderildi: 23.10.2023

Just had this happen again... It was a "1080p Premium" video and if I click on the rectangle, nothing happens, but if I click on the video window where the rectangle is not covering it (I assume anywhere) it goes away.

Note that I do have other add-ons installed that affect YouTube (like adding additional buttons and menu items), so it could be them interacting with your userscript, or I suppose it may have nothing to do with your userscript. The main reason I think YouTube HD may be involved is because it started happening only after it was recently updated.

Thanks again!

§
Gönderildi: 23.10.2023

I just figured it out! I have the add-on OwlZoom installed and that rectangle is from it.

I am guessing that the userscipt is somehow toggling it, since it does modify the YouTube menu, and I assume your userscript may not be able to handle it.

It's not supposed to show that rectangle though unless the video is zoomed in, which it is not.

adisibSahip
§
Gönderildi: 23.10.2023
Düzenlendi: 23.10.2023

Hey, I've taken a look at the source code for that extension to see what the problem is.

What my code does is look for an element with a class "ytp-settings-button" attached to it. Youtube seems to prefer to not assign an id to its page elements but does frequently give them unique classes for the same purpose (I don't know why they prefer to have the unique identifiers as a class over an id). That class is the only reasonable way to access the settings button.

What OwlZoom does is add another button to the page with the same class values as YouTube's settings button, and that button will open that overlay. That means that my script can grab OwlZoom's button instead. This normally shouldn't be a problem, because when grabbing the element by class name, order is guaranteed by the spec, and YouTube's settings button should always be the first in order I think based on the quick look I've taken. So this should only happen if the YouTube settings button doesn't exist yet. I don't see that element in the static HTML so it looks like YouTube loads the settings button dynamically and so we have a race condition. This will happen if my script runs after OwlZoom's (which is likely, because mine might wait extra time for the API to become available), and if YouTube doesn't add the button before both of the scripts execute.

I'm guessing that OwlZoom only uses those classes so that it can re-use the styling. I do NOT want to change the way I am finding the settings button, because any other way would be bad design with a high likelihood of breaking as YouTube makes layout changes. OwlZoom probably also wants to keep re-using those classes because CSS doesn't have an inheritance mechanism that would make it easy to do and keep the same styling. So I don't think either script is really doing anything wrong as much as it is YouTube doing bad design by using classes like IDs. You could see if OwlZoom would be willing to change their styling approach to be more accommodating to other scripts that want to access the settings button, since I doubt that my script is the only one that can have that potential incompatibility.

§
Gönderildi: 23.10.2023

Works fine at this stage. Realised I didn't set "useAPI = false;" and I was wondering why it wasn't working.

§
Gönderildi: 24.10.2023

Thanks a lot for taking a look at this, I hope I didn't send you on a wild goose chase before I determined it was a conflict with an add-on you knew nothing about. I probably should have realized it sooner, but I haven't used that add-on in a while and without the video actually being zoomed, it didn't click with me what it was.

Anyway, it's not a big deal, it's easy enough to dismiss the pop-up when it happens, and it happens fairly rarely, so no big deal. I may even disable the add-on until I start needing it again.

§
Gönderildi: 24.10.2023

Just one more question...

OwlZoom does not display the button that pops-up that rectangle unless you go in to the settings menu and change the zoom level to something other than 100%.
Since the button is hidden when this "bug" displays itself, is there some sort of element on the class you select that you can check to make sure it is not "hidden"?

Now, I don't know much about this, but I have made a few userscripts in the past, so know enough to get myself in trouble, and I was wondering...

Looking at the buttons in the Firefox inspector I see that the OwlZoom button has these elements set when at 100% zoom (default):

id="ScaleBtn"
style="display: none;"

And these set when you are zoomed (non-100%):

id="ScaleBtn"
style=""

Whereas the YouTube menu button does not have this element at all.
So it looks like this button can be uniquely identified by looking at one of these elements.


Also, the YouTube menu button has this element set:

aria-label="Settings"

Whereas the OwlZoom button has no such element.


Perhaps you can use these elements to select the correct button/determine if is available yet?


Also, since I don't have YouTube Premium should it even need to access this button at all? Shouldn't it just use the legacy way of changing the resolution?

adisibSahip
§
Gönderildi: 25.10.2023

You are right, it should not need to use the button if you do not have YouTube premium. I took a look and found the issue, and it has been corrected in version 2023.10.24. I also have changed to use a query selector to try to ignore OwlZoom's button, so that issue should be double fixed for you now. Please update and let me know if you run into any issues.

§
Gönderildi: 25.10.2023

Fantastic! Thanks for following up on this, I have installed the new version and will let you know if I have any issues.

Cevap paylaş

Yanıt göndermek için oturum açın.