high-resolution – Pogopixels’ Blog http://pogopixels.com/blog Just another WordPress weblog Thu, 17 Mar 2016 13:29:10 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.9 Get the URL of an iPod or HD quality YouTube video http://pogopixels.com/blog/get-the-url-of-a-iphone-or-hd-quality-youtube-video/ http://pogopixels.com/blog/get-the-url-of-a-iphone-or-hd-quality-youtube-video/#comments Thu, 19 Mar 2009 19:19:49 +0000 http://pogopixels.com/blog/?p=101 I’ve described in a previous post how to get the URL of a YouTube video in Flash. However this method only returns the low-resolution quality video at 320×240. Getting the high-res one is easy though – you just need to add a “fmt” parameter to the URL link.

These two values in particular can be interesting:

fmt=22: This is an MP4 video in HD quality. On my tests, the resolution can go up to 1280 x 720.

fmt=18: This is a 480 pixels wide version that can be used in portable devices such as iPods.

In order to use this additional parameter, just add an argument to the constructFLVURL method:

// Set "format" to 22 for the high resolution version, or 18 for the iPod one. Or just
// leave to -1 for the low res version.
private function constructFLVURL (video_id:String, t:String, format:Number = -1):String {
  var str:String = "http://www.youtube.com/get_video.php?";
  str += "video_id=" + video_id;
  str += "&t=" + t;
  if (format >= 0) {
    str += "&fmt=" + format;
  }
  return str;
}
]]>
http://pogopixels.com/blog/get-the-url-of-a-iphone-or-hd-quality-youtube-video/feed/ 1