IT
Web Multimedia
How to add HD/HQ YouTube videos to a Playlist for use with the JW FLV Player
|
|
Adding HD/HQ YouTube videos to a playlist for use with the JW FLV Player is relatively straightforward.
First, if you haven’t already, you will need to implement the YouTube related PHP files I detail in Playing HD/HQ YouTube Videos using the JW FLV Player in Joomla. The playlist that you will be using/creating below will reference those PHP files.
The JW FLV Player supports many playlist formats, but for the purpose of this article I’m going to use the XSPF format.
The Player below is using an XSPF playlist with 3 HD/HQ videos on YouTube. The thumbnails for the videos are also from YouTube.
Below is the Javascript code used to create the above player and playlist. I have put the JW Player and all associated files in a directory named embed so if your files aren't in that directory, change the path accordingly.
I did come across one GOTCHA! If you specify a 'type' in your configuration, whether it be in a config file like I use, or specified along with the javascript, the playlist won't work. It took me over an hour to work that out by a process of elimination. I like using a config file so I can use constant setting for all players across my websites, so I created another config file for use with just playlists. The only difference between the config files was the type was removed.
|
<script src="/http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js" type="text/javascript"></script> var params = var attributes = swfobject.embedSWF('/embed/player.swf', 'player1', '640','540', '9.0.124', false, flashvars, params, attributes); |
I'm sure you will want to customize the size and location of the playlist, as a reminder, you'll find the parameter choices at LongTail Video.
I suggest you start off by using my Sample Playlist first to make sure the Playlist displays and works correctly on your pages. Once you've verified that its working correctly, you can then start creating your own playlists.
Below is the sample playlist used with the above player.
| <?xml version='1.0' encoding='UTF-8'?> <playlist version='1' xmlns='http://xspf.org/ns/0/'> <title>YouTube High Quality Video Playlist</title> <creator>Gareth Hooper</creator> <trackList> <track> <title>New Star Trek Trailer</title> <annotation>The new Star Trek Trailer that came out in March. Full HD (fmt=22).</annotation> <meta rel="captions">none</meta> <location>http://garethhooper.com/embed/youtube_format22.php?v=P0xaCB2nLS0</location> <image>http://img.youtube.com/vi/P0xaCB2nLS0/0.jpg</image> <meta rel="type">video</meta> <duration>136</duration> </track> <track> <title>Gran Torino Trailer</title> <annotation>Gran Torini Trailer in HQ (fmt=18)</annotation> <meta rel="captions">none</meta> <location>http://garethhooper.com/embed/youtube_format18.php?v=t2BiE0bwC1M</location> <image>http://img.youtube.com/vi/t2BiE0bwC1M/0.jpg</image> <meta rel="type">video</meta> <duration>150</duration> </track> <track> <title>Radiohead - Reckoner</title> <annotation>Radiohead - Reckoner LIVE in Tokyo Oct 2008. In Full HD(fmt=22)</annotation> <meta rel="captions">none</meta> <location>http://garethhooper.com/embed/youtube_format22.php?v=uSvhtIbyucQ</location> <image>http://img.youtube.com/vi/uSvhtIbyucQ/0.jpg</image> <meta rel="type">video</meta> <duration>323</duration> </track> </trackList> </playlist> |
I use Notepad to edit and create my playlists. If you also use Notepad, you MUST save the file as UTF-8 Encoded. This is NOT the default encoding, so you must change it to UTF-8 at the bottom of the Save As window.
Anyone who has uploaded a video on to YouTube knows that YouTube will automatically create 3 different thumbnails for you to choose from, when selecting which thumbnail will represent your video. Most people however don't know that YouTube makes these 3 video thumbnails available for anyone to use. The naming convention is the following:
http://img.youtube.com/vi/videoid/thumbnail.jpg - where videoid is the Video ID you're used to using, and thumbnail is the thumbnail selection based on the table below.
| Thumbnail # | Description |
|
1 |
Thumbnail 1 of Video. 128 x 96 px in size. |
|
2 |
Thumbnail 2 of Video. 128 x 96 px in size. |
|
3 |
Thumbnail 3 of Video. 128 x 96 px in size. |
|
0 |
Thumbnail 2 of Video. 320 x 240 px in size. |
That's it! That's all you should need. Please leave me a comment if you found this article useful or if you have any questions.
. YouTube videos do not play anymore, neither in your nor in my site, no YT-Video are availale, do you know what the prob. could be? Maybe YouTube itself? Changed coding or something like that??
| < Prev | Next > |
|---|