0

Is there a way to set default Youtube video quality when displaying video with Fancybox? I tried supplying &hd=1 query-string parameter in video url, as suggested by Youtube, but looks like this gets ignored when Fancybox embeds video... Sometimes it embeds 260p, sometimes 320p, sometimes 480p and I am out of idea how to alter this parameter.

http://www.youtube.com/watch?v=VRT0OhHnOzo&autoplay=1&hd=1

If the URL is entered directly into browser then yotube displays HD version when supplying &hd=1 parameter.

Primoz Rome
  • 10,379
  • 17
  • 76
  • 108
  • what width/height you set up for your fancybox area? I have found this comment "Actually, I was just able to figure it out: I simply made the fancybox container bigger and it worked. I'm getting the "height" and "width" were somehow interfering with HD mode. As for the parameter being deprecated, you are absolutely right. However, it seems to work fine on Chrome, FF, Safari, and Opera browsers. IE browsers are a no-go, but no surprises there, right? What I did notice is that the hd parameter sets the video in 720 resolution, even if the video in question is also available in 1080 or 4K." – KennyPowers Jan 30 '13 at 09:38
  • I am using 853x480px but for some videos it chooses me only 260p video size. I would like to force it to use at minimum 480p or preferred HD! – Primoz Rome Jan 30 '13 at 11:31
  • I tried now to resize fancybox area but embedded video still @ 260p so I don't think this is a solution. – Primoz Rome Jan 30 '13 at 11:42

1 Answers1

0

Ok I found the solution with the help of this question.

The code I used and worked with Fancybox 2 is:

$('.fancybox-media').fancybox({
    openEffect  : 'none',
    closeEffect : 'none',
    width : 1000,
    height : 563,
    helpers : {
        media: true
    },
    youtube : {
        autoplay: 1,
        hd: 1,
        vq: 'hd720'
    }
});

The key is the youtube: part... You can also supply vq: '1080' this will then force 1080p video quality.

Community
  • 1
  • 1
Primoz Rome
  • 10,379
  • 17
  • 76
  • 108
  • there's no such parameter as `vq` in helpers/jquery.fancybox-media.js so it cannot work as you wanted. Even if you set up media helper hd = 1 it doesn't work. All you need is to have width/height more or equal that HD width/height. I'm not sure it's possible to force youtube hd. If you have live example please let me know as mine doesn't work like you said. – KennyPowers Jan 30 '13 at 12:35
  • That is not completely true. I have contacted the fancybox2 creator and he answered me I can put vq parameters into media helper and the `&vq=value` will be appended to the Youtube video URL which is then used in the iFrame src attribute. The above solution definitely works, I have tested and implement it with latest version of Fancybox2 (with media Helper). – Primoz Rome Jan 30 '13 at 14:13
  • can you please upload it somewhere? jsfiddle probably? thanks! – KennyPowers Jan 30 '13 at 14:20
  • Also check https://developers.google.com/youtube/2.0/migration#vq_to_q and https://developers.google.com/youtube/player_parameters ... `hd` has been deprecated and doesn't work in Chromeless Player – JFK Jan 30 '13 at 21:00
  • Here is the jsfiddle http://jsfiddle.net/KwRaE/5/ but it doesn't work because it doesn't want to load external resources (Fancybox csss/js). If you know how to fix this please do, so I can post it in my answer. – Primoz Rome Jan 31 '13 at 12:26