Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

YouTube Playlist?

78 replies [Last post]

can the jw flv player play a YouTube playlist?

i figured out how.

There are services which deliver an RSS feed from a YouTube playlist ID, such as ubeek.com. That gets your individual video ID's.

There are scripts which get the url to a YouTube flv, given the YouTube ID. That gets your flv's.

Pass those through a script which converts them into an XML playlist acceptable to the jw flv player.

Add jeroen's External_Feed.php script, since the flv's are not hosted on the same server as the player.

and there you are.

if i was not already bogged down, i would code it.

Is there an easier way to do this for "non-programmers"? :$

Solved a few of my youtube playlist have 200 videos !! I tried ubeek.com but it only creates feed for the first 100 video only. Is there any solution to create feed for all the 200 videos? Looking forward for your reply.Thanks

can any one show me how to play youtube xml/feed in jeroen flash player?
I am looking for a php solution.Thanks

can you use Wijering's wizard to play a youTube xml-feed?
www.jeroenwijering.com/extras/wizard.html

maybe you need to use Wijering's External_Feed.php script, since the player is not hosted with the flv's.

youTube does not currently provide an xml feed for Playlists.

ubeek gives you RSS to the YouTube page of each video in the playlist. you'd need to strip away the id's and titles, convert the ID-urls into FLV-urls, using:
http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc

and then produce an XML playlist with the flv-urls and titles.

Hohny radio thanks for your explaination. The only part that i have problem with is how to construct youtube direct flv urls from giving video id/url!! My intention is not to download the flv. I just want to use direct link to flv files and feed them jw flash player.

The following link will allow me to download the flv but it will not
work in jw flash player xml:!!
http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc
I tried to use the following in jw xml but it didn't work!!:

http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc.flv

could you or any one else show me how to get direct flv links using php(Automatically not manually since i got huge list of youtube urls in mysql)?Thanks

@method,

Since there is no media file extension (flv, mp3, jpg) that the player can use to determine the file type, you have to do it with the 'type' flashvar.

Like this for a single file:

          s1.addVariable('file',             'http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc');
          s1.addVariable('type',             'flv');

Or like this for a playlist:

          s1.addVariable('file',             'http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc');
          s1.addVariable('type',             'flv');
<track>
<title>PSYCHIARTY TRIUMPHS!</title>
<creator>Wowzer</creator>
<location>http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc</location>
<meta rel="type">flv</meta>
<info>http://my.domain.com</info>
</track>

Plays For Me!™ :)

will thank your code. But could you tell me how to use your code? It would be nice if you show me the complete code and how to use it.

where to use this part?:

s1.addVariable('file', 'http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc');
s1.addVariable('type', 'flv');

I add the follwing line to my xml but the clip didn't play:

<meta rel="type">flv</meta>

Note: I am using the above code with JW MEDIA PLAYER

Basic HTML document code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

  <title>Simple JW Player</title>

  <script type="text/javascript" src="swfobject.js"></script>

  <script type='text/javascript'>
    function createPlayer()
    {
      var s1 = new SWFObject('http://my.domain.com/mediaplayer.swf', 'playlist', '475', '508', '7');
          s1.addParam('allowfullscreen',     'true');
          s1.addVariable('width',            '475');
          s1.addVariable('height',           '508');
          s1.addVariable('displayheight',    '350');
          s1.addVariable('file',             'http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc');
          s1.addVariable('type',             'flv');
        //s1.addVariable('file',             'http://my.domain.com/playlist.xml');
        //s1.addVariable('overstretch',      'true');  // expands to fit h & v   "true"  -will stretch them proportionally to fill the display
          s1.addVariable('overstretch',      'false'); // expands to fit h or v  "false" -will stretch them to fit
        //s1.addVariable('overstretch',      'fit');   // expands to fit h & v   "fit"   -will stretch them disproportionally to fit both height and width
        //s1.addVariable('overstretch',      'none');  // displays native size   "none"  -will show all items in their original dimensions
          s1.addVariable('showdigits',       'true');
          s1.addVariable('autostart',        'true');
          s1.addVariable('shuffle',          'false');
          s1.addVariable('repeat',           'list');
          s1.addVariable('showicons',        'true');
          s1.addVariable('thumbsinplaylist', 'true');
          s1.addVariable('logo',             'http://my.domain.com/logo.png');
          s1.addVariable('backcolor',        '0xFFFFFF'); // face of buttons
          s1.addVariable('frontcolor',       '0x404040'); // button symbols & playlist text
          s1.addVariable('lightcolor',       '0x808080'); // highlighted playlist item
          s1.addVariable('screencolor',      '0x000000'); // screen background color
          s1.write('player');
    };
  </script>

</head>

<body onload="createPlayer();">

  <div id="player">
    <a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Plugin</a> 
    to see this gallery.
  </div>

</body>

</html>

playlist.xml

<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
  <trackList>
    <track>
      <title>PSYCHIARTY TRIUMPHS!</title>
      <creator>Wowzer</creator>
      <location>http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc</location>
      <meta rel="type">flv</meta>
      <info>http://my.domain.com</info>
    </track>
  </trackList>
</playlist>

Adjust the URL "http://my.domain.com/" to your domain.

Will thanks for your code. I tried it but i get one song showing in the playlist without title .it says 1.undefined and it never plays!!
Furthermore, i tried to use the xml and i got the same error!!

