Greasy Fork is available in English.

Youtube HD

Select a youtube resolution and resize the player.

< Opinie na Youtube HD

Ocena: Dobry - skrypt działa

§
Napisano: 01-03-2018

Embedded Youtube videos support

If it's possible, please, add support for embedded Youtube videos. Currently script works only on youtube.com, even setting // @include * has no effect.

adisibAutor
§
Napisano: 01-03-2018

Hello TerribleIvan,

I've checked it out, and indeed it does not seem to be working when I add " @include * " and remove " @noframes ". Thanks for letting me know about the issue.

I'll take some time to see if I can get it working for embeds again. Do keep in mind that this isn't an officially supported feature and the script is designed to be used only on youtube's website. I'll let you know when I have an update on this issue.

adisibAutor
§
Napisano: 01-03-2018

I have investigated further. It turns out, the script seems to be setting resolution correctly. The video's quality is still incorrectly labeled as "Auto", but despite that seem to stay on whatever quality the Youtube HD script specified. So youtube has a bug where it sometimes mislabels the quality as Auto when it is not. Only the auto quality setting is supported for embeds, the script will not change the actual size of embedded videos by design.

The script is therefore working fine on embedded videos for me. If it is not for you, please make sure to both add " @include * " and remove " @noframes " from the script's metadata. If it still isn't working for you, please provide a link to an example embed where it isn't working, and let me know what script settings you have chosen, and I will try to get the issue resolved.

§
Napisano: 02-03-2018

You are right! Removing @noframes and adding "*" to included sites enables HD playback for embedded videos, although video's quality is still incorrectly labeled as "Auto". What's more interesting is compatibility with YouTube Link Title script, when @noframes is removed. Different videos open with different video quality settings. https://www.youtube.com/watch?v=mXEqIrkNOrk - starts with HD selected (no "auto" sign) https://www.youtube.com/watch?v=q-wTKKod0rQ - starts with HD selected ("auto" sign) https://www.youtube.com/watch?v=6BKkfePXAPU - starts with HD selected (no "auto" sign), but requires an additional click to start playback

Maybe this weird behaviour is connected with Youtube video permissions.

adisibAutor
§
Napisano: 02-03-2018

I believe whether or not the Auto appears depends on if the buffer has to be flushed. Flushing the buffer will update it to not say auto, but simply changing the resolution will only update the Auto text on youtube's website.

If the Youtube HD script is disabled, you will notice that the first and third video will default to 720p, whereas the second will default to 1080p (probably because it is just a static image and so is more easily compressed). Thus when the script sets resolutions, it doesn't flush the buffer for the second video, so it will keep the auto text. I got the same results as you, but other people might have to flush the buffer more or less often depending on their bandwidth affecting what youtube chooses as auto.

Whether the Youtube Link Title script is running made no difference for me. The third video did not require an additional click. It is possible that there is an incompatibility with another script that causes that, but I did not encounter it with the Link Title script.

§
Napisano: 02-03-2018

That's the point: if the Youtube HD script is disabled, all embedded videos are default to auto 360 (not 1080p). Unless @noframes is removed all videos are default to auto 360, without @noframes all videos are set to auto HD (1080 or 720, respectively) To reproduce the difference between videos above, you need to use clean profile (site history cleared). I checked it on latest Firefox 58.0.2 portable (clean profile) and Tampermonkey. No other scripts, except Youtube HD.

§
Napisano: 04-11-2018
Edytowano: 04-11-2018

How do you explain that the embed mode works well, but not in this page for example: https://www.gamekult.com/emission/dans-4-minutes-vous-connaitrez-sea-of-thieves-presque-aussi-bien-que-nous-3050803285.html ?

adisibAutor
§
Napisano: 05-11-2018

Hello Troudhyl,

The page you have linked does not use a youtube embedded player. It uses the dailymotion embedded video player. My script uses the youtube API to set video quality, and the dailymotion API is not compatible with youtube's.

