Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I believe youtube looks at the dimensions of the embed iframe and determines which resolution to serve up so maybe this is not possible.
Some ideas here:
Adding vq=hd720 to the URL will do the trick, even when your iframe's dimensions are smaller.
http://stackoverflow.com/questions/8057047/youtube-iframe-embed-not-starting-in-hd
Comment | File | Size | Author |
---|---|---|---|
#1 | youtube-HD-by-default-1864920-1.patch | 3.44 KB | guschilds |
Comments
Comment #1
guschilds CreditAttribution: guschilds commented@esentrik
Your suspicions were correct. As explained in the Playback quality portion of YouTube's JavaScript API documentation, the default video quality is determined by the size of the video embed. They even suggest "For example, if your page displays a 1280px by 720px video player, a hd720 quality video will actually look better than an hd1080 quality video.". Forcing a resolution higher than the embed's dimensions may actually reduce the appearance of the video.
Before reading that I created (and have attached) a patch that allows the default video quality to be selected when altering the 'manage display' settings of a YouTube field. Under 'YouTube video quality' you should see three choices:
As explained in the API, if a particular video does not contain a resolution as high as the one selected with this setting, it will default to the highest resolution available.
Because YouTube recommends default and goes so far as to suggest that altering it may actually reduce quality, I'm not so sure this should be committed to the module. Going to mark as 'needs review' anyway before marking as 'fixed'. If you and/or others experience otherwise, perhaps it can become a part of this effort: #1571420: Add additional YouTube player options. Thoughts?
Let me know if this works for you.
Thanks,
Gus
Comment #2
jlongbottom CreditAttribution: jlongbottom commentedPatch works great! Thanks! And yes, I would say this should be a part of the core module. It is definitely something that people would use and want given the amount of support and forum discussions I found regarding the issue.
Comment #3
guschilds CreditAttribution: guschilds commented@eSentrik
I won't be committing this to the module (at least for now) for the following reasons:
That being said, anyone else who wants this feature should be able to come across this issue and discover this patch. If they use it, hopefully they'll add a comment here. If I'm wrong and it becomes a popular and desired feature, we can reconsider adding it.
I've also mentioned it in #1571420: Add additional YouTube player options to help guide anyone this way and to see if it draws any interest.
Thanks,
Gus
Comment #4.0
(not verified) CreditAttribution: commentedadded stack overflow link