Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

How to do to Youtube Playlist give a full list (above 50 videos !)


Jwplayer Setup wizard says that :
Below is the swfobject 1.5 code for this setup. For blogs and sites like MySpace, use the embed code.

I'm using the embed code to use to Youtube Playlist give a full list on my personal site .

But after many tries with the Jwplayer, I can't load a full list of 33 videos.
25 videos only are obtained, when on the Youtube Customized player display the full list.

I don't use the Youtube Customiezd Player because the "full screen button" is not integrated into their code.
The Jwplayer have one (and "plus" many skins ....)

bc.. <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='830' height='413' id='single1' name='single1'>
<param name='movie' value='player.swf' />
<param name='allowfullscreen' value='true' />
<param name='allowscriptaccess' value='always' />
<param name='wmode' value='transparent' />
<param name='flashvars' value='playlistfile=http://gdata.youtube.com/feeds/api/playlists/C27BD4524E66F1AB&backcolor=FF0000&frontcolor=003399&screencolor=011C00&playlistsize=350&skin=plexi.zip&playlist=right' />
<embed
type='application/x-shockwave-flash'
id='single2'
name='single2'
src='player.swf'
width='830'
height='413'
bgcolor='undefined'
allowscriptaccess='always'
allowfullscreen='true'
wmode='transparent'
flashvars='playlistfile=http://gdata.youtube.com/feeds/api/playlists/C27BD4524E66F1AB&backcolor=FF0000&frontcolor=003399&screencolor=011C00&playlistsize=350&skin=plexi.zip&playlist=right'
/>
</object>



The link to the youtube playlist shared Url : (with 3w.)youtube.com/view_play_list?p=C27BD4524E66F1AB

Url where is used the Jwplayer with the embed code (tronqued list): (not 3w.)gerard.marin.free.fr/videos-1/videoSimulations2.htm

Url where is used the Youtube Customized player (full list) : (not 3w.)gerard.marin.free.fr/videos-1/videoSimulations.htm

Somebody have an idea ?

33 Community Answers

JW Player

User  
0 rated :

I've lost my playlist, a bad manipulation ....
Change C27BD4524E66F1AB to 4428F255B68D5602
Sorry .

JW Player

User  
0 rated :


The YouTube API limits you to a maximum of 50 items per request (use: max-results=50).

To obtain more than 50 items, you have to make multiple requests (use: start-index=51&max-results=50) and keep increasing the start-index by 50 on each request. Then combine the results from multiple requests into one giant playlist.

I used to have some PHP code to do this; if I can find it, I'll post it here...

JW Player

User  
0 rated :

Ok, it's clear for me.
I'm not a developer, not a programmer.
Without detailled example and a minimum of PHP knowledge, I can't continue more longer.
Then, for playlists Youtube, I'will continue to use the Youtube player which can load a full list, above the Jwplayer limit of 50 videos.

Jwplayer will be used for my own videos made-playlists not published on Youtube !

Thanks tweedledum !

Close the subject.

JW Player

User  
0 rated :


If anyone else is interested, here is a *Test Page* loading 87 tracks.
bc.. http://willswonders.myip.org:8088/HTML5/JW%20Player%20HTML5%20-03%20(YouTube).html




The PHP script is here:
bc.. http://willswonders.myip.org:8088/YouTube_Playlist_XSPF-3.3.php.txt



JW Player

User  
0 rated :

Thanks tweedledum,

When I launch your above Url test page, I get an error message :
Task queue failed at step5 : playlist could not be loaded due to crossdomain policy restrictions.

I looked at the source code of the test page, and I give "jwplayer.min.js" as name of the file phpscript .
I've created a similar html page with your source code, but when I launch my webpage that load and stay at : "Player loading ....."


My functional playlist is :bc.. http://gdata.youtube.com/feeds/api/playlists/76F4FD50F2E7F1AC


should I change the ID in the script at :// myplaylist ?
and how to change the syntax for the content of playlistfile into the webpage ?

JW Player

User  
0 rated :


I fixed the problem with the playlist loading on my Test Page.

Can you post a link to your Test Page so I can have a look at it?

JW Player

User  
0 rated :

Hi tweedledum,
thank you very much for your help.
your Test page works fine !


JW Player

User  
0 rated :

I've aproblem with this :

Your submission has triggered the spam filter and will not be accepted.

JW Player

User  
0 rated :


Put spaces in your URI to defeat the SPAM filter.
bc.. h t t p : / / w w w . d o m a i n . c o m / page.html



JW Player

User  
0 rated :

Here is my test page:

bc.. htt p: // gerard.marin.free.fr/Templates/test_Jwplayer.htm


and my test PlayList:

bc.. ht tp : // gdata.youtube.com/feeds/api/playlists/E5CF4A5884F267EB

JW Player

User  
0 rated :


