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

Hide media urls with ID script?


All my music is from ...All my music is from external hosts, is it possible to make it look like there from this site by using link ID's?
e.g. http://mydomain.com/get-file.php?id=1234

Can this be done?

47 Community Answers

JW Player

User  
0 rated :

Bump

JW Player

User  
0 rated :

Hi, I would like to do the same !
Some idea ?

Ty

JW Player

User  
0 rated :

the true address will still show in the browser cache...

JW Player

User  
0 rated :

bc.. <?php

// get-file.php
// call with: http://domain/path/get-file.php?id=1

$id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1";

// lookup
$url[1] = 'http://domain/path/music_01.mp3';
$url[2] = 'http://domain/path/music_02.mp3';
$url[3] = 'http://domain/path/music_03.mp3';
$url[4] = 'http://domain/path/music_04.mp3';

header("Location: $url[$id]");
exit;

?>

bc.. s1.addVariable('file', encodeURIComponent('http://domain/path/get-file.php?id=1'));
s1.addVariable('type', 'mp3');


Tested with YouTube URIs.

Lookup can be an array, external file, database, or scribbled notes on the back of your hand.

JW Player

User  
0 rated :

Thank you very much touchIt !

JW Player

User  
0 rated :

type for videos is "flv"?

JW Player

User  
0 rated :

its cool

JW Player

User  
0 rated :

hey touchIt

i have copied this script and make a file like mp3-songs.php ..
but i dont understand..
where i put these line .." s1.addVariable('file', encodeURIComponent('http://domain/path/get-file.php?id=1'));
s1.addVariable('type', 'mp3');
could you please tell me ?

JW Player

User  
0 rated :

@sunny,

The two lines beginning with "s1.add" go in your player code.

JW Player

User  
0 rated :

@touchIt

please see this image http://www.masti2much.com/asd.jpeg
and please let me know how it is possible..
sunnyjaffri@hotmail.com this is my id

JW Player

User  
0 rated :

You would have to host the file on your server, then use the correct URI to the file on your server in the file flashvar, like this: bc.. so.addVariable('file', 'http://domain/path/music.mp3');
or for embed code: bc.. flashvars="file=http://domain/path/music.mp3&...the rest of the flashvars"

JW Player

User  
0 rated :

Can this be done in ASP as well?? If it can... How?

JW Player

User  
0 rated :

Try a PHP to ASP converter on the script posted above, should get you close enough since it's such a short, simple script. [url=http://www.google.com/search?hl=en&q=converter+PHP+to+ASP]*PHP to ASP converter*[/url]

JW Player

User  
0 rated :

adadad

JW Player

User  
0 rated :

touchIt, could you be so kind and put complete player code for this two lines. shoudl there be special id of player, enabled javascript etc....

s1.addVariable('file', encodeURIComponent('http://domain/path/get-file.php?id=1'));
s1.addVariable('type', 'mp3');

I can't get it work.

thanx so much,
marko

JW Player

User  
0 rated :

@marko,

Adjust *http:/domain/path* for your site.bc.. <!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01//EN""http://www.w3.org/TR/html4/strict.dtd">

<htmllang="en">

<head>

<title>BasicJWPlayer-MP3s</title>

<scripttype="text/javascript"src="http://domain/path/swfobject.js"></script>

<scripttype='text/javascript'>
functioncreatePlayer()
{
vars1=newSWFObject('http://domain/mediaplayer.swf','playlist','400','66','7');
s1.addVariable('width','400');
s1.addVariable('height','66');
s1.addVariable('displayheight','0');
s1.addVariable('file',encodeURIComponent('http://domain/path/get-file.php?id=1'));
s1.addVariable('type','mp3');
s1.addVariable('showdigits','true');
s1.addVariable('autostart','true');
s1.addVariable('thumbsinplaylist','false');
s1.addVariable('backcolor','0xFFFFFF');//faceofbuttons
s1.addVariable('frontcolor','0x404040');//buttonsymbols&playlisttext
s1.addVariable('lightcolor','0x808080');//highlightedplaylistitem
s1.addVariable('screencolor','0x000000');//screenbackgroundcolor
s1.write('player');
};
</script>

</head>

<bodyonload="createPlayer();">

<divid="player">
<ahref="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">GettheFlashPlayer</a>
toplaythismusic.
</div>

</body>

</html>

JW Player

User  
0 rated :

thanx touchit for a quick reply but I still have problems. it just keeps on trying to get my file but no luck.

this is my get-file.php

<?php

$id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1";

// lookup
$url[1] = 'http://mydomainblabla.com/movies/12.flv';

