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

CommentFileSizeAuthor
#1 youtube-HD-by-default-1864920-1.patch3.44 KBguschilds
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guschilds’s picture

Status: Active » Needs review
FileSize
3.44 KB

@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:

  • default (recommended)
  • 720p (or next highest available)
  • 1080p (or next highest available)

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

jlongbottom’s picture

Patch 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.

guschilds’s picture

Status: Needs review » Fixed

@eSentrik

I won't be committing this to the module (at least for now) for the following reasons:

  1. YouTube doesn't recommend doing this (see #1). You may even get worse results than letting it pick the quality based on the player size. Knowing this, I'm not 100% sure why you would want to force HD in a small player. You're forcing your users to download more data and receive a worse experience (unless they fullscreen, I guess).
  2. The original module creator wanted to keep this module as simple as possible. I don't believe this would be used enough to justify it adding the complexity it does.

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

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

added stack overflow link