OK... Give me a little time to look at your page and I'll post whatever I find here.

JW Player

User  
0 rated :


Everything is almost OK.

On line 21 of the PHP script, you need to change it to your cache directory.
bc.. $cachedirectory = '/nginx/html/cache/';


Create a cache directory if you don't already have one, then adjust the path to the local filesystem path (NOT the Web server path).

JW Player

User  
0 rated :

You mean a cache directory on "my computer", on my IP address behind my router and my firewall ?

JW Player

User  
0 rated :

A cache directory on your server (same server that the PHP file is executed on) so the playlist doesn't have to be generated every time that a user loads the JW Player.

The cached playlist file will be re-generated every two hours so it stays fresh.

JW Player

User  
0 rated :

We must go slowly, you have in front of you new to the Web, and knowing nothing in php.
php file is first in my computer, the directory used by the software Dreamweaver with which I create my site, with which I upload to my website then.
I do this in the Dreamweaver interface:
I edit the php and possibly the html file and I want a preview locally with Firefox.
If this is correct, I upload. So I think the php runs when he was asked in my PC.
Can we see this as the "server" you mean?

JW Player

User  
0 rated :

Should I install a php server on my PC

JW Player

User  
0 rated :

Hi tweedledum
Please do not let me down ....

JW Player

User  
0 rated :


If you are using a normal host for your web site, they probably have PHP installed and available. You will have to contact your host to see if you are allowed to execute PHP scripts.

The cache directory must be on your web server. The location is not important. You must use the correct *local filesystem path* (on your server) for the cache directory in the PHP script.

JW Player

User  
0 rated :

The script file that you use in your testPage is "jwplayer.min.js" and is different from the one that comes with the package "JW-mediaplayer-5.5" called "jwplayer.js" I downloaded Jwplayer site to this page: h t t p : / /w w w.longtailvideo.com/players/jw-flv-player/
If I use yours, I remain with the web page loading and the text: "loading player ...."
If I use the file "jwplayer.js" package, the web page load, but gives me only 24 videos.
I created a folder called "cache"on my website, and I filled out the php file like this: $ cachedirectory = 'h t t p : / / gerard.marin.free.fr/Templates/cache/';
This brings me nothing better.

JW Player

User  
0 rated :

In the directory "cache", it has created a file "2011040607_playlists_E5CF4A5884F267EB.xml" which shows only 49 tracks.

JW Player

User  
0 rated :

Hello,
Here, I'm confused ....
I can not go forward in the resolution of my application related to your testPage ...
Please, help me more ....

JW Player

User  
0 rated :


If you are ending up with a playlist file in your cache directory, then everything is working OK.

Just because you have 200 tracks in your personal playlist doesn't mean that you will end up with 200 tracks in the generated playlist. Many of the videos in your playlist may be invalid for various reasons, therefore you will end up with 49 tracks.

I have over 200 tracks in my YouTube playlist, yet only 87 of them end up being valid tracks...

JW Player

User  
0 rated :

Ok!
Greats thanks Tweedledum !

JW Player

User  
0 rated :

I can not for the life of me get this cache folder to work. I'm hosted through GoDaddy, and am assuming the cache folder is whats preventing me from successfully getting my playlist to work.

I can get it to work using the willswonders.myip.org cache folder (im sure he doesnt appreciate this though) but can not use my own cache folder. The PHP is hosted in a folder called etchasketchy4. And also in the etchasketchy4 folder I have a folder called cache. I have tried using

$cachedirectory = '/etchasketchy4/cache/';
$cachedirectory = './etchasketchy4/cache/';
$cachedirectory = '../etchasketchy4/cache/';
$cachedirectory = /cache/';
$cachedirectory = './cache/';
$cachedirectory = '../cache/';
$cachedirectory = 'cache/';

Nothing ever shows up in the cache folder. I always get the error "Task Queue failed at step 5: Playlist could not be loaded: Error #1088"

I've also tried editing the CHMOD of the folder EVERY which way, I'm assuming though the php script should be allowed to add to the cache folder without any CHMOD editing because the PHP is locally hosted on the server though right?

This has been driving me crazy for months. Any help will be so appreciated. Here's my code so far for the stream.php

bc.. <?php

//...debug
//...http://192.168.1.69:8088/YouTube_Playlist_XSPF-3.3.php
//...debug

