Sep. 05, 2008jai
Help. I can not figure out why my playlist is not showing up on the player. Also it will only play one song off the playlist.xml and themn stop. None of the function keys on the player is working. Any ideas?
Dont know which code to post so I will wait.
Sep. 05, 2008kLink
Post your player code or a link to your test page so someone can help you.
Sep. 05, 2008jai
Would that be the swfobject.js or playsongs.php or index.xml or playlist.xml..I am so new. These are the only items I see that have editable text files next to them.
Sep. 05, 2008jai
http://quiana.powweb.com//jewleryboutique/index2.htm is where I am testing the player. Hope this helps.
Sep. 05, 2008kLink
Your playlist is was a huge mess.
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>Sample XSPF Playlist</title>
<info>http://www.jeroenwijering.com/?item=Flash_Media_Player</info>
<annotation>Sample playlist for the media player in XSPF format</annotation>
<trackList>
<track>
<title>English</title>
<creator>Sugarland-Stay</creator>
<location> Webstore/Sugarland-Stay.mp3</location>
<info> Webstore/Sugarland-Stay.mp3</info>
</track>
<track>
<title>English</title>
<creator>Gwen Stefani - Now That You Got It</creator>
<location> Webstore/Gwen Stefani - Now That You Got It.mp3</location>
<info> Webstore/Gwen Stefani - Now That You Got It.mp3</info>
</track>
<track>
<title>English</title>
<creator>Chris Daughtry - Feels Like Tonight</creator>
<location> Webstore/Chris Daughtry - Feels Like Tonight.mp3</location>
<info> Webstore/Chris Daughtry - Feels Like Tonight.mp3</info>
</track>
<track>
<title>English</title>
<creator>Danity Kane - Damaged</creator>
<location> Webstore/Danity Kane - Damaged.mp3</location>
<info> Webstore/Danity Kane - Damaged.mp3</info>
</track>
<track>
<title>English</title>
<creator>Tokio Hotel - Ready, Set, Go</creator>
<location> Webstore/Tokio Hotel - Ready, Set, Go.mp3</location>
<info> Webstore/Tokio Hotel - Ready, Set, Go.mp3</info>
</track>
<track>
<title>English</title>
<creator>Paramore - That's What You Get</creator>
<location> Webstore/Paramore - That's What You Get.mp3</location>
<info> Webstore/Paramore - That's What You Get.mp3</info>
</track>
<track>
<title>English</title>
<creator>Panic At The Disco - Nine In The Afternoon</creator>
<location> Webstore/Panic At The Disco - Nine In The Afternoon.mp3</location>
<info> Webstore/Panic At The Disco - Nine In The Afternoon.mp3</info>
</track>
<track>
<title>English</title>
<creator>Rihanna-Disturbia</creator>
<location> Webstore/Rihanna-Disturbia.mp3</location>
<info> Webstore/Rihanna-Disturbia.mp3</info>
</track>
<track>
<title>English</title>
<creator>Trey Songz & Jim Jones - Fly Together</creator>
<location> Webstore/Trey Songz & Jim Jones - Fly Together.mp3</location>
<info> Webstore/Trey Songz & Jim Jones - Fly Together.mp3</info>
</track>
<track>
<title>English</title>
<creator>DJ Khaled - I'm So Hood (Clean)</creator>
<location> Webstore/DJ Khaled - I'm So Hood (Clean).mp3</location>
<info> Webstore/DJ Khaled - I'm So Hood (Clean).mp3</info>
</track>
<track>
<title>English</title>
<creator>Lil Wayne ft. T-Pain - Get Money</creator>
<location> Webstore/Lil Wayne ft. T-Pain - Get Money.mp3</location>
<info> Webstore/Lil Wayne ft. T-Pain - Get Money.mp3</info>
</track>
<track>
<title>English</title>
<creator>The Dream - I Love Your Girl</creator>
<location> Webstore/The Dream - I Love Your Girl.mp3</location>
<info> Webstore/The Dream - I Love Your Girl.mp3</info>
</track>
<track>
<title>English</title>
<creator>David Banner - Shawty Say ft. Lil Wayne</creator>
<location> Webstore/David Banner - Shawty Say ft. Lil Wayne.mp3</location>
<info> Webstore/David Banner - Shawty Say ft. Lil Wayne.mp3</info>
</track>
<track>
<title>English</title>
<creator>Ray J - All I Feel - 04 Gifts</creator>
<location> Webstore/Ray J - All I Feel - 04 Gifts.mp3</location>
<info> Webstore/Ray J - All I Feel - 04 Gifts.mp3</info>
</track>
<track>
<title>English</title>
<creator>Jim Jones - We Fly High (Ballin') clean</creator>
<location> Webstore/Jim Jones - We Fly High (Ballin') clean.mp3</location>
<info> Webstore/Jim Jones - We Fly High (Ballin') clean.mp3</info>
</track>
<track>
<title>English</title>
<creator>Kanye West - Can't Tell Me Nothing (Clean)</creator>
<location> Webstore/Kanye West - Can't Tell Me Nothing (Clean).mp3</location>
<info> Webstore/Kanye West - Can't Tell Me Nothing (Clean).mp3</info>
</track>
<track>
<title>English</title>
<creator>Kanye West - Gold Digger (Clean)</creator>
<location> Webstore/Kanye West - Gold Digger (Clean).mp3</location>
<info> Webstore/Kanye West - Gold Digger (Clean).mp3</info>
</track>
<track>
<title>English</title>
<creator>LL Cool J Ft. The Dream - Baby</creator>
<location> Webstore/LL Cool J Ft. The Dream - Baby.mp3</location>
<info> Webstore/LL Cool J Ft. The Dream - Baby.mp3</info>
</track>
<track>
<title>English</title>
<creator>Lloyd - Want You ft. Lil Wayne</creator>
<location> Webstore/Lloyd - Want You ft. Lil Wayne.mp3</location>
<info> Webstore/Lloyd - Want You ft. Lil Wayne.mp3</info>
</track>
<track>
<title>English</title>
<creator>Jennifer Hudson - Spotlight</creator>
<location> Webstore/Jennifer Hudson - Spotlight.mp3</location>
<info> Webstore/Jennifer Hudson - Spotlight.mp3</info>
</track>
<track>
<title>English</title>
<creator>Trey Songz ft. Big Kuntry King - Da Baddest (prod by Shawty Redd)</creator>
<location> Webstore/Trey Songz ft. Big Kuntry King - Da Baddest (prod by Shawty Redd).mp3</location>
<info> Webstore/Trey Songz ft. Big Kuntry King - Da Baddest (prod by Shawty Redd).mp3</info>
</track>
<track>
<title>English</title>
<creator>David Banner-Stuntin Is A Habit feat. Yung Joc, Chris Brown & Jim Jones</creator>
<location> Webstore/David Banner-Stuntin Is A Habit feat. Yung Joc, Chris Brown & Jim Jones.mp3</location>
<info> Webstore/David Banner-Stuntin Is A Habit feat. Yung Joc, Chris Brown & Jim Jones.mp3</info>
</track>
<track>
<title>English</title>
<creator>Nicole Scherzinger Feat. T.I. - Whatever U Like</creator>
<location> Webstore/Nicole Scherzinger Feat. T.I. - Whatever U Like.mp3</location>
<info> Webstore/Nicole Scherzinger Feat. T.I. - Whatever U Like.mp3</info>
</track>
<track>
<title>English</title>
<creator>Amy Winehouse - 02 - You Know I'm No Good - Back To Black</creator>
<location> Webstore/Amy Winehouse - 02 - You Know I'm No Good - Back To Black.mp3</location>
<info> Webstore/Amy Winehouse - 02 - You Know I'm No Good - Back To Black</info>
</track>
<track>
<title>English</title>
<creator>Notorious BIG - Juicy (Clean)</creator>
<location> Webstore/Notorious BIG - Juicy (Clean).mp3</location>
<info> Webstore/Notorious BIG - Juicy (Clean).mp3</info>
</track>
<track>
<title>English</title>
<creator>Yung Berg feat. Casha - The Business</creator>
<location> Webstore/Yung Berg feat. Casha - The Business.mp3</location>
<info> Webstore/Yung Berg feat. Casha - The Business.mp3</info>
</track>
<track>
<title>English</title>
<creator>Akon ft. Kardinal Offishall - Dangerous (2008)</creator>
<location> Webstore/Akon ft. Kardinal Offishall - Dangerous (2008).mp3</location>
<info> Webstore/Akon ft. Kardinal Offishall - Dangerous (2008).mp3</info>
</track>
<track>
<title>English</title>
<creator>Rihana - Take a bow</creator>
<location> Webstore/Rihana - Take a bow.mp3</location>
<info> Webstore/Rihana - Take a bow.mp3</info>
</track>
<track>
<title>English</title>
<creator>Estelle - American Boy ft Kanye West</creator>
<location> Webstore/Estelle - American Boy ft Kanye West.mp3</location>
<info> Webstore/Estelle - American Boy ft Kanye West.mp3</info>
</track>
<track>
<title>English</title>
<creator>Flo Rida Ft. Will.I.Am & Fergie - In The Ayer</creator>
<location> Webstore/Flo Rida Ft. Will.I.Am & Fergie - In The Ayer.mp3</location>
<info> Webstore/Flo Rida Ft. Will.I.Am & Fergie - In The Ayer.mp3</info>
</track>
<track>
<title>English</title>
<creator>Ace Hood - Cash Flow (ft. DJ Khaled, Rick Ross, T-Pain)</creator>
<location> Webstore/Ace Hood - Cash Flow (ft. DJ Khaled, Rick Ross, T-Pain).mp3</location>
<info> Webstore/Ace Hood - Cash Flow (ft. DJ Khaled, Rick Ross, T-Pain).mp3</info>
</track>
<track>
<title>English</title>
<creator>Plies ft. Ne-Yo - Bust It Baby Part 2</creator>
<location> Webstore/Plies ft. Ne-Yo - Bust It Baby Part 2.mp3</location>
<info> Webstore/Plies ft. Ne-Yo - Bust It Baby Part 2.mp3</info>
</track>
<track>
<title>English</title>
<creator>Rick Ross - Trilla - 10 - Here I Am (featuring Nelly & Avery Storm)-RGF</creator>
<location> Webstore/Rick Ross - Trilla - 10 - Here I Am (featuring Nelly & Avery Storm)-RGF.mp3</location>
<info> Webstore/Rick Ross - Trilla - 10 - Here I Am (featuring Nelly & Avery Storm)-RGF.mp3</info>
</track>
<track>
<title>English</title>
<creator>A Cursive Memory - Everything</creator>
<location> Webstore/A Cursive Memory - Everything.mp3</location>
<info> Webstore/A Cursive Memory - Everything.mp3</info>
</track>
<track>
<title>English</title>
<creator>All Time Low - Dear Maria, Count Me In</creator>
<location> Webstore/All Time Low - Dear Maria, Count Me In.mp3</location>
<info> Webstore/All Time Low - Dear Maria, Count Me In</info>
</track>
<track>
<title>English</title>
<creator>usher - yeah - yeah clean</creator>
<location> Webstore/usher - yeah - yeah clean.mp3</location>
<info> Webstore/usher - yeah - yeah clean.mp3</info>
</track>
</trackList>
</playlist>
Sep. 05, 2008jai
Thank you so much. SO should i reload this information into the playlist?
Sep. 05, 2008jai
The playlist still does not show up in the player and the time code doesnt move, and the songs dont continuosly play. It stop after 1 and the buttons dont work. Im still looking for help with those issues. I appreciate the corrected playlist. However it still doing the same thing it was doing before. No list showing up in the load folder on the player and no functionality in the player itself.
Sep. 05, 2008jai
I was able to load the old code from a previous player and the old playlist came up. However the music still wont play continuosly and its playing the current playlist.
ANY HELP?
Sep. 05, 2008kLink
See the v3.x player supported flashvars here: http://code.jeroenwijering.com/trac/wiki/Flashvars3
<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf', 'mpl', '320', '320', '8');
so.addParam('allowfullscreen', 'true');
so.addVariable('width', '320');
so.addVariable('height', '320');
so.addvariable('displayheight', '0');
so.addVariable('file', 'playlist.xml');
so.addVariable('repeat', 'list'); // or 'true'
so.addVariable('autostart', 'true');
so.addVariable('enablejs', 'true');
so.addVariable('javascriptid', 'mpl');
so.write('player');
</script>
Sep. 05, 2008jai
im so confused....
Sep. 05, 2008jai
I am so new to this and I dont understand. I had this set up by a guy and I am trying to reset the audio files and I have no clue what this all means. i was told that if I update the playlist then all would be fine. That is not true. All is a mess.
Sep. 05, 2008kLink
Update this page: http://quiana.powweb.com/jewleryboutique/templates/theme073/headerplayer/index.html with whatever code editor you are using. Use the code that I posted above.
Sep. 05, 2008jai
This is the code that is on the page. I dont know why this isnt working. I don know where on this page the code you sent should go. I added it to the area that had the same kind of code and I also tried it alone. Nothing worked. I loaded back up the original information and now it wont pla anything...Im screwed.
When I click on the index.html it comes up with a larger player and the music is loaded and it plays.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Arkiva Music Player</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// some variables to save
var currentPosition;
var currentVolume;
var currentItem;
// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm) {thisMovie('mpl').sendEvent(typ,prm);};
function getUpdate(typ,pr1,pr2,pid) {
if(typ == "time") { currentPosition = pr1; }
else if(typ == "volume") { currentVolume = pr1; }
else if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100); }
var id = document.getElementById(typ);
id.innerHTML = typ+ ": "+Math.round(pr1);
pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
if(pid != "null") {
document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
}
};
// These functions are caught by the feeder object of the player.
function loadFile(obj) { thisMovie("mpl").loadFile(obj); };
function addItem(obj,idx) { thisMovie("mpl").addItem(obj,idx); }
function removeItem(idx) { thisMovie("mpl").removeItem(idx); }
function getItemData(idx) {
var obj = thisMovie("mpl").itemData(idx);
var nodes = "";
for(var i in obj) {
nodes += "<li>"+i+": "+obj[i]+"</li>";
}
document.getElementById("data").innerHTML = nodes;
};
function getVolume() {
return currentVolume;
}
function getPlayerData(idx) {
if(document.getElementById(idx))
{
strValue = document.getElementById(idx).innerHTML;
if(strValue != "")
strValue = strValue.replace(idx+": ","");
if(strValue != "")
strValue = strValue.replace(" ","");
return trim(strValue);
}
return "";
}
// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
if(navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
};
function trim(Val)
{
while(''+Val.charAt(0)==' ')
Val=Val.substring(1,Val.length);
return Val;
};
</script>
</head>
<body >
<p id="player"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this movie.</p>
<p id="loading"></p>
<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf','mpl','320','290','10');
so.addParam("allowfullscreen","true");
/*so.addVariable("file","playlist.xml");*/
so.addVariable("enablejs","true");
so.addVariable("javascriptid","mpl");
//so.addVariable('autostart', "Lil Wayne ft. T-Pain - Get Money.mp3");
so.addVariable('autostart','true');
so.addVariable("displayheight","290");
so.write('player');
</script>
<h2>RECEIVE UPDATES</h2>
<p id="pid"></p>
<ul>
<li id="item"> </li>
<li id="volume"> </li>
<li id="state"> </li>
<li id="time"> </li>
<li id="load"> </li>
<li id="size"> </li>
</ul>
<li><a href="javascript:sendEvent('playpause')">Toggle the pause state</a>.</li>
<ul id="data"></ul>
</body>
</html>
Sep. 05, 2008jai
I am using the editor that comes with my server. You click on edit and it comes up on a new page.
http://quiana.powweb.com/jewleryboutique/templates/theme073/headerplayer/index.html
Sep. 05, 2008kLink
Replace everything from the beginning <script type="text/javascript"> to the ending </script> tag with the code that I posted.
Sep. 05, 2008jai
the </script> before <h2>RECEIVE UPDATES</h2>
or the </script> before header </head>
Sep. 05, 2008jai
Also do I need to do anything to the code you posted because it looks different then the other code?
Sep. 05, 2008kLink
Replace this code:
<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf','mpl','320','290','10');
so.addParam("allowfullscreen","true");
/*so.addVariable("file","playlist.xml");*/
so.addVariable("enablejs","true");
so.addVariable("javascriptid","mpl");
//so.addVariable('autostart', "Lil Wayne ft. T-Pain - Get Money.mp3");
so.addVariable('autostart','true');
so.addVariable("displayheight","290");
so.write('player');
</script>
Sep. 06, 2008Thomas
I also have a problem with the playlists : the first flv file in the playlist is automatically played ('autostart = true'), but I have to press the 'Play' button to read the followings. Is it one (or more ?) way(s) to get it automatically ?
Thanks !
Sep. 06, 2008kLink
@Thomas,
Please see the v4.x player supported flashvars here: http://code.jeroenwijering.com/trac/wiki/FlashVars
You want to add the repeat flashvar to your flashvars.
Sep. 06, 2008jai
When I changed the allowfullscreen to false the player is now playing continuos. The buttons are now working. However I cant see my playlist so when I change enablejs to false it ask for me to load a playlist. Any ideas.
Sep. 06, 2008Thomas
Thanks kLink,
I did not get it before !
Sep. 06, 2008jai
I think its working now. I didnt understand before. I read and I think I got it. I replaced the code with your code KLink. Thanks so much. Im sure I will be back..LOL..For now thank you so much....
Sep. 07, 2008Dan
Question about forcing a download with force_download.php
Hello, I hope someone can help me.
I have studied all the forum posts and double checked my playlist files but still having trouble getting force_download to work.
I am using JW player v4.1.60 with swfObject2.0
Here is my player embedding:
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="200" id="audios" name="audios">
<param name="movie" value="player.swf">
<param name="allowscriptaccess" value="always">
<param name="flashvars" value="file=http://www.miorganichomebiz.com/training/playlist.xml&playlist=bottom&playlistsize=180&backcolor=000000&frontcolor=ffffff&lightcolor=679DA3">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="player.swf" width="320" height="200">
<param name="allowscriptaccess" value="always">
<param name="flashvars" value="file=http://www.miorganichomebiz.com/training/playlist.xml&playlist=bottom&playlistsize=180&backcolor=000000&frontcolor=ffffff&lightcolor=679DA3">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player">
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
I have the info tag in my playlist.xml file set up like this:
<info>http://www.miorganichomebiz.com/training/force_download.php?file=tracks/22 - journey to success.mp3</info>
I am using the force_download.php script exactly as I found it in another forum post. Here it is:
<?php
// get the file url from querystring
$filename = realpath($_GET['file']);
// Error: only files that are in a subdir of this script can be downloaded
$current_dir = dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if($current_dir != substr(dirname($filename), 0, strlen($current_dir))) {
die( "The requested file cannot be retrieved for security reasons.");
}
// Error: PHP files cannot be downloaded
if(strToLower(substr($filename,strlen($filename)-3, 3) == 'php')) {
die( "The requested file cannot be retrieved for security reasons.");
}
// Error: file is not found
if(!file_exists($filename)) {
die("The requested file could not be found");
}
// required for IE, otherwise Content-disposition is ignored
if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); }
// build file headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
// header for the content type
$ext = strToLower(substr($filename,strlen($filename)-3, 3));
if ($ext == "mp3" ) { header("Content-Type: audio/x-mp3"); }
else if ($ext == "jpg") { header("Content-Type: image/jpeg"); }
else if ($ext == "gif") { header("Content-Type: image/gif"); }
else if ($ext == "png") { header("Content-Type: image/png"); }
else if ($ext == "swf") { header("Content-Type: application/x-shockwave-flash"); }
else if ($ext == "flv") { header("Content-Type: video/flv"); }
// and some more headers
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
// refer to file and exit
readfile("$filename");
exit();
?>
As you can see from my <info> tag, the mp3 file is in a subdirectory of the folder which contains the force_download.php file (which is one level below the folder containing the force_download.php file), just as these forums dictate.
I have tried putting force_download.php in the same folder as the mp3 files but get the same error listed below.
I also does not seem to matter wether my mp3 files have spaces in the file name or not. Both result in the following error:
In both Firefox and IE I get the error generated by this part of the php script:
// Error: only files that are in a subdir of this script can be downloaded
$current_dir = dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if($current_dir != substr(dirname($filename), 0, strlen($current_dir))) {
die( "The requested file cannot be retrieved for security reasons.");
}
What am I doing wrong?
Thanks
Dan
Sep. 08, 2008AdamY
I am having an isse with Safari 3 on a Mac. The player loads with the XML playlist, but the video will not load when called.
Works great in IE6,Mozialla (PC,Mac), Safari PC
any idea what the bug is...
all I can narrow it down to is a div surrounding the player
thanks
Sep. 08, 2008kLink
@Dan,
The best way to troubleshoot this is to put a print statement immediately below the $filename variable, then call the force_download script from your browser using the same URL that you have in your playlist.
Call with:
$filename = realpath($_GET['file']);
print "Filename: " . $filename; exit;
Then, once you see what $filename really is, you can adjust things accordingly.
http://www.miorganichomebiz.com/training/force_download.php?file=tracks/22 - journey to success.mp3
With the script in /training, and the MP3 in /training/tracks, $filename should be tracks/22 - journey to success.mp3 and it should work.
If everything looks OK, the next step would be to print $current_dir and see if the if statementif($current_dir != substr(dirname($filename), 0, strlen($current_dir)))is/is not satisfied.
print "Current Dir: " . $current_dir . "<br />substr(dirname($filename)): " . substr(dirname($filename), 0, strlen($current_dir)); exit;
Sep. 09, 2008Dan
@kLink
Thanks kLink,
I did your first step. Here is precisely what the browser printed when I called the URL:
Filename: /home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3
I'm not sure what that tells me and how I modify my php file and/or playlist file to get things working.
Next I tried your second step (not sure if I did it correctly). Here's what I changed the first 7 lines of force_download to read:
<?php
// get the file url from querystring
$filename = realpath($_GET['file']);
print "Current Dir: " . $current_dir . "<br />substr(dirname($filename)): " .
substr(dirname($filename), 0, strlen($current_dir)); exit;
and here's what the browser printed when I called the URL:
Current Dir:
substr(dirname(/home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3)):
What should I do now?
Thanks again.
Dan
Sep. 09, 2008kLink
You need to insert the print code immediately after $current_dir = ..., like this:
$filename = realpath($_GET['file']);
print "Filename: " . $filename; // exit;
// Error: only files that are in a subdir of this script can be downloaded
$current_dir = dirname(realpath($_SERVER['SCRIPT_FILENAME']));
print "<br />Current Dir: " . $current_dir . "<br />substr(dirname($filename)): " . substr(dirname($filename), 0, strlen($current_dir)); exit;
if($current_dir != substr(dirname($filename), 0, strlen($current_dir))) {
die( "The requested file cannot be retrieved for security reasons.");
}
The output should be:where the last two lines match so the script will allow the file to be downloaded. They won't match, so that should show us what is wrong.
Filename: /home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3
Current Dir: /home/content/m/i/o/miorganicbiz/html/training
substr(...): /home/content/m/i/o/miorganicbiz/html/training
Sep. 09, 2008Dan
Here's the output:
Filename:
/home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3
Current Dir:
/cgi-bin
substr(dirname(/home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3)):
/home/co
(It actually printed it in 3 lines without spaces but it was a bit hard to read....so the extra line spacing is mine)
what should I do now....
Thanks very much,
Dan.
Sep. 09, 2008kLink
So it appears that $current_dir is not returning the correct location of the script, so then there is no match.
Try this:to see if the last two lines match.
$filename = realpath($_GET['file']);
print "Filename: " . $filename;
// Error: only files that are in a subdir of this script can be downloaded
$current_dir = dirname(__FILE__);
print "<br />Current Dir: " . $current_dir . "<br />substr(dirname($filename)): " . substr(dirname($filename), 0, strlen($current_dir)); exit;
if($current_dir != substr(dirname($filename), 0, strlen($current_dir))) {
die( "The requested file cannot be retrieved for security reasons.");
}
They both should be: /home/content/m/i/o/miorganicbiz/html/training
Sep. 09, 2008Dan
Here's the output to that one:
Filename:
/home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3
Current Dir:
/home/content/m/i/o/miorganicbiz/html/training
substr(dirname(/home/content/m/i/o/miorganicbiz/html/training/tracks/22 - journey to success.mp3)):
/home/content/m/i/o/miorganicbiz/html/training
What next?
Thanks
Dan
Sep. 09, 2008kLink
Since the last two lines match now, it should work.
Comment out the print statements and call the script from your browser, you should be able to download the MP3 file.
$filename = realpath($_GET['file']);
// print "Filename: " . $filename;
// Error: only files that are in a subdir of this script can be downloaded
$current_dir = dirname(__FILE__);
// print "<br />Current Dir: " . $current_dir . "<br />substr(dirname($filename)): " . substr(dirname($filename), 0, strlen($current_dir)); exit;
if($current_dir != substr(dirname($filename), 0, strlen($current_dir))) {
die( "The requested file cannot be retrieved for security reasons.");
}
Sep. 09, 2008Dan
@ Grand Master kLink!
Awesome, thanks kLink, it works now.
Kind Regards,
Dan
Sep. 09, 2008kLink
@Dan,
You're welcome. Good Luck!
Sep. 10, 2008weerdboil
Hello,
I have a problem that is related to this thread.
Here is my test - http://testing.bitmedia.co.uk/jw-playlist/
Here is my playlist - http://testing.bitmedia.co.uk/jw-playlist/songs.xml
I have tried many many alternatives but just cannot get the playlist to play.
Any help is very much appreciated.
Thanks!
Sep. 10, 2008kLink
@weerdboil,
You have a really old v2.3 media player but you are trying to use a modern, up-to-date playlist format.
Get at least the v3.16 media player from: http://code.jeroenwijering.com/trac/browser/tags if you want to use the RSS playlist.
Sep. 10, 2008weerdboil
Thankyou
So simple (as always).
This is awesome software
Here is the site I am building - http://staging.bitmedia.co.uk/leogreen/hire-soul-band
How can I list the playlist items closer together?
Sep. 10, 2008kLink
You've already got it:s.addVariable("thumbsinplaylist", "false");That makes each track 21px high, that's the minimum.
Sep. 11, 2008weerdboil
hi again.
I have this set but I am seeing 2 lines per playlist item on my example - http://staging.bitmedia.co.uk/leogreen/hire-soul-band.
thanks for your help.
Sep. 11, 2008kLink
So you made the big leap to the v4.1x player?
Well, now your player code is incorrect. See the v4.x player supported flashvars here: http://code.jeroenwijering.com/trac/wiki/FlashVars
Adobe Flash Player versions less than v9,0,124,0 are buggy and have security holes, so it's best to force your users to upgrade.
function createSongs(theFile, go)
{
var s = new SWFObject("player.swf", "mpl", "300", "560", "9.0.124");
s.addParam("allowfullscreen", "false");
s.addVariable("file", theFile);
s.addVariable("width", "300");
s.addVariable("height", "560");
s.addVariable("displayheight", "20");
s.addVariable("playlistsize", "540");
s.addVariable("playlist", "bottom");
s.addVariable("enablejs", "true");
s.addVariable("javascriptid", "mpl");
s.addVariable("thumbsinplaylist", "false");
if (go)
{
s.addVariable("autostart", "true");
}
s.write("songs");
};
function createFlvs(theFile, go)
{
var s = new SWFObject("player.swf", "PlayerID", "420", "280", "9.0.124");
s.addParam("allowfullscreen", "true");
s.addVariable("file", theFile);
s.addVariable("width", "420");
s.addVariable("height", "280");
s.addVariable("displayheight", "280");
s.addVariable("overstretch", "fit");
s.addVariable("stretching", "exactfit"
s.addVariable("shuffle", "false");
if (go)
{
s.addVariable("autostart", "true");
}
s.write("flvs");
};
The v4.1.x player's playlist is two lines unless you make a skin that only displays one line. Details here: http://www.jeroenwijering.com/?item=Skinning_the_JW_Player
Sep. 11, 2008weerdboil
thanks for this.
should i be using swfobject vers 2.0 aswell?
Sep. 11, 2008kLink
I suppose you might as well upgrade to swfobject v2.1. It is really simpler because you don't need the functions and body onload, etc.
There is info on the implementation and a few gotchas here: http://www.jeroenwijering.com/?thread=9028
swfovject v2.1 is here: http://code.google.com/p/swfobject/
Sep. 11, 2008cal2tenn
I was using an earlier version of the .flv player. When I downloaded a newer version and changed to the player with the playlist on the right, it no longer displayed the creator, only the title.
What happened? How can I fix the problem?
bill@filipiak.com
Sep. 11, 2008kLink
Creator is not displayed yet in the v4.1.x player.
Sep. 11, 2008cal2tenn
Is there an alternate category I can use?
Sep. 11, 2008cal2tenn
Following up ... how do you get the multiple lines of text in the playlist, including different size text? How would I write that in my xml file?
Currently written:
<track>
<title>Nashville Star / Editor</title>
<creator>Client: Picture Vision</creator>
<location>http://www.filipiak.com/swf/meadows.flv</location>
</track>
Sep. 11, 2008kLink
<track>
<title>Client: Picture Vision - Nashville Star / Editor</title>
<location>http://www.filipiak.com/swf/meadows.flv</location>
<annotation>Up two lines of text here.</annotation>
</track>
Please review the v4.1.x player supported playlists here: http://code.jeroenwijering.com/trac/wiki/FlashFormats
Sep. 12, 2008cal2tenn
Incredibly helpful ... thank you so much for the support.
The player looks fantastic.
bf
Sep. 12, 2008Mario Thompson
Hello kLink,
I am new to this and need your help please! loading the files in my site. after I download the file and have them open do I make a video folder for my flash folder location and drop the files inside this folder, and what's next please help.
Thank you
Mario
Sep. 12, 2008kLink
To start with, I would make a sub-directory named "flashplayer" and put player.html (the page that you make with the player code in it), player.swf, swfobject.js, video.flv, and image.jpg in that directory.
Later, once you have everything working, you can make sub-directories for "videos" and "images" so you can keep them separate. You can also copy the working player code to other pages on your site.
It's easiest to use an absolute path to the video and image files. So for instance, your videos would be referenced by "/flashplayer/videos/video1.flv" and so on.
Post back if you need more help and we'll get you running.
Sep. 15, 2008Gigi
I added a XML list to my player. Everything works but I can't see the list on the side of the player. Can anybody help?
Here's the code:
<script type="text/javascript" src="swfobject.js"></script>
<div id="player"><embed
src="player.swf"
width="300"
height="300"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=playlist.xml&autostart=true"
/></div>
<script type="text/javascript">
var so = new SWFObject('player.swf','mpl','470','320','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable("file","playlist.xml");
so.addVariable("enablejs","true");
so.addVariable("javascriptid","mpl");
so.addVariable('autostart','true');
so.addVariable("displayheight","290");
so.write('player');
</script>
Thank you!
Sep. 15, 2008kLink
<script type="text/javascript">
var so = new SWFObject('player.swf','mpl','470','320','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable("file","playlist.xml");
so.addVariable('autostart','true');
so.addVariable('playlist','right');
so.addVariable('playlistsize','253');
so.write('player');
</script>
Delete the embed code, it's not needed.
Please see the v4.x player supported flashvars here: http://code.jeroenwijering.com/trac/ and the Tutorials at the top of this page.
Sep. 16, 2008Gigi
thanks a lot! It works...
Sep. 16, 2008kLink
@Gigi,
Your're welcome. Good Luck!
Jan. 01, 2009hersheys
<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf','mpl','320','290','10');
so.addParam("allowfullscreen","true");
/*so.addVariable("file","playlist.xml");*/
so.addVariable("enablejs","true");
so.addVariable("javascriptid","mpl");
//so.addVariable('autostart', "Lil Wayne ft. T-Pain - Get Money.mp3");
so.addVariable('autostart','true');
so.addVariable("displayheight","290");
so.write('player');
</script>
Sep. 06, 2008Thomas
Mar. 16, 2009anmi07
Hey to anyone dat can help,
I had a playlist that was working before but after I deleted that one for a new one on da same site; (Playlist.com) and posted it on my profile it wouldnt play or even show on my page! all dat would appear are 3 question marks and when I clicked on them my playlist pops up but I dont know how to fix it!
PLEASE HELP!!!
Thanks!!!!
March 16, 2009
Nov. 01, 2009hamza
hi,i get code of my play list but i dont now what to do............,when i paste my code, my play list was not showing
Nov. 01, 2009enric
I tried to config a playlist, I read too much posts but I don't find a solution...
I can see the fla videos, the images, the player, etc ONLY in my pc... I uploaded to the server and don't shows the player...
In the html file I put this:
<script type="text/javascript" src="Default_Files/swfobject.js"></script>
<div id="mediaspace">This text will be replaced</div>
<script type="text/javascript">
var so = new SWFObject('Default_Files/player.swf','mpl','620','314','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('wmode','opaque');
so.addVariable('file','mrss.xml');
so.addVariable('controlbar','none');
so.addVariable('autostart','true');
so.addVariable('displayclick','link');
so.addVariable('repeat','always');
so.addVariable('shuffle','true');
so.write('mediaspace');
</script>
And here you can see my XML playlist:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Panel RSS</title>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:30 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/dlc-carousel.jpg" type="image/jpeg" duration="5" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:31 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/dlc3carousel.jpg" type="image/jpeg" duration="5" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:32 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/dlc4carousel.jpg" type="image/jpeg" duration="5" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:33 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/GOW2carouselphotos.jpg" type="image/jpeg" duration="5" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:34 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/launchtrailer-carousel.jpg" type="image/jpeg" duration="5" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:35 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Gears2_Game_Trailer.flv" type="video/x-flv" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:36 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="snowblind.flv" type="video/x-flv" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:37 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="DLCmap_620x315_v2.flv" type="video/x-flv" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:38 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="darkcorners.flv" type="video/x-flv" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:38 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="amontobinverbal.flv" type="video/x-flv" />
</media:group>
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:38 GMT</pubDate>
<media:group>
<media:credit role="author">Webmaster</media:credit>
<media:content url="bunny.flv" type="video/x-flv" />
</media:group>
</item>
</channel>
</rss>
Can you help me please???
Nov. 01, 2009hobbs
Be sure that you save the playlist file from a plain-text editor like Windows Notepad as Unicode to preserve your Unicode characters.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Panel RSS</title>
<description>Some description here.</description>
<link>http://www.domain.com/</link>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:30 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/dlc-carousel.jpg" duration="5" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:31 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/dlc3carousel.jpg" duration="5" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:32 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/dlc4carousel.jpg" duration="5" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:33 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/GOW2carouselphotos.jpg" duration="5" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:34 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Default_files/launchtrailer-carousel.jpg" duration="5" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:35 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="Gears2_Game_Trailer.flv" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:36 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="snowblind.flv" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:37 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="DLCmap_620x315_v2.flv" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:38 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="darkcorners.flv" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:38 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="amontobinverbal.flv" />
</item>
<item>
<title>Titulo</title>
<description>Descripción de la noticia.</description>
<pubDate>Sat, 30 Oct 2009 00:42:38 GMT</pubDate>
<media:credit role="author">Webmaster</media:credit>
<media:content url="bunny.flv" />
</item>
</channel>
</rss>
Here are some helpful links to learn more about the JW Player™:
Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!
If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.