It is most likely possible to make a script that will provide the same functionality with the dailymotion player, but this script is intended specifically for youtube only, and I'm not going to create another script for the dailymotion video player at this time.

If you or someone else is interested in trying to making a script for the dailymotion player, you can find the API here: https://developer.dailymotion.com/player#embedding

§
Napisano: 05-11-2018

Oh, sorry sorry, I forgot that, you can't see it: I have a "premium" account on Gamekult, and premium users have a YouTube player instead of Dailymotion (because they generally prefer the YouTube one). I will try (not this evening) to find or make a public example. The embedded code is:

<iframe frameborder="0"
        width="100%"
        height="350"
        src="https://www.youtube.com/embed/xkUilC1X3o0?autoplay=1"
        allowfullscreen>
</iframe>

(you can see that it's the same video but on YouTube) And I made a script to disable this autoplay. Maybe it's because of elsewhere on the page, I don't know, I tried to copy all the source code of the page to try on a copy on my server (and show you) but... it works! I have to investigate more, but I have no idea about what to try.

(About Dailymotion I made my own script to disable the playlist at right etc. but the quality can't be set like YouTube, sadly, even with &quality=1080 it's always Auto)

adisibAutor
§
Napisano: 06-11-2018

As it turns out, this may not be working correctly for embeds after all. I just re-tried the videos mentioned above. The Stellaris video appropriately sets whatever resolution I specify ("hd1080" makes it 1080p, and "large" makes it 480p). However, the first video seems to be capped at 480p for me.

My script is giving me a message that a new video has loaded every time it changes the resolution, which doesn't happen on the youtube website. What seems to be happening as far as I can tell so far is that my script is indeed telling it to change the resolution, but embeds treat the API differently causing it to always re-load a different video to send. This seems to cause auto resolution to be applied again. My script makes sure that the correct resolution is set after the video change, but it seems to do this before the auto resolution figures out what it wants to change it to, so the auto resolution ends up winning. In the case of the stellaris video it doesn't feel the need to change it from whatever it was before, whereas the first one feels the need to degrade the resolution for bandwidth reasons if it is above 480p for me.

If this is what is happening, I'm not sure what to do about it. I am reliant on the API youtube provides, and the API is behaving differently for embeds. If I could force it to set resolution after auto does, it wouldn't help; the video would get stuck as they constantly keep fighting each other and constantly reload the video.

I don't know if this is the same issue you are facing or not. I'll investigate it later when I have more time.

adisibAutor
§
Napisano: 06-11-2018

As an additional note, if you happen to be using Greasemonkey of version 4.0 or higher as your userscript manager, the script will not work for embeds because the webextension version of greasemonkey does not inject scripts into iframes.

§
Napisano: 18-11-2018
Edytowano: 30-11-2018

I use ViolentMonkey at home (I had some problems to upgrade Greasemonkey to webextension, but at work, no problem, and I use it).

As I said, it works correctly for all embedded videos (on this page, no problem with the first video, on other websites too), the only exception I know is Gamekult, I don't know why.

§
Napisano: 30-11-2018
adisibAutor
§
Napisano: 01-12-2018

Troudhyl thanks for the example page.

For me, when I set my script to work for embeds, and then tell it to do "medium" for 360p, it will give me 360p; if I tell it to do "hd1080" for 1080p, it will set it to 1080p for me. It will only do it immediately if I refresh the page or set flushBuffer to true, otherwise I have to wait 5-10 seconds for the buffer to end before it shows up as HD. If however I set the speed to 2x, the player will downgrade it to 720p since Auto isn't turned off.

So my script seems to be working to suggest a quality level, but youtube doesn't let me turn off "Auto" for embeds so your quality may be adjusted away from what my script says if Auto wants to. But for me, Auto doesn't change anything.

I haven't found a workaround to turn off Auto for embedded videos yet; I'll look into it when I have more time on my hands. Nothing seems any different for that site than for any embed on other sites.

Odpowiedz

Zaloguj się, by odpowiedzieć.