Playing HD Youtube in PrettyPhoto
  • When I embed a youtube video in PrettyPhoto using the youtube integration, I cannot add any paramaters beyond width and height. I'd like to be able to have it automatically play in HD, any way of doing this? Perhaps using an iFrame or something? any help would be appreciated, I'm a code newbie.
  • I fixed this with a little hacking of the code.

    If you edit the jquery.prettyPhoto.js file as follows, you should find the same results!

    On line 8, find
    animation_speed: 'fast',
    and add
    hd: false,
    immediately after. Make sure that there is a comma separating the other items from the one you just added.

    You just added a new default parameter to the settings!

    Now, on line 68 find
    if(settings.autoplay)movie+=\"&autoplay=1\";
    Immediately following this statement, add
    (settings.hd)?movie+=\"&hd=1\":movie+=\"&hd=0\";


    What this does is if your settings specify hd: true, then it appends the &hd=1 to the video URL.

    There is one more important change to make at the very beginning of line 68. Find
    http://www.youtube.com/embed/
    and change it to
    http://www.youtube.com/v/
    This switches the player that is called so the HD flag actually WORKS.

    Now, when you initialize pretty photo, just add your hd setting. It will default to false so your users don't have a bad experience on low bandwidth.

    $(\"a[rel^='prettyPhoto']\").prettyPhoto({
    hd: true,
    });
  • When I paste

    (settings.hd)?movie+=\"&hd=1\":movie+=\"&hd=0\";

    Into Dreamweaver I get a code error... I have it after the semi-colon is that right? Is there something I'm missing or a small typo?

    Should there be an if before (settings.hd). I have no idea, any help would be appreciated!
  • Oranges13,

    Love this hack!! The issue I'm having is that whem you change the code on line 68 from /embed/ to /v/ the video no longer plays on the iPad.

    Any thoughts?

    Thanks!!!
  • Love this hack too, but same problem as paul5562 - no longer working on the iPad.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!