I was hoping i create an xml with list of youtube urls and play them with jw media player but i think i can't achieve that goal!!

@method,

To play a single file, use this code:

s1.addVariable('file', 'http://cache.googlevideo.com/get_video?video_id=kieyjfZDUIc');
s1.addVariable('type', 'flv');

"1. undefined will show in the playlist unless you give these flashvars some value:
s1.addVariable('author', 'John Stilwel');
s1.addvariable('title', 'My Life');

Use this code to use a playlist:

s1.addVariable('file', 'http://my.domain.com/playlist.xml');

Do not use the 'type' flashvar with a playlist.

Here are some more test URLs for YouTube:

    <track>
      <title>Piano Lesson With A Difference</title>
      <creator>sniper22b</creator>
      <location>http://youtube-349.vo.llnwd.net/d1/03/7D/dYhhQhtrlFI.flv</location>
      <meta rel="type">flv</meta>
      <info>http://www.willswonders.myip.org/</info>
    </track>
    <track>
      <title>Sexy Alien Cartoon Band</title>
      <creator>MooseMouseMedia</creator>
      <location>http://youtube-133.vo.llnwd.net/d1/01/90/Mc-7YlBYWc4.flv</location>
      <meta rel="type">flv</meta>
      <image>http://img.youtube.com/vi/Mc-7YlBYWc4/2.jpg</image>
      <info>http://my.domain.com</info>
    </track>

will thanks again. I already know how play flv files But my main problem is how to construct youtube direct flv urls from giving video id/url?

i have huge list of youtube urls in my mysql and want to construct an xml file out of it.So looking for a solution that automatically convert all youtube urls to direct flv urls before i construct the xml.Hope some one help me do this automatically for huge list of urls not just few!!

OK, so what's the structure of your MySQL table?