// YouTube_Playlist_XSPF-3.3.php 20110402 - compatible with v5.6.x player
// playlists need to be updated at least every 2 hours
// call with: http://willswonders.myip.org:8085/php/YouTube_Playlist_XSPF-3.2.php?playlistid=B8D6FA74D3F2629C
// file: encodeURIComponent('http://willswonders.myip.org:8085/php/YouTube_Playlist_XSPF-3.2.php?playlistid=B8D6FA74D3F2629C),
// call with: http://my.domain.com/YouTube_Playlist_XSPF-3.2.php?playlistid=9A337BB0628CF018
// file: encodeURIComponent('http://my.domain.com/YouTube_Playlist_XSPF-3.2.php?playlistid=B8D6FA74D3F2629C),
// Direct:
// From: http://www.youtube.com/view_play_list?p=F4DF7B5DEE6ACA06
// To: http://gdata.youtube.com/feeds/api/playlists/F4DF7B5DEE6ACA06
// To: http://gdata.youtube.com/feeds/api/playlists/B8D6FA74D3F2629C


$debug_output = true;
$update_interval = 2;
//$cachedirectory = '/nginx/html/cache/';
$cachedirectory = '/etchasketchy4/cache/';

// debug('Playlist ID', $_GET['playlistid']);


// for command line argument passing
if(isset($_SERVER['argv'][1]))
{
$_GET['playlistid'] = $_SERVER['argv'][1];
}


// debug('Playlist ID', $_GET['playlistid']); exit;


// my playlist
$playlistid = (isset($_GET["playlistid"])) ? strval($_GET["playlistid"]) : "022B7B41F1189489";
// johnyradio 9A337BB0628CF018
// $playlistid = (isset($_GET["playlistid"])) ? strval($_GET["playlistid"]) : "9A337BB0628CF018";
// ToothandNail 4F7A36C13B0C5764
// $playlistid = (isset($_GET["playlistid"])) ? strval($_GET["playlistid"]) : "4F7A36C13B0C5764";
// UMG 5C06802F841BE277
// $playlistid = (isset($_GET["playlistid"])) ? strval($_GET["playlistid"]) : "5C06802F841BE277";
// WatchMojo 2C9178C3EFE262EF
// $playlistid = (isset($_GET["playlistid"])) ? strval($_GET["playlistid"]) : "2C9178C3EFE262EF";
// National Geographic - top videos
// $playlistid = (isset($_GET["playlistid"])) ? strval($_GET["playlistid"]) : "PLF0BFBE269796D013";

// max-results is limited to 50 per request, total of 100 for playlists
// http://gdata.youtube.com/feeds/api/playlists/B8D6FA74D3F2629C ?start-index=1&max-results=50
$playlisturl1 = "http://gdata.youtube.com/feeds/api/playlists/" . $playlistid . "?start-index=1&max-results=50";
$playlisturl2 = "http://gdata.youtube.com/feeds/api/playlists/" . $playlistid . "?start-index=51&max-results=50";

// create cache filename
$patterns = array('#gdata#', '#/#', '#:#', '#\.#', '#http#', '#youtube#', '#com#', '#feeds#', '#api#', '#playlists#', '#\?start-index=1&max-results=50#');
$replacements = array( '', '', '', '', '', '', '', '', '', 'playlists_', '');
$filename = preg_replace($patterns, $replacements, $playlisturl1);


// debug(' Playlist ID', $playlistid);
// debug(' Playlist URL', $playlisturl);
// debug('Cache Filename', $cachefilename);
// exit;


for ($i=0; $i < $update_interval; $i++)
{
$cachefilename = (date('YmdH') - $i) . '_' . $filename . ".xml";
if(file_exists($cachedirectory . $cachefilename))
{
if(!isset($_SERVER['argv'][1]))
{
header ("content-type: text/xml");
print file_get_contents($cachedirectory . $cachefilename);
}
exit;
}
}

$cachefilename = date('YmdH') . '_' . $filename . ".xml";

$playlistcontent1 = file($playlisturl1);
$playlistcontent2 = file($playlisturl2);
$playlistcontent = array_merge($playlistcontent1, $playlistcontent2);

$contentstring = "";
foreach($playlistcontent as $value)
{
$contentstring .= rtrim($value);
}

$contentarray = explode("<entry>", $contentstring);


// debug('Playlist Content', $playlistcontent);
// debug('Content String', $contentstring);
// debug('Content Array', $contentarray);
// exit;


$track = 0;
$type = '';

// construct XSPF playlist headers
$playlist = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$playlist .= "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:jwplayer=\"http://developer.longtailvideo.com/trac/wiki/FlashFormats\">\n";
$playlist .= " <trackList>\n";

