Reham Fahmy
Reham Fahmy

Reputation: 5063

Why calling file by id is not working with jw player

I've came to an idea that looks very simple of how to hide video link to certain limit

Okay suppose we've

index.php

<?PHP

$media = 'http://www.some_site.com/get.php?id=2';

echo '<object id="mediaplayer" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701" standby="loading microsoft windows media player components..." type="application/x-oleobject" width="300" height="225">
<param name="filename" value="'.$media.'">
<param name="animationatstart" value="true">
<param name="transparentatstart" value="true">
<param name="autostart" value="true">
<param name="showcontrols" value="true">
<param name="ShowStatusBar" value="true">
<param name="windowlessvideo" value="true">
<embed type="application/x-mplayer2" src="'.$media.'" autostart="true" showcontrols="true" showstatusbar="1" bgcolor="white" width="300" height="225">
</object>';

?>

and get.php code

<?PHP

$id = $_GET['id'];

if ($id === '2') {

$file = "http://www.real_site.com/video/test.wmv";
echo $file;

} else {
echo "die well";
}

?>

so when we call http://www.some_site.com/get.php?id=2 it will brings http://www.real_site.com/video/test.wmv and it worked

i've noticed that it works fine even with youtube embedding code iframe vlc and the ugly brothers quicktime realplayer players ... etc but not with JW Player

here is the code of index.php for case of jwplayer

<?PHP

$media = 'http://www.some_site.com/get.php?id=2';

// suppose it leads to youtube link or of what jw player support

echo "<script type='text/javascript' src='player/jwplayer.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'player/player.swf',
'file': '".$media."',
'controlbar': 'bottom',
'width': '300',
'height': '225',
'skin': 'player/schoon.zip'
});
</script>";

?>

it print this error

enter image description here

so is there any reason or this ! ~ that out helps me a lot

Upvotes: 2

Views: 370

Answers (2)

emaxsaun
emaxsaun

Reputation: 4201

Under:

'file': '".$media."',

Add:

'provider': 'video',

You should be all set!

Upvotes: 1

Ignacio Ocampo
Ignacio Ocampo

Reputation: 2713

You need redirect to media file instead of print file url:

<?PHP

$id = $_GET['id'];

if ($id === '2') {

$file = "http://www.real_site.com/video/test.wmv";
//echo $file;
header('Location: '.$file);

} else {
echo "die well";
}

?>

Upvotes: 1

Related Questions