A while back I posted several YouTube playlist generators on these forums. They use the PHP code from [url=http://video.qooqle.jp]Qooqle[/url] to get the YouTube URL.

Just read your MySQL, process the raw id through the Qooqle code and save it to a playlist track.

This one gets the YouTube URLs from a plain text file; modify it to use the URLs from your MySQL db. It's old, so I don't know if it still works, but the basic code should be good.

playlist_generator_youtube.php

<?php

// YouTube Playlist Generator v2.31 by Will
// from YouTube Downloader : written by Takashi Ohida (pichon@gmail.com)

require_once 'HTTP.php';

// change this to your own domain
$info = "http://my.domain.com";

// set this to true if your host doesn't allow URL file access and you get an error message
// like this: "Warning: file_get_contents(): URL file-access is disabled in the server configuration..."
// AND YOUR HOST DOES ALLOW THE USE OF CURL.
$use_curl = false;

// leave everything below here alone
$urls = array();
$browser = false;

// Define a context for HTTP.
// This needs to be the server and the port of the NTLM Authentication Proxy Server.
// $aContext = array( 'http' => array( 'proxy' => 'tcp://192.168.0.1:8080', 'request_fulluri' => True, ), );
// $cxContext = stream_context_create($aContext);

// if ('POST' == $_SERVER['REQUEST_METHOD'])
// {
//   echo get_link($_POST['id'], $_POST['redirect']);
//   return;
// }

if ($_GET['filename'])
{
 
$filename = $_GET['filename'];
 
$browser = true;
}
elseif (
$argv[1])
{
 
parse_str($argv[1]);
}

if (
$filename == "")
{
 
$filename = "urls.txt";
}

$files[0] = $filename;

// added to process all .txt files in a directory
// for current directory, use: filename=. (that's an equals sign and a period)
if (is_dir($filename))
{
  unset(
$files);
  if (
$dh = opendir($filename))
  {
    while ((
$file = readdir($dh)) !== false)
    {
     
// workaround for bug in PHP where is_file(temp_file.txt) returns false "underscore" breaks is_file()
      //if (is_file($file) && strstr($file, ".txt"))
     
if (!is_dir($file) && strstr($file, ".txt"))
      {
       
$files[] = $filename . "/" . $file;

// debug("File: ", $file);

     
}
    }
   
closedir($dh);
  }
}

// debug(print_r($files), '');
// exit;

if ($files)
{
 
// load link file
 
while($more = current($files))
  {

// debug("Now processing: ", $more);
// exit;

   
write_playlist($more, $info, $browser);
   
next($files);
  }
}


// write the playlist
function write_playlist($more, $info, $browser)
{
 
$fh = fopen($more, 'r') or die("Could not find file: " . $more . "\n");

// debug("Now processing: ", $more);
// exit;

 
while ($entry = fgets($fh))
  {
    if (
substr($entry, 0, 7) == "http://")
    {
     
$entry = rtrim($entry);
     
$entry = str_replace("www.", "", $entry);

// debug("Entry: ", $entry);
// exit;

     
if ($list = get_link($entry, $use_curl))
      {
       
$urls[$entry]['link'] = rtrim($list[0]);
       
$urls[$entry]['title'] = $list[1];
       
$urls[$entry]['creator'] = $list[2];
       
$urls[$entry]['imageurl'] = $list[3];
      }
      else
      {
       
// delete entry
       
unset($urls[$entry]);
        if (
count($urls) > 1)
        {
         
prev($urls);
        }
      }

// debug("     entry: ", $entry);
// debug("      link: ", $urls[$entry]['link']);
// debug("     title: ", $urls[$entry]['title']);
// exit;

   
}
  }
 
fclose($fh);

  if (
$urls)
  {
   
reset($urls);
  }

// debug(print_r($urls), '');
// exit;

  // generate playlist
 
if ($urls)
  {
   
// header("content-type:text/xml;charset=utf-8");
   
$playlist = "<?xml version='1.0' encoding='UTF-8'?>

<playlist version='1' xmlns='http://xspf.org/ns/0/'>
  <trackList>
";

    while($things = current($urls))
    {
      $playlist .= "    <track>
      <title>{$things['title']}</title>
      <creator>{$things['creator']}</creator>
      <location>{$things['link']}</location>
      <meta rel='type'>flv</meta>
      <image>{$things['imageurl']}</image>
      <info>$info</info>
    </track>
";

      next($urls);
    }

    $playlist .= "  </trackList>
</playlist>
";

    if ($browser)
    {
      print $playlist;
    }
    else
    {
      $fh = fopen(substr($more, 0, strlen($more) - 4) . ".xml", 'w') or die("Could not find file: " . substr($more, 0, strlen($more - 4)) . ".xml\n");
      fwrite($fh, $playlist);
      fclose($fh);
    }
  unset($urls);
  }
  // unset($urls);
}


// function get_link($url, $u_curl, $redirect = false)
function get_link($url, $u_curl)
{
  $id = preg_replace('/http:\/\/youtube\.com\/watch\?v=/', '', $url);

  // frame 2 of 4 - 130x97
  $imageurl = "http://img.youtube.com/vi/" . $id . "/2.jpg";

// debug("     url-1: ", $url);
// debug("        id: ", $id);

////////// use curl //////////
  if ($u_curl)
  {
    $ch = curl_init();
    $timeout = 10;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// debug("     url-2: ", $url);

    if (!$html = curl_exec($ch))
    {

// debug("     url-3: ", $url . "FAILED!");

      curl_close($ch);
      return false;
    }
    curl_close($ch);
  }
////////// use curl //////////

  else
  {
    // $html = file_get_contents($url, False, $cxContext);
    $html = file_get_contents($url);

// debug("      html: ", $html);

  }

  if ($html)
  {
  //  original
  //  new SWFObject("/player2\.swf\?video_id=l_dppH8kaeo&l=267&t=OEgsToPDskIgu-9txJUlo2i_zo60Hm_i&sk=nfV9W6celEcSWO-xnAcXuAC", "movie_player", "450", "370", 7, "#FFFFFF");
  //  06-10-07
  //  new SWFObject("/player2.swf?hl=en&BASE_YT_URL=http://youtube.com/&video_id=dYhhQhtrlFI&l=171&t=OEgsToPDskI2HGYddcemMg1QhqVDVQ5h&soff=1&sk=BOC0hytI6v5l1LzCsLhGVgC", "movie_player", "450", "370", v, "#FFFFFF");
  //  new SWFObject("\/player2\.swf\?hl=en&BASE_YT_URL=http:\/\/youtube.com\/&video_id=   &t=     &soff=1&sk=NtfTPUkzERWO08B_h45yUwC", "movie_player", "450", "370", v, "#FFFFFF");
  //  06-14-07
  //  new SWFObject("/player2.swf?video_id=sNazS7WXvVQ&l=249&t=OEgsToPDskJUBhFSaBTadkignmil_dYv&soff=1&sk=2d_0qj2f85BaAYRFJykUxwU", "movie_player", "450", "370", v, "#FFFFFF");
  //  new SWFObject("\/player2\.swf\?   &t=     &
    if (preg_match('/\/player2\.swf\?.*?&t=(.*?)&/', $html, $match))
    {
      $url = 'http://youtube.com/get_video.php?video_id=' . $id . '&t=' . $match[1];

// debug("     url-4: ", $url);
// debug("  redirect: ", $redirect);
// debug("redirected: ", get_redirected_url($url));

      if (preg_match('/<h1 id="video_title">(.*?)<\/h1>/', $html, $match))
      {
        $title = $match[1];
      }

      if (preg_match('/\(\'ChannelLink\'\,\'Watch\'\)\;\">(.*?)<\/a>/', $html, $match))
      {
        $creator = $match[1];

// debug("creator: ", $creator);
// exit;

      }

      // if ($redirect && $redirected_url = get_redirected_url($url))
      if ($redirected_url = get_redirected_url($url))
      {
        $url = $redirected_url;
      }

// debug("      html: ", $html);
// debug("     url-5: ", $url);
// debug("     title: ", $title);

      return array ($url, $title, $creator, $imageurl);
    }
    else
    {
      return false;
    }
  }
  else
  {
    return false;
  }
}


function get_redirected_url($url)
{
  $res = HTTP::head($url);

  if (preg_match('/^3/', $res['response_code']))
  {
    return $res['Location'];
  }
  return false;
}


function debug($text1, $text2)
{
  print "<pre>\n";
  print $text1 . $text2 . "\n";
  print "</pre>\n";
}

?>

will thanks. But where to get the 'HTTP.php' file? I can't run it without it!!

I even tried to comment out and placed a youtube url inside urls.txt

http://www.youtube.com/watch?v=DHXpnZi9Hzs

I run the scrip and got white page!! where it will write back the direct .flv urls ?

[url=http://pear.php.net/package/HTTP]HTTP.php[/url]

Call it with browser=true, otherwise it writes an XML file named "youtube.xml" in the same directory you are running it from.

URLs.txt

http://youtube.com/watch?v=fcy8QcS21PA
http://youtube.com/watch?v=Zi_760pnGtg
http://youtube.com/watch?v=sLNZ0QuNtmg
http://youtube.com/watch?v=VWBM6kcWswM
http://youtube.com/watch?v=Gpd0fhwVGyY
http://youtube.com/watch?v=wcbPLWrE3zA
http://youtube.com/watch?v=8W-Iv5Js16k

The code is old, so it may not function without some work to update it.

will i downloaded this file HTTP-1.4.0 but it is not php file!! Could you tell me how to install it ?Furthermore, you said the code is old . Do you think only the function that gets direct flv url ONLY needes to be updated ?

"there's just so much fluff".... *)

@method

:d just use youripper to extract the .flv url. it also helps you
to create an XML playlist

@method,

re: HTTP.php — Like most files on the Internet, it's been compressed. just unzip it and you will find HTTP.php inside.

re: The old code. I don't know which part, if any, will need work. That's why I gave you the warning. It may be a little, it may be a lot.

hi! First thanks again for your great player. i love it! ;)