// construct XSPF playlist tracks
while($junk = next($contentarray))
{
$track++;
$playlist .= " <track>\n";

if((preg_match('/<title>(.*?)<\/title>/', $junk, $match)) || (preg_match('/<title type=\'text\'>(.*?)<\/title>/', $junk, $match)))
{
$playlist .= " <title>" . $match[1] . "</title>\n";
}

if(preg_match('/<name>(.*?)<\/name>/', $junk, $match))
{
$playlist .= " <author>" . $match[1] . "</author>\n";
if($match[1] == 'universalmusicgroup')
{
$type = 'UMG';
}
}

// <media:thumbnail url='http://i.ytimg.com/vi/5GE82tqcYYQ/0.jpg' height='240' width='320' time='00:06:01.500'/>
if(preg_match('/.*?<media:thumbnail url=\'(.*?)0.jpg/', $junk, $match))
{
$playlist .= " <image>" . $match[1] . "0.jpg</image>\n";
}

// <media:content url='http://www.youtube.com/v/P_1z7BbVNiY?f=
// <media:content url=\'http:\/\/www.youtube.com\/v\/P_1z7\?f=
if(preg_match('/.*?<media:content url=\'http:\/\/www.youtube.com\/v\/(.*?)\?/', $junk, $match))
{
$playlist .= " <location>http://www.youtube.com/watch?v=" . $match[1] . "</location>\n";
}


// debug( 'Match[1]', $match[1]);
// exit;


$playlist .= " <jwplayer:provider>youtube</jwplayer:provider>\n";
$playlist .= " <annotation>Track " . $track . "</annotation>\n";
$playlist .= " </track>\n";

if(($track > 19) && ($type == 'UMG'))
{
break;
}
}

// construct XSPF playlist footers
$playlist .= " </trackList>\n";
$playlist .= "</playlist>\n";

if(!isset($_SERVER['argv'][1]))
{
header ("content-type: text/xml");
print $playlist;
}

// check cache - write to cache
if(!file_exists($cachedirectory . $cachefilename))
{
$fh = fopen($cachedirectory . $cachefilename, 'a');

fwrite($fh, $playlist);

fclose($fh);
}

// cleanup cache
@$directory_handle = dir($cachedirectory);

if($directory_handle)
{
while (false !== ($currentfile = $directory_handle->read()))
{
// 200712050018_playlists_9A337BB0628CF018.xml
if(preg_match('/(\d{10})_playlists_.*?.xml/', $currentfile, $match))
{
$currentdate = date('YmdH');


// debug('Current Date', $currentdate);
// debug('Current File', $currentfile);
// debug(' Match[1]', $match[1]);


// if file is older than current hour - update interval, delete file
if($match[1] < $currentdate - $update_interval + 1)
{
unlink($cachedirectory . $currentfile);
}
}
}
$directory_handle->close();
}


function debug($title, $value)
{
global $debug_output;

if($debug_output)
{
print "<pre>";
if(is_array($value))
{
print $title . ":\n";
print_r($value);
}
else
{
print $title . ": " . $value;
}
print "</pre>\n";
}
}

?>



Again any help is SO appreciated!

-Eric

JW Player

User  
0 rated :

Still no one? I'm assuming it's a simple thing I'm missing with GoDaddy and not being able to cache.

JW Player

User  
0 rated :


The path to the cache directory must be a local (local meaning on the server) filesystem path to the cache directory because that is what PHP will use. NOT a web server path.

Since I don't know what your directory structure is, I can't give you an example. It may be something like /use/home... GoDaddy should be able to help you determine what your local filesystem path to the cache directory would be.

JW Player

User  
0 rated :

Jimmy, I would just like to say THANK YOU. I just googled how to find cache directory on GoDaddy, and they had simple instructions on how to login and get the actual filesystem path. Never knew PHP used this specifically. You don't know how many times i've been through each line of the code trying to figure out what I did wrong haha.

I'm glad I was right about it having to do with the cache not working.

You fixed all my problems, and I can't thank you enough!

JW Player

User  
0 rated :

Hello,
I am trying to play more than 50 videos for a student project. I am not very good with programing or PHP. Is there any way that I can have more than 50 videos shuffled into this random edit?

Thank you for your help!
Alexis

http://www.brainbowinc.com/seniorstudio2012/

JW Player

User  
0 rated :

I should have mentioned that I am using a youtube playlist and have about 100 files I would like to play in the JW player.

Thanks again!

Ethan Feldman

JW Player Support Agent  
0 rated :

You can’t use more than 50, Youtube API limit.

JW Player

User  
0 rated :

I made a simple xml playlist and just cut and paste the YouTube urls into the xml file. JW player plays it just fine.

bc.. <rss version="2.0" xmlns:jwplayer="http://developer.longtailvideo.com/">
<channel>
<title>Skip Around The World: Skippers A</title>
<item>
<title>TITLE_HERE</title>
<enclosure url="URL_HERE_URL_HERE" type="video/x-flv" />
<description>DESCRIPTION_HERE</description>
</item

</channel>
</rss>


Just copy and paste the bc.. <item></item>
as many times as you want and replace with your own info.

You can see it in action here: h t t p : / / s k i p a r o u n d t h e w o r l d . c o m

Ethan Feldman

JW Player Support Agent  
0 rated :

Nice thanks for sharing :)

Ethan Feldman

JW Player Support Agent  
0 rated :

Site looks great btw, great implementation of the player!

This question has received the maximum number of answers.