header("Location: $url[$id]");
exit;

?>


this is my html:


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

<html lang="en">

<head>

<title>Basic JW Player - MP3s</title>

<script type="text/javascript" src="http://www.jeroenwijering.com/embed/swfobject.js"></script>

<script type='text/javascript'>
function createPlayer()
{
var s1 = new SWFObject('http://mydomainblabla.com/mediaplayer.swf', 'playlist', '400', '66', '7');
s1.addVariable('width', '400');
s1.addVariable('height', '66');
s1.addVariable('displayheight', '0');
s1.addVariable('file', encodeURIComponent('http://mydomainblabla.com/get-file.php?id=1'));
s1.addVariable('type', 'flv');
s1.addVariable('showdigits', 'true');
s1.addVariable('autostart', 'true');
s1.addVariable('thumbsinplaylist', 'false');
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.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Flash Player</a>
to play this music.
</div>

</body>

</html>

i even tried your exact script for mp3 player, and same thing!

other questions:

is it possible to hide external url location (bottom left of browser).
i suppose it si ok to put xml files in get-file.php as well?

thanx a lot!
marko

JW Player

User  
0 rated :

I have the same problrem :(

JW Player

User  
0 rated :

How do you make If you want do display multiple files once.

JW Player

User  
0 rated :

Hello
I have a very important question
if i use the php script mentioned here
will my server consume bandwidth equal to the file size even if its hosted on another server ?
if yes are there any way to prevent that ?
Thanks alot

JW Player

User  
0 rated :

I can't get the script to work on my site. Is it still working with v4?

Does anyone have a working example on the site? And, out of curiosity, why is the encodeURIComponent function needed?

JW Player

User  
0 rated :

it's ok from single track
but, i need using playlist without write mp3 url
i'd like that player coulde read hide link from playlist (es. www.aaa.com/getfile.asxp?id=1)

JW Player

User  
0 rated :

how do you make the vid id so it automaticly adds itself (using a sql database) ???

JW Player

User  
0 rated :

the s1 variables will depend on the mp3 player you are actually using i believe...i decided to use an XSPF player instead because it is easier to configure (although you can still use the swfobject to display it). for more info, go to http://musicplayer.sourceforge.net

JW Player

User  
0 rated :

Anyone can help me? I am using stream script as below. it is working.
bc.. var so = new SWFObject('player.swf','mpl','450','330','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('backcolor','0x000000');
so.addVariable('file','testvideo.flv');// *It is ok*
so.addVariable('script','&amp;streamscript=stream.php');
so.write('play');


But I would like to use as below. coz i wanna change flv link in php as *touchIt's* idea
bc.. var so = new SWFObject('player.swf','mpl','450','330','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('backcolor','0x000000');
so.addVariable('file',encodeURIComponent('get-links.php?id=1')); // *not working*
so.addVariable('script','&amp;streamscript=stream.php');
so.write('play');




Thanks alot

JW Player

User  
0 rated :

use it as a PARAM instead of a VARIABLE and it should work. I can confirm that I am using this on 4 and it's working.

Not sure if it works with streaming. I have not ventured into that quite yet.

JW Player

User  
0 rated :

Did you modify the player code to accept the flashvar *script* 'cause I can't find it anywhere in the source?

And the Flash Player sure doesn't take it, so it won't work as a parameter.

JW Player

User  
0 rated :

guys I just nee music to be played from database just like this please I need help

http://bbc.com/index.php?mod=music=id=662

JW Player

User  
0 rated :

I mean just using id instead of real source
But I don't mean using flash

JW Player

User  
0 rated :

External javascript control



<a href= Load media files??? http://***/get-file.php?id=1

JW Player

User  
0 rated :

I need also solution for this. I don't really know why this does not work?

This is my PHP code:

<?php
$id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1";
$url = 'http://www.mydomain.com/temp/',$id,'.mp4';
header("Location: $url");
exit;
?>

..and thats how I call it:

s1.addVariable("file", encodeURIComponent("http://www.mydomain.com/get_file.php?id=145"));

I get only blank screen. Everything works fine without separate scripts..

I have multiple files under temp directory which URL I wanna hide out.

This problem have to be now small thing. I have tried all things what have been mentioned above.

JW Player

User  
0 rated :

Thanks a lot! Now it works.

Maybe my problem was that at I was missing this line:

s1.addVariable('type', 'video');

..on my code. Just wondering because it was working without that line with the single .mp4 -file (without this external .php code).

Would there be any idea to use e.g. md5 -encryption for hiding url? Or is it practical to use it?


JW Player

User  
0 rated :

Hi everybody i am new with php script so i maked this player code and i want anyone can help me how to make or get id list like this

$mURL[1] = 'http://domain.com/path/music1.mp3';

and here are my all scripts.

link code:
<A HREF="javascript:void(1)"onclick="window.open('play media.php?id=<?php echo "music 1"; ?>','linkname','height=50, width=480, resizable=0, scrollbars=1')">Play</a>

and this is my media.player code
<?php
$mURL=$_REQUEST['id'];

?>
<html>
<head>
<title></title>

</head>

<body>

<div align="center">
<center>



<table align="center" border="3" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0000FF" width="45" id="AutoNumber1">
<tr>
<td >
<p align="center">
<object id="p67"
height=45 width=434

classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/">
<param name="URL" value="http://domain.com/<?php echo $mURL; ?>" ref>
<param name="autostart" value="-1">
<param name="rate" value="1">
<param name="balance" value="0">
<param name="currentPosition" value="0">
<param name="defaultFrame" value>
<param name="playCount" value="1">
<param name="currentMarker" value="0">
<param name="invokeURLs" value="-1">
<param name="baseURL" value>
<param name="volume" value="50">
<param name="mute" value="0">
<param name="uiMode" value="full">
<param name="stretchToFit" value="0">
<param name="windowlessVideo" value="0">
<param name="enabled" value="-1">
<param name="enableContextMenu" value="-1">
<param name="fullScreen" value="0">
<param name="SAMIStyle" value>
<param name="SAMILang" value>
<param name="SAMIFilename" value>
<param name="captioningID" value>
<param name="enableErrorDialogs" value="0">
<param name="_cx" value="7117">
<param name="_cy" value="1191">
<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
name="p12"
width=434
height=45
src="http://domain.com/<?php echo $mURL; ?>"
showcontrols="true"
autostart="false"> </embed>
</object>
</td>
</tr>
</table>



</html>

Good answer
thank you all.

JW Player

User  
0 rated :

Works like a charm, thanks. I also added a php session variable so that the script can not be accessed directly.

JW Player

User  
0 rated :

its working with http, anyway to make it work with rtmp (streaming) ?I am using amazon cloudfront streaming, would love to see this working with it.

here is my code

<script type="text/javascript" src="http://player.longtailvideo.com/swfobject.js"></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('http://player.longtailvideo.com/player4.6.swf','mpl','470','320','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','http://***.com/test/php/stream_doh.php?id=1');
so.addVariable('streamer','rtmp://****.cloudfront.net/cfx/st');
so.addVariable('type', 'video');
so.write('mediaspace');
</script>


I am getting Error#2048 in the player

Thanks,


JW Player

User  
0 rated :

I believe that your error is a result of this line:
bc.. so.addVariable('file','http://***.com/test/php/stream_doh.php?id=1');


The file that you're streaming must be hosted on cloudfront and be configured to stream. Please read
http://www.longtailvideo.com/support/forum/Setup-Problems/21384/Cloudfront-RTMP-Streaming-
and
http://docs.amazonwebservices.com/AmazonCloudFront/2009-12-01/DeveloperGuide/index.html?RTMPStreaming.html
for more information.

JW Player

User  
0 rated :

I am wanting to hide my video page from returing after viewed, a script that will either clear the cache file or the http: can not be saved to return as wanted without re buying the video? I use all htm

Any help?

JW Player

User  
0 rated :

replace

header("Location: $url[$id]");
exit;


with


header('Content-Type: text/plain');
echo("$url[$id]");

JW Player

User  
0 rated :

<a href="javascript:loadFile('jstest',{file: encodeURIComponent('http://***8.net.ru/mp3/mp3.php?id=2',image:'http://pic.yupoo.com/my7755/986456388ea8/opoy30sn.jpg'})">



The novice how to do?

JW Player

User  
0 rated :

v.4

<div id="container">
<script src="http://***.net.ru/wp-content/themes/Infinity/mediaplayer/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
var so = new SWFObject('http://heipa.net.ru/wp-content/themes/Infinity/mp3/player.swf','jstest2','240','170','8');
so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true');
so.addVariable('width','240');
so.addVariable('height','170');
so.addVariable('file', encodeURIComponent('http://***.net.ru/mp3/get-file.php?id=<?php echo get_post_meta($post->ID, "flvmp3", true); ?>'));
so.addVariable('type', 'mp3');
so.addVariable('javascriptid','jstest2');
so.addVariable('enablejs','true');
so.addVariable('autostart','true');
so.addVariable("overstretch","fit");
so.addVariable("wmode","transparent");
so.write('container');
</script>



<a href="#" onclick="loadNplay(<?php echo get_post_meta($post->ID, "flvmp3", true); ?>);">



so.addVariable('file', encodeURIComponent('http://***/get-file.php?id=1'));


<a href="#" onclick="l ?????????????????????

How to load relief


JW Player

User  
0 rated :

Use:bc.. $url = "http://www.mydomain.com/temp/$id.mp4";
or:bc.. $url = 'http://www.mydomain.com/temp/' . $id . '.mp4';

If you use double quotes " then PHP will evaluate the variable $id in the expression. Otherwise, you must concatenate the string literals and the expression using the proper concatenation operator, which is the period symbol, not the comma symbol.

Be sure that you are setting the type in your player code:bc.. s1.addVariable('type', 'video');


JW Player

User  
0 rated :

how can i hide this result also

http://mlfat.ledawy.net/Files/cartoon/cartoon.php?id=1

maybe paint it with white color :P

JW Player

User  
0 rated :

I have a two part process to hide my URLs (it works so far)


I have a video.php file :

bc.. <?php
session_start ();
header ('Location:'.$_SESSION['EOKEY']);
session_unset('EOKEY');
?>


and a main file with the player. The first lines (mandatory) are

bc.. <?php
session_start();
$_SESSION['EOKEY']="http://www.****.fr/video/yourvideo.FLV";
?>


and then

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

...

<script type="text/javascript" src="swfobject.js"></script>
<div id="mediaspace">This text will be replaced</div>

<script type="text/javascript">
var so = new SWFObject('player.swf','mpl','768','432','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file',encodeURIComponent('http://www.*****.fr/video/video.php'));
so.addVariable('type', 'video');
so.write('mediaspace');
</script>
</body></html>



I hope this helps.

Lionel







JW Player

User  
0 rated :

Did this work with playlist file, i have a playlist file like this:
<?xml version="1.0" encoding="utf-8"?>

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

<tracklist>
<track>
<title>Track 1</title>
<author>Admin</author>
<annotation>Test song</annotation>
<location>nv.php?id=3</location>
</track>
<track>
<title>Track 2</title>
<author>Admin</author>
<annotation>Test song</annotation>
<location>nv.php?id=4</location>
</track>
<track>
<title>Track 3</title>
<author>Admin</author>
<annotation>Test song</annotation>
<location>nv.php?id=5</location>
</track>
<track>
<title>Track 4</title>
<author>Admin</author>
<annotation>Test song</annotation>
<location>nv.php?id=6</location>
</track>
</tracklist>
</playlist>

in nv.php i'm using header("location:url of mp3 file");
but it doesn't work, how can i fix it? thank you



p/s: sorry for my bad englisdh

JW Player

User  
0 rated :

@jeepsterryan (if you are still watching this thread)

bc.. I also added a php session variable so that the script can not be accessed directly.


I also would like to prevent others from accessing getfile.php directly and still being able to download my music. Can you or somebody else post some code to get me started?

Thanks!

JW Player

User  
0 rated :

<script type="text/javascript" src="http://player.longtailvideo.com/swfobject.js"></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('http://player.longtailvideo.com/player4.6.swf','mpl','470','320','9');
so.addParam('skin','modieus.swf');
so.addParam('id','mpl');
so.addParam('name','mpl');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','3bb_ch3');
so.addVariable('streamer','rtmp://xxxxxx/xxxxxx/live'); * << it working cool *
so.addVariable('type', 'rtmp');
so.write('mediaspace');
</script>


BUT


<script type="text/javascript" src="http://player.longtailvideo.com/swfobject.js"></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('http://player.longtailvideo.com/player4.6.swf','mpl','470','320','9');
so.addParam('skin','modieus.swf');
so.addParam('id','mpl');
so.addParam('name','mpl');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','3bb_ch3');
s1.addVariable('file', encodeURIComponent('http://mydomainblabla.com/get-file.php?id=1')); * << Not Works Why Any one help me! *
so.addVariable('type', 'rtmp');
so.write('mediaspace');
</script>


Thanks a lot

Ethan Feldman

JW Player Support Agent  
0 rated :

Change:

s1.addVariable(‘file’, encodeURIComponent(‘http://mydomainblabla.com/get-file.php?id=1’));

To:

so.addVariable(‘file’, encodeURIComponent(‘http://mydomainblabla.com/get-file.php?id=1’));

And delete this line – so.addVariable(‘type’, ‘rtmp’);

And delete this line – so.addVariable(‘file’,‘3bb_ch3’);

This question has received the maximum number of answers.