i have a problem that unfortunately i havent been able to solve myself. I am trying to call a playlist with a single file hosted on youtube but i am so stupid, because i cant make it, it doenst work :|

i do as this:

s1.addVariable('file', 'http://mydomain.com/playlist.xml');

and for the playlist

<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<track>
<title>Video Title</title>
<creator>Video</creator>
<location>http://74.125.14.21/get_video?video_id=yCaNMHQa1FQ</location>
<meta rel="type">flv</meta>
<info>http://mydomain.com</info>
</track>

Whats wrong?

It would be easier for me if i can add this

s1.addVariable('file', 'http://mydomain.com/doc.html');

but i cant call .html, right? *)

Thanks!

Maria

@Maria,

Works perfectly for me, just like this:

<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<creator>Maria</creator>
<title>YouTube Link Test 12</title>
<location>http://74.125.14.21/get_video?video_id=yCaNMHQa1FQ</location>
<meta rel="type">flv</meta>
<info>http://my.domain.com</info>
</track>
</trackList>
</playlist>

Pay particular attention to the uppercase "L" in the <trackList> tag.

Enjoy! :)

Thanks Will ;) it is working now :)

Although it is funny...

1. if i use the embedding option doesnt show the image for the video but it does loads the video.

2. if i use the full code

<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf','mpl','320','240','7');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
....

the video doesnt load but the image shows *)

@@@

Any guess to load video and image as well? a black screen doesnt look as nice as to show the image as well.

And thanks again! Will

I already solved it. I need to call the image from the playlist.xml adding this (after the location of the youtube video)

<image>http://mydomain.com/image.jpg</image>

then ...

<location>http://74.125.14.21/get_video?video_id=yCaNMHQa1FQ</location>
<image>http://mydomain.com/image.jpg</image>
<album>adv</album>
<meta rel="type">flv</meta>
</track>

and not to call it from the embedding or code. that was my mistake.

Thanks Will for your help again.

sorry one final question that i couldnt solve even by checking here http://xspf.org/xspf-v1.html

Can i call the logo also from the playlist? i am using <image>http://mydomain.com/image.jpg</image> on the playlist to show the image at the beginning of the video, what about the logo? is it possible?

I guess i can also edit and add it to the flash player but that sounds complicated *)

thanks! calling logo from the playlist? :p

The logo has to come from the player code:

so.addVariable('logo', 'URL to image file');

Where 'URL to image file' can be anything from 'logo.png' to 'http://my.domain.com/path/image.png'

See the readme: [url=http://www.jeroenwijering.com/extras/readme.html]JW PLAYERS 3.12 README[/url] for the details.

Once you start using a playlist, the "media" items have to come from the playlist. See the playlist section of the readme for the XSPF tags.

Of course, if you get stuck, post on the forums. :)

Will, i am really thankful for your help :) and sorry to have bothered you with my stupid questions :$

Thanks!

@Maria,

Never ANY stupid questions here. We're glad to help. :)

sorry me again *) :$ i still have a small problem, the playlists work only on Safari (mac) which i guess means the code is okay, but today i was trying on firefox or opera (i havent tried on ie) but if i use a playlist on these browsers, it just keep loading (white screen) but doesnt load the player.

If i call a single file .flv, it does work on the 3 browsers i tried (safari, opera and firefox); then my only issue is on the playlists, not a single playlist i tried worked (whether i call a single .flv from the playlist or if i am calling several youtube videos).

I am guessing is that these browser might not be reading the swf on a playlist? (if thats an issue sometimes, as these browsers juts seem to keep loading the .swf but nothing loads - i dont know for sure *) Or i was thinking the adobe plugin must be updated, but if i guess it is updated because at least on single files it works.

Any ideas where to look? please i thought i finally got it but still this small problem :|

Maria,

Post your FULL player code and your FULL playlist.xml.

Then I can quickly spot your problem and help you further. :)

Thanks Will! :$ i m clueless *)

here is the code on playlist

<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<creator>Maria</creator>
<title>Video</title>
<location>http://74.125.14.21/get_video?video_id=yCaNMHQa1FQ</location>
<meta rel="type">flv</meta>
<info>http://domain.com/</info>
<image>http://domain.com/img/animedance2.png</image>
</track>
</trackList>
</playlist>

here is the code

<script type="text/javascript" src="http://domain.com/swfobject.js"></script>
<p id="player59"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</p>
<script type="text/javascript">
var s1 = new SWFObject("http://domain.com/flvplayer.swf","single","550","440","7");
s1.addParam("allowfullscreen","true");
s1.addVariable("displayheight","440");
s1.addVariable("frontcolor","0xFFFFFF");
s1.addVariable("backcolor","");
s1.addVariable("lightcolor","0x999999F");
s1.addVariable("file","http://domain.com/test-anime.xml");
s1.write("player59");
</script>

this is how i see it on my mac firefox or mac opera (playlist doesnt work, single video without using playlist does)
http://img141.imageshack.us/img141/6891/95093341ln9.png
and this is how it works on safari (both playlist and single file without calling playlist -both work)
http://img258.imageshack.us/img258/2721/15593774ab1.png

*first video is calling playlist, second video is calling same video but directly from youtube -not calling playlist.

thanks for your help :$

Post your code means:

<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
  <trackList>
    <track>
      <creator>Maria</creator>
      <title>Video</title>
      <location>http://74.125.14.21/get_video?video_id=yCaNMHQa1FQ</location>
      <meta rel="type">flv</meta>
      <image>http://my.domain.com/img/animedance2.png</image>
      <info>http://my.domain.com/</info>
    </track>
  </trackList>
</playlist>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

  <title>Maria</title>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <script type="text/javascript" src="http://my.domain.com/swfobject.js"></script>

</head>

<body>

  <div id="player59">
    <a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> 
    to see this player.
  </div>

  <script type="text/javascript">
    var s1 = new SWFObject('http://my.domain.com/flvplayer.swf', 'single', '550', '440', '7');
        s1.addParam('allowfullscreen', 'true');
        s1.addVariable                 '550');
        s1.addVariable                 '440');
        s1.addVariable                 '440');
        s1.addVariable                 '0xFFFFFF');
        s1.addVariable                 '0xFFFFFF');
        s1.addVariable                 '0x999999');
        s1.addVariable                 'http://my.domain.com/test-anime.xml');
        s1.write('player59');
</script>

</body>

</html>

Of course, change "my.domain.com" to your domain.

Hi! i tried it but i guess i did something wrong again :| i dont know whats wrong :$

one question, here

s1.addVariable 'http://my.domain.com/test-anime.xml');

shouldnt i have to add the first ( so i have ('http://my.domain.com/test-anime.xml');

and second question, when i use ' usually doesnt work, i must use " to work.

When i tried with ' and without ( i just get the message to get adobe player.

when i tried with " and with ( i get the white screen.

Will, i dont want to bother you anymore with the problem i have with my playlists that work on safari but dont work on firefox or opera, so i really appreaciate if yo have a second to better see it from the site im working on. It is valid on xhtml and css (if thats relevant). on this link you can see full source and the domain (it is an idn domain in spanish).

http://validator.w3.org/check?uri=http%3A%2F%2Fxn--animeenespaol-skb.com%2F&charset=%28detect+automatically%29&doctype=Inline&ss=1&outline=1&group=0

thanks will again! :$

@Maria,

WOW! I didn't notice all of the flashvars were missing. :$

Use this:

  <script type="text/javascript">
    var s1 = new SWFObject('http://my.domain.com/flvplayer.swf', 'single', '550', '440', '7');
        s1.addParam('allowfullscreen',                           'true');
        s1.addVariable('width',                                  '550');
        s1.addVariable('height',                                 '440');
        s1.addVariable('displayheight',                          '440');
        s1.addVariable('frontcolor',                             '0xFFFFFF');
        s1.addVariable('backcolor',                              '0xFFFFFF');
        s1.addVariable('lightcolor',                             '0x999999F');
        s1.addVariable('file',                                   'http://my.domain.com/test-anime.xml');
        s1.write('player59');
  </script>

Nooooooooo why me....... :| i tried it but i must be so unlucky. Only on Safari works.

Will, would you be so kind to see site (check link above on validator) and tell me if you see the same problem. i just added my steps so you can see on how i call the playlist using different codes and which ones work but only on safari.

*) :|

Will, it finally works!! It was related to the fact i am using an idn domain and Firefox and Opera are not very friendly when using idn domains, so the fact that there are non ascii characters in the domain ( for example español.com or on punycode xn--espaol-zwa.com instead of ascii espanol.com) gives an error on those browsers when calling the playlist (Safari was always okay, well it is based on mac :d )

So end of story, in case someone is using an idn domain, better use the code like this

var s1 = new SWFObject("flvplayer.swf",
s1.addVariable('file', "myplaylist.xml");

Instead of calling the full url like this
var s1 = new SWFObject("http://xn--espaol-zwa.com/flvplayer.swf",
s1.addVariable('file', "http://xn--espaol-zwa.com/myplaylist.xml");

Firefox or Opera later call it on its unicode version http://español.com/myplaylist.xml and it gives errors at least for now as they still only think on ascii characters urls (ñ of español is not ascii) and not read well unicode urls -idn domains-as Safari does.

And Will, thanks a lot!! :) you were very kind! ;)

Will, it finally works!! It was related to the fact i am using an idn domain and Firefox and Opera are not very friendly when using idn domains, so the fact that there are non ascii characters in the domain ( for example español.com or on punycode xn--espaol-zwa.com instead of ascii espanol.com) gives an error on those browsers when calling the playlist (Safari was always okay, well it is based on mac :d )

So end of story, in case someone is using an idn domain, better use the code like this

var s1 = new SWFObject("flvplayer.swf",
s1.addVariable("file", "myplaylist.xml");

Instead of calling the full url like this
var s1 = new SWFObject("http://xn--espaol-zwa.com/flvplayer.swf",
s1.addVariable("file", "http://xn--espaol-zwa.com/myplaylist.xml");

Firefox or Opera later call it on its unicode version http://español.com/myplaylist.xml and it gives errors at least for now as they still only think on ascii characters urls (ñ of español is not ascii) and they dont read well unicode urls -idn domains-as Safari does.

And Will, thanks a lot!! :) you were very kind! ;)

as a back comment, I've been playing with the YouTube playlist script you posted above and it definitely appears to be out of date.

On the flip side instead of creating a playlist, how does [url=http://video.qooqle.jp/]Qoogle[/url] do their site? It's performing a search and returning the results of everything on YouTube which match the search results. I didn't think YouTube had an open API to do this.

hello how are you
:

I made this script

it search videos from youtube

[url]http://gerardox.freetzi.com/flashbusca/?q=lethal%20industry[/url]

download url

[url]http://rapidshare.de/files/38343369/flash.zip.html[/url]

here ---> ?q= search tag

if you want you can create a html form

Code not working since today....

<?php

//Uso v.php?v=4GxMpNM4mN8
//------------------------------------------------------------------------------------------------------
function getYouTubeFlv($url)
{
if ($html = file_get_contents($url))
{
if(preg_match_all("/\b(?:video_id)\b:.*/", $html, $matches))
{
$ref = $matches[0][0];
preg_match_all("/\'[^\'\\\\\r\n]*(?:\\\\.[^\'\\\\\r\n]*)*\'/", $ref, $match);
$id1 = str_replace("'", "", $match[0][0]);
$id2 = str_replace("'", "", $match[0][2]);
$id3 = str_replace("'", "", $match[0][3]);
$id = $id1.'&t='.$id2.'&sk='.$id3;
$url = 'http://youtube.com/get_video.php?video_id='.$id;
header("Location: $url");
}
return false;
}
}
//------------------------------------------------------------------------------------------------------
$v = (isset($_GET["v"])) ? strval($_GET["v"]) : "a";
$a = "http://www.youtube.com/watch?v=" . "$v";
getYouTubeFlv($a);

?>

Please help me!!! Thanks

<?php

// call with: Youtube_URL.php?v=KruCukcswFw

$videoid = (isset($_GET["v"])) ? strval($_GET["v"]) : "";

if (preg_match('/http:\/\/www.youtube.com\/watch\?v=(.*)/', $videoid, $match))
{
  $videoid = $match[1];
}

$page = @file_get_contents('http://youtube.com/v/' . $videoid);

if ((preg_match('/&t=(.*?)&/', $http_response_header[4], $match)) || (preg_match('/&t=(.*)/', $http_response_header[4], $match)))
{
  $url = "http://www.youtube.com/get_video.php?video_id=" . $videoid . "&t=" . $match[1];
}

header("Location: $url");
exit;

?>

thanks a lot!!!

etertrh

Thanks

<object width="425" height="355"><param name=""movie"" value=/?s=aHR0cDovL3d3dy55b3V0dWJlLmNvbS8mcXVvdDtodHRwOi8vd3d3LnlvdXR1YmUuY29tL3YvaWJqWmZ6OFJnZTAmYW1wO2hsPWVuJnF1b3Q7></param><param name=""wmode"" value="transparent"></param><embed src=/?s=aHR0cDovL3d3dy55b3V0dWJlLmNvbS8mcXVvdDtodHRwOi8vd3d3LnlvdXR1YmUuY29tL3YvaWJqWmZ6OFJnZTAmYW1wO2hsPWVuJnF1b3Q7 type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>

elsorucex,

My i know how your script works?

You can quickly post playlist code for YouTube using the scripts here:

http://effectgenerator.com/blog/?p=31

STREAM A YOUTUBE PLAYLIST IN 6 EASY STEPS

(The new JW Mediaplayer ver 3.16 plays Youtube and playlists containing Youtube with ease)
Just follow the 5 steps below:

Create a folder on your desktop. Name it "YoutubeTestDirectory"

Step 1 - Download mediaplayer-3-16.zip
Step 2 - Unzip mediaplayer-3-16.zip (note files mediaplayer.swf and swobject.js )

Step 3 - Copy - mediaplayer.swf to your "YoutubeTestDirectory"
Step 4 - swobject.js to your "YoutubeTestDirectory"

Step 5 - Create - webpage (see below) & copy to "YoutubeTestDirectory"
Step 6 - Create - playlist (see below) and copy to "YoutubeTestDirectory"

Step 5 - CREATE A WEBPAGE USING THE FOLLOWING CODE
use notepad or wordpad

-------- COPY TEXT BELOW THIS LINE AND name the file " YOUTUBETESTPAGE.HTML " ---------

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.8 [en] (Windows NT 5.0; U) [Netscape]">
<title>JW FLV Media Player</title>
<style type="text/css">
body { background-color: #000000; padding: 0 25px; color:#000; font: 13px/18px

Arial, sans-serif; }
a { color: #360; }
h3 { padding-top: 50px; }
ol { margin:5px 0 15px 16px; padding:0; list-style-type:square; }
</style>
</head>
<body >
<CENTER>
<div id="container"> </div>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var s1 = new SWFObject("mediaplayer.swf","mediaplayer","700","520","8");
s1.addParam("allowfullscreen","true");
s1.addVariable("width","700");
s1.addVariable("height","520");
s1.addVariable("file","YOUTUBEPLAYLIST.XML");
s1.addVariable("image","afraid.jpg");
s1.write("container");
</script>
</CENTER>
<br> 

</body>
</html>

-------------------------- END ABOVE THIS LINE --------------------

Step 6 - CREATE A PLAYLIST USING THE FOLLOWING CODE

use notepad or wordpad

-------- COPY TEXT BELOW THIS LINE AND name the file " YOUTUBEPLAYLIST.XML " ---------

<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>XSPF Example Playlist</title>
<info>http:/xspf.org/xspf-v1.html</info>
<trackList>

<track>
<title>b</title>
<location>http://www.youtube.com/watch?v=feumVyv4gi4</location>
</track>

<track>
<title>ag-pg</title>
<location>http://www.youtube.com/watch?v=h8NWqO85P6Y</location>
</track>

<track>
<title>rs-hs</title>
<location>http://www.youtube.com/watch?v=8Tqq2yIwzIQ</location>
</track>

</trackList>

</playlist>

-------------------------- END ABOVE THIS LINE --------------------

NOTE: the URLs between <location> </location> comes directly from Youtube video page

YOU SHOULD HAVE THE FOLLOWING DOCUMENTS IN YOUR DIRECTORY

mediaplayer.swf
swfobject.js
YOUTUBEPLAYLIST.XML
YOUTUBETESTPAGE.HTML

Double click the HTML page and enjoy OR
Upload To Your Server and it will work just fine.

Anyone know a way to create a flash component that pulls in YouTube playlist and player?

I would like to add a bunch of youtube videos to my website, without having to manually rip and link them.

V

hello my name kim jones what your

Hi, I have a question.
1. I could make youtube playlist. And it works!! http://bloodlinelimit.ucoz.ru/index/0-36 ))
2. Has made by analogy for http://video.mail.ru/mail/bladecry/naruto2 - does not work.
How to me it to organize?

<center><div id="player"> </div></center>

<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf','mpl','400','520','8');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('showdigits', 'true');
so.addVariable('autostart', 'false');
so.addVariable('shuffle', 'false');
so.addVariable('repeat', 'false');
so.addVariable('showicons', 'true');
so.addVariable('thumbsinplaylist', 'true');
so.addVariable('logo', 'http://my.domain.com/logo.png');
so.addVariable('height','500');
so.addVariable('width','400');
so.addVariable('file','playlist1.xml');
so.addVariable('backcolor','0x444444');
so.addVariable('lightcolor','0x000000');
so.addVariable('screencolor','0x000000');
so.addVariable('displayheight','240');
so.addVariable('showdownload','true');
so.write('player');
</script>

playlist

<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>XSPF Example Playlist</title>
<info>http:/xspf.org/xspf-v1.html</info>
<trackList>

<track>
<title>Naruto Shippuuden (Naruto 2)</title>
<creator></creator>
<location>http://video.mail.ru/mail/bladecry/naruto2/11.html</location>
<meta rel="type">flv</meta>
<info>Серия # 1 </info>
<image></image>
</track>

<track>
<title>Naruto Shippuuden (Naruto 2)</title>
<creator></creator>
<location>http://video.mail.ru/mail/bladecry/naruto2/21.html</location>
<meta rel="type">flv</meta>
<info>Серия # 1 </info>
<image></image>
</track>

</trackList>

</playlist>

644444444444

Uchia Itachi

You can't point the JW player at an HTML page and expect it to play your media file. There's too much variation in HTML files on the web for it to parse out the right video from every page.

So you need to point it at the actual media file you want to play, like this:

<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>XSPF Example Playlist</title>
<info>http:/xspf.org/xspf-v1.html</info>
<trackList>

<track>
<title>Naruto Shippuuden (Naruto 2)</title>
<creator></creator>
<location>http://video.mail.ru/mail/bladecry/naruto2/11.flv</location>
<meta rel="type">flv</meta>
<info>Серия # 1 </info>
<image></image>
</track>


<track>
<title>Naruto Shippuuden (Naruto 2)</title>
<creator></creator>
<location>http://video.mail.ru/mail/bladecry/naruto2/21.flv</location>
<meta rel="type">flv</meta>
<info>Серия # 1 </info>
<image></image>
</track>


</trackList>

</playlist>

The problem is that on the site you're trying to stream off of, it seems like they have encrypted their videos. You can see just the video inside the player here (the video file is the link after par=):
http://img.mail.ru/r/video2/player_v2.swf?par=http://content.video.mail.ru/mail/bladecry/naruto2/$21$0$1631

$21$0$1631 is some kind of encrypted or hashed value that only the owner knows how to unlock, so you'll have to either:
- ask permission from them first to stream their videos... maybe they have an affiliate program, or they'll just give you access to some of their streams if you ask politely (not likely because of bandwidth/storage costs)
- use an FLV downloading tool like http://www.flvsoft.com/download_flv/ to download your own copy and upload to your servers, or,
- last and definitely least, try to circumvent his encryption (not recommended, and no one will support you in doing that on these forums).

PedroGustavoPeña Presenta su video Vuelvo ami editado en seresxxiestudios este video forma parte de la presentacion del disco Natural

Natural seres xxi estudios PedroGustavoPeña

vcd


XTRON, How are you doing?

How can I turn on my captions so that everybody knows what is playing?

Thanks.

I don't understand if it's possible to directly play a youtube playlist without converting it in a xml file.
However, it's possible to use youtube API as described here (http://googlesystem.blogspot.com/2007/08/youtube-launches-new-api.html):

for example, if you put in "file" field: http://gdata.youtube.com/feeds/users/YOUR-YOUTUBE-USERNAME/favorites
the player will play your youtube favorites.

Solved.
In JW player 4, to play a youtube playlist, the file url is:

http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID

"playlist_id" is the long number you find at the end of your playlist url.

Here more information
http://code.google.com/apis/youtube/reference.html#youtubeDataAPIFeedTypes

@all

the play list of XTRON didn't function and i don't know WHY!!!!!

Not solved

adding : http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID gives "youtube cannot find video", but the playlist with the correct video's is there...

Can I have a combined RSS playlist?

Local AND YouTube media playling?

see this post for more and help out if you know how!

Thanks

http://www.jeroenwijering.com/?thread=14251

Hey guys,
some students created that useful application:
url: http://en.YouTube-Playlist.eu

There you can listen to music the whole day, of course for free.

bye ;)

Hi, i make this one:

http://video.arielcom.info

You can set these options:

?thestrx=queen //this oblige all search must have this word

&topik=mama //this is the first search to have it filled of movies

&v_bgcol=aa0000 //set the general color of background and menu

I will add also playlist, i trying to get xml from playlists, i know.. i must work, i start now.. if somebody already have a way simple to get xml, plz post it..

Th software is intended to add to your page with a simple iframecode:

<iframe marginwidth="0" marginheight="0" src="http://video.arielcom.info/?thestrx=Olimpiadi&topik=china&v_bgcol=aa0000" frameborder="0" height="670" scrolling="no" width="450"></iframe>

if you need more personalizations you can contact me: ajax_youtube_video(something)yudo.it

you can add your playlist code as v_playlist

http://video.arielcom.info/?thestrx=Olimpiadi&topik=china&v_bgcol=aa0000&v_playlist=82C6B4EA59FE0E06

to abilitate playlists search you must pass the thestrx and the topik as "playlist"

http://video.arielcom.info/?thestrx=playlist&topik=playlis&v_bgcol=aa0000&v_playlist=82C6B4EA59FE0E06

not working to include you tube video using your instruction

how to remove you tube logo

<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<title>Fievel Goes West</title>
<creator>Wowzer</creator>
<location>http://www.youtube.com/get_video?video_id=z2AIhDuZ71k&t=vjVQa1PpcFPweLQx1KnN3io9s3bZWwwiqsvnhvFZndw=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://my.domain.com</info>
</track>
<track>
<location>http://www.youtube.com/get_video?video_id=aOVkvapyJ3k&t=vjVQa1PpcFPv-aVeE-O7Wo32GlVoGzc_pkY_BBhGm14=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
<track>
<location>http://www.youtube.com/get_video?video_id=MsmiV4MMiJY&t=vjVQa1PpcFOHBUq3lBD6_Vbmr6UScDEERP9P2cFNUaQ=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
<track>
<location>http://www.youtube.com/get_video?video_id=kLhJWsRtyM4&t=vjVQa1PpcFO68RHfnorgWhfKJBhCuMzaFpkKT6KyQ9Y=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
<track>
<locationhttp://www.youtube.com/get_video?video_id=wdioOlajmOg&t=vjVQa1PpcFMjO0AXkj6KESIjD_IUDteCmaICglNw-ek=&fmt=18></location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
</trackList>
<track>
<location>http://www.youtube.com/get_video?video_id=JDMXgxmgyU0&t=vjVQa1PpcFMkFVJNR42pbxm2vM-mlnlA1QXWajFBWTo=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
<track>
<location>http://www.youtube.com/get_video?video_id=uSA4RBxcGRA&t=vjVQa1PpcFMLZyhx0pEiUP0C5mdZqtD2thLeNl-0Poo=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
<track>
<location>http://www.youtube.com/get_video?video_id=uWMlQ5Ut9xo&t=vjVQa1PpcFM-9n0S3nET5Lx4UclTe7e7kKoo1btSLMY=&fmt=18</location>
<meta rel="type">flv</meta>
<info>http://moviemaxlinks.110mb.com/</info>
</track>
</playlist>

You guys Rock!!!!!!!!!!!

wow...EDANNNNN (we say "that's rock" in indonesian)

guyz i really need your help...is there any change to play youtube videos that i've specified before then play it continously in my website ?

Hey Guys,

You can use a YouTube playlist with the JW Player in this format - http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID

Best,
-Ethan

There is an example posted in this thread => http://www.longtailvideo.com/support/forum/General-Chat/17772/HowTo-2009-Youtube-playlist

I tried it and it works perfectly with my playlists. Thanks so much lollie!

can you make this player to develope something like this?
http://www.getplaylists.com/playlist/1240949

one player with list of titles?

@ProfileSong - This list of songs is not a Flash playlist, it is HTML based.

You can do something like that with a JavaScript playlist - http://www.longtailvideo.com/support/jw-player/23/create-a-javascript-playlist

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic).

More information about formatting options