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

Forums

/

Using JW Player with XMOOV i get video not found

17 replies [Last post]

Hi I want to create HTTP Pseudo Streaming using xmoov. I have set everything up and I get video not found.

Here is my php script:

<script type='text/javascript' src='http://wpc.11BF.edgecastcdn.net/0011BF/IA_Media_Player/swfobject.js'></script>

<div id='mediaspace'>This text will be replaced</div>

<script type='text/javascript'>
var so = new SWFObject('http://wpc.11BF.edgecastcdn.net/0011BF/IA_Media_Player/new_player.swf','mpl','640','500','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','ACF8S02P2H.flv');
so.addVariable('start','0');
so.addVariable('streamer','http://moodle.studyinteractive.org/video/testmoov.php');
so.write('mediaspace');
</script>

and here is my xmoov php script:

// SCRIPT CONFIGURATION

//------------------------------------------------------------------------------------------
// MEDIA PATH
//
// you can configure these settings to point to video files outside the public html folder.
//------------------------------------------------------------------------------------------

// points to server root
define('XMOOV_PATH_ROOT', '');

// points to the folder containing the video files.
define('XMOOV_PATH_FILES', 'http://wpc.11BF.edgecastcdn.net/0011BF/Videos/');

//------------------------------------------------------------------------------------------
// SCRIPT BEHAVIOR
//------------------------------------------------------------------------------------------

//set to TRUE to use bandwidth limiting.
define('XMOOV_CONF_LIMIT_BANDWIDTH', FALSE);

//set to FALSE to prohibit caching of video files.
define('XMOOV_CONF_ALLOW_FILE_CACHE', TRUE);

//------------------------------------------------------------------------------------------
// BANDWIDTH SETTINGS
//
// these settings are only needed when using bandwidth limiting.
//
// bandwidth is limited my sending a limited amount of video data(XMOOV_BW_PACKET_SIZE),
// in specified time intervals(XMOOV_BW_PACKET_INTERVAL).
// avoid time intervals over 1.5 seconds for best results.
//
// you can also control bandwidth limiting via http command using your video player.
// the function getBandwidthLimit($part) holds three preconfigured presets(low, mid, high),
// which can be changed to meet your needs
//------------------------------------------------------------------------------------------

//set how many kilobytes will be sent per time interval
define('XMOOV_BW_PACKET_SIZE', 90);

//set the time interval in which data packets will be sent in seconds.
define('XMOOV_BW_PACKET_INTERVAL', 0.3);

//set to TRUE to control bandwidth externally via http.
define('XMOOV_CONF_ALLOW_DYNAMIC_BANDWIDTH', TRUE);

//------------------------------------------------------------------------------------------
// DYNAMIC BANDWIDTH CONTROL
//------------------------------------------------------------------------------------------

function getBandwidthLimit($part)
{
switch($part)
{
case 'interval' :
switch($_GET[XMOOV_GET_BANDWIDTH])
{
case 'low' :
return 0.5;
break;
case 'mid' :
return 0.5;
break;
case 'high' :
return 0.2;
break;
case 'off' :
return 0;
break;
default :
return XMOOV_BW_PACKET_INTERVAL;
break;
}
break;
case 'size' :
switch($_GET[XMOOV_GET_BANDWIDTH])
{
case 'low' :
return 20;
break;
case 'mid' :
return 40;
break;
case 'high' :
return 90;
break;
default :
return XMOOV_BW_PACKET_SIZE;
break;
}
break;
}
}

//------------------------------------------------------------------------------------------
// INCOMING GET VARIABLES CONFIGURATION
//
// use these settings to configure how video files, seek position and bandwidth settings are accessed by your player
//------------------------------------------------------------------------------------------

define('XMOOV_GET_FILE', 'file');
define('XMOOV_GET_POSITION', 'start');
define('XMOOV_GET_AUTHENTICATION', 'key');
define('XMOOV_GET_BANDWIDTH', 'bw');

// END SCRIPT CONFIGURATION - do not change anything beyond this point if you do not know what you are doing

The videos are not on my server because I am using Edgecast to stream my videos.

Can someone help?

Hi Tilesh,

This is Ethan from LongTail here to help you.

Can you link me to where you are running our player on your site so I can take a look at your implementation so I can better help you?

Please email me directly at ethan [at] longtailvideo [dot] com to follow up if you have any other questions, thank you.

Best Regards,
-Ethan

I have exactly the same problem.
If I try to access video directly using xmoov.php streaming script, "save as" window appears. But when I try to use xmoov.php through the player, it throws "Video not found".

@Nick, do you have a link?

I get exactly the same thing as Nick.

this is the player code
<script type='text/javascript' src='swfobject.js'></script>
<div id='mediaspace'> </div>
<script type='text/javascript'>
var so = new SWFObject('player.swf','mpl','320','240','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addParam('flashvars','streamer=http://stream.asianmediadistribution.com/xmoov.php&autostart=false&stretching=fill&file=newhuge.flv&...');
so.addVariable('autostart','true');
so.addVariable('stretching','fill');
so.write('mediaspace');
</script>

The url is a test one and file is about 250mb (40 mins ish). all served on a local Apache server.

what is odd is that if I remove the 'provider=http' from the end of the addParam statement the file plays like a progressive download rather than a streamed file.

Also the player seems to ignore any params after the 'streamer' hence the reason to add them to the params. is this wrong ?

If I put the same GET params directly as part of the url, I get a download/save dialogue box.

I tested the file and params on your testing page and it wouldn't play the file either, came back with 'file could not be found' (exactly what I get locally) I checked the mime information in Apache and the settings are there

I checked the meta data of the file also on your testing pages and it is there.

I am using the xmoov.php ver 1.0 file with some minor changes as several of the functions are now deprecated in php 5+. The only thing that seems to trip it up is the provider param

Any and all help appreciated as this has been driving me nuts for days!

Thanks

@Webster - Do you have a link to where you are running this? Thanks.

Hi Ethan

Its not a public server so afraid not, but I can send you the link to a smaller file which does the same thing.

I noticed that the player does not seem to even hit the xmoov.php file as when I rename it, it still plays the movie as if a progressive single file.

here is the config of the player I am using

<script type='text/javascript' src='swfobject.js'></script>
<div id='mediaspace'> </div>
<script type='text/javascript'>
var so = new SWFObject('player.swf','mpl','320','240','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addParam('flashvars','start=1200');
so.addParam('flashvars','streamer=http://stream.asianmediadistribution.com/xmoov.php&file=newhuge.flv&autostart=true&stretching=fill');
so.write('mediaspace');
</script>

I tried this config too :-
<script type='text/javascript' src='swfobject.js'></script>
<div id='mediaspace'> </div>
<script type='text/javascript'>
var so = new SWFObject('player.swf','mpl','320','240','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
//so.addParam('flashvars','provider=http');
so.addParam('flashvars','start=1200');
so.addParam('flashvars','streamer=http://stream.asianmediadistribution.com/xmoov.php&file=newhuge.flv');
so.addVariable('autostart','false');
so.addVariable('stretching','fill');
so.write('mediaspace');
</script>
but it seems to ignore everything below the 'streamer' as it doesn't autostart or 'fill' but it DOES play.

It seems to ignore totally the xmoov.php file ??

if I hit this file directly with the same params http://stream.asianmediadistribution.com/xmoov.php?file=newhuge.flv&start=1200 (note the ?) then it downloads the file through xmoov as I output the $_GET to a file.

Are the player params correct for psuedostreaming through http ? as it may be the way I have set it up

Many thanks Ethan

 
This URI should deliver a file, but it doesn't. Try it in your browser.

Your server and/or your xmoov.php script are broken.

http://stream.asianmediadistribution.com/xmoov.php?file=newhuge.flv&start=12345

Hi Alf

Everything works in the browser, always has... the file downloads immediately.

The url is not a public one so you won't be able to access it, which is why it may appear not to work for anyone else

I wondered if the player script was correct as addVaraibles seem to be ignored after the stream statement.

Thanks

 
Without being able to test it, this would be my best guess:

<script src="swfobject.js"></script>

<div id="mediaspace"><a id="player" class="player" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>

<script type="text/javascript">
  var so = new SWFObject('player.swf', 'mpl', '320', '240', '9.0.124');
      so.addParam('allowscriptaccess',   'always');
      so.addParam('allowfullscreen',     'true');
      so.addVariable('streamer',         'http://stream.asianmediadistribution.com/xmoov.php');
      so.addVariable('file',             'newhuge.flv');
      so.addVariable('provider',         'http');
      so.addVariable('start',            '5000');
      so.addVariable('stretching',       'fill');
      so.addVariable('autostart',        'true');
      so.write('mediaspace');
</script>

Hi Alf / Ethan

I have put the files public, including the player above and I get the same problem. I am sure it must be something straightforward as I can get the file to play as a progressive download but not to stream....

If I hit the script directly it downloads it straight away (http://itgms.com/stream/xmoov.php?file=test.flv&start=123) I use a ? after 'php' right on a direct post to the script?

The mime setting on the server is video/x-flv for .flv.

The player script is as above and for the record, the xmoov.php file I am using is below.

If I put an incorrect file name (in the direct post through the browser) the script returns the correct error so I assume it is being hit. I don't think it is being hit from the player

<?php
/*

xmoov-php 1.0
Development version 0.9.3 beta

by: Eric Lorenzo Benjamin jr. webmaster (AT) xmoov (DOT) com
originally inspired by Stefan Richter at flashcomguru.com
bandwidth limiting by Terry streamingflvcom (AT) dedicatedmanagers (DOT) com

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
For more information, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
For the full license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

*/

// SCRIPT CONFIGURATION

//------------------------------------------------------------------------------------------
// MEDIA PATH
//
// you can configure these settings to point to video files outside the public html folder.
//------------------------------------------------------------------------------------------

// points to server root
define('XMOOV_PATH_ROOT', '');

// points to the folder containing the video files.
define('XMOOV_PATH_FILES', './');

//------------------------------------------------------------------------------------------
// SCRIPT BEHAVIOR
//------------------------------------------------------------------------------------------

//set to TRUE to use bandwidth limiting.
define('XMOOV_CONF_LIMIT_BANDWIDTH', FALSE);

//set to FALSE to prohibit caching of video files.
define('XMOOV_CONF_ALLOW_FILE_CACHE', FALSE);

//------------------------------------------------------------------------------------------
// BANDWIDTH SETTINGS
//
// these settings are only needed when using bandwidth limiting.
//
// bandwidth is limited my sending a limited amount of video data(XMOOV_BW_PACKET_SIZE),
// in specified time intervals(XMOOV_BW_PACKET_INTERVAL).
// avoid time intervals over 1.5 seconds for best results.
//
// you can also control bandwidth limiting via http command using your video player.
// the function getBandwidthLimit($part) holds three preconfigured presets(low, mid, high),
// which can be changed to meet your needs
//------------------------------------------------------------------------------------------

//set how many kilobytes will be sent per time interval
define('XMOOV_BW_PACKET_SIZE', 90);

//set the time interval in which data packets will be sent in seconds.
define('XMOOV_BW_PACKET_INTERVAL', 0.3);

//set to TRUE to control bandwidth externally via http.
define('XMOOV_CONF_ALLOW_DYNAMIC_BANDWIDTH', TRUE);

//------------------------------------------------------------------------------------------
// DYNAMIC BANDWIDTH CONTROL
//------------------------------------------------------------------------------------------

function getBandwidthLimit($part)
{
switch($part)
{
case 'interval' :
switch($_GET[XMOOV_GET_BANDWIDTH])
{
case 'low' :
return 1;
break;
case 'mid' :
return 0.5;
break;
case 'high' :
return 0.3;
break;
default :
return XMOOV_BW_PACKET_INTERVAL;
break;
}
break;
case 'size' :
switch($_GET[XMOOV_GET_BANDWIDTH])
{
case 'low' :
return 10;
break;
case 'mid' :
return 40;
break;
case 'high' :
return 90;
break;
default :
return XMOOV_BW_PACKET_SIZE;
break;
}
break;
}
}

//------------------------------------------------------------------------------------------
// INCOMING GET VARIABLES CONFIGURATION
//
// use these settings to configure how video files, seek position and bandwidth settings are accessed by your player
//------------------------------------------------------------------------------------------

define('XMOOV_GET_FILE', 'file');
define('XMOOV_GET_POSITION', 'start');
define('XMOOV_GET_AUTHENTICATION', 'key');
define('XMOOV_GET_BANDWIDTH', 'bw');

// END SCRIPT CONFIGURATION - do not change anything beyond this point if you do not know what you are doing

//------------------------------------------------------------------------------------------
// PROCESS FILE REQUEST
//------------------------------------------------------------------------------------------

if(isset($_GET[XMOOV_GET_FILE]) && isset($_GET[XMOOV_GET_POSITION]))
{
// PROCESS VARIABLES

# get seek position
$seekPos = intval($_GET[XMOOV_GET_POSITION]);
# get file name
$fileName = htmlspecialchars($_GET[XMOOV_GET_FILE]);
# assemble file path
$file = XMOOV_PATH_ROOT . XMOOV_PATH_FILES . $fileName;

# assemble packet interval
$packet_interval = (XMOOV_CONF_ALLOW_DYNAMIC_BANDWIDTH && isset($_GET[XMOOV_GET_BANDWIDTH])) ? getBandwidthLimit('interval') : XMOOV_BW_PACKET_INTERVAL;
# assemble packet size
$packet_size = ((XMOOV_CONF_ALLOW_DYNAMIC_BANDWIDTH && isset($_GET[XMOOV_GET_BANDWIDTH])) ? getBandwidthLimit('size') : XMOOV_BW_PACKET_SIZE) * 1042;

//print "<pre>File: " . $file . "\nSeek Position: " . $seekPos; exit;

# security improved by by TRUI www.trui.net
if (!file_exists($file))
{
print('<b>ERROR:</b> xmoov-php could not find (' . $fileName . ') please check your settings.');
exit();
}
if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !stristr(basename($_SERVER['PHP_SELF']), $fileName) )//&& ereg('^[^./][^/]*$', $fileName)
{
# stay clean
@ob_end_clean();
@set_time_limit(0);

# keep binary data safe
//set_magic_quotes_runtime(0);

$fh = fopen($file, 'rb') or die ('<b>ERROR:</b> xmoov-php could not open (' . $fileName . ')');

$fileSize = filesize($file) - (($seekPos > 0) ? $seekPos + 1 : 0);

// SEND HEADERS
if(!XMOOV_CONF_ALLOW_FILE_CACHE)
{
# prohibit caching (different methods for different clients)
session_cache_limiter("nocache");
header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
}

# content headers
header("Content-Type: video/x-flv");
header("Content-Disposition: attachment; filename=\"" . $fileName . "\"");
header("Content-Length: " . $fileSize);

# FLV file format header
if($seekPos != 0)
{
print('FLV');
print(pack('C', 1));
print(pack('C', 1));
print(pack('N', 9));
print(pack('N', 9));
}

# seek to requested file position
fseek($fh, $seekPos);

# output file
while(!feof($fh))
{
# use bandwidth limiting - by Terry
if(XMOOV_CONF_LIMIT_BANDWIDTH)
{
# get start time
list($usec, $sec) = explode(' ', microtime());
$time_start = ((float)$usec + (float)$sec);
# output packet
print(fread($fh, $packet_size));
# get end time
list($usec, $sec) = explode(' ', microtime());
$time_stop = ((float)$usec + (float)$sec);
# wait if output is slower than $packet_interval
$time_difference = $time_stop - $time_start;

# clean up
@flush();
@ob_flush();

if($time_difference < (float)$packet_interval)
{
usleep((float)$packet_interval * 1000000 - (float)$time_difference * 1000000);
}
}
else
{
# output file without bandwidth limiting
print(fread($fh, filesize($file)));
}
}

}

}

?>

Really appreciate you guys spending time on this, thank you !

 
I get a 404 from: http://itgms.com/stream/xmoov.php?file=test.flv&start=123

If you want a debugging/logging version of the xmoov script, you can get it from: http://willswonders.myip.org:8074/xmoov_debugging_IPAddress.txt

Do your FLV files have the metadata array of time/byte-position, that is created and injected by FLVMDI or a similar tool?

 
Your xmoov script seems OK. I made a couple of small adjustments for better performance.

You can test it here:

    http://willswonders.myip.org:8074/xmoov_Webster.php?file=he
idi.flv&start=123456

Get your xmoov script here:

    http://willswonders.myip.org:8074/xmoov_Webster.txt

Hi Alf

you might need to the 'www' portion to the url, just tried it again and it downloaded ok from my mac too.

Yes I tested the file in the test portion of the longtail site and it displayed all the metadata (it was inserted by yamdi)

Thanks for doing the changes to the xmoov file.

The test.flv file is 38Mb so you can easily download it and take a look if you need to .

here is the chrome inspect element header info, it looks about the same as the info from the developer testing page.

http://www.itgms.com/stream/test.html
HTTP Information
Request Method:GET
Status Code:200 OK
Request Headers
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5
Response Headers
Accept-Ranges:bytes
Content-Length:1712
Content-Type:text/html
Date:Fri, 19 Mar 2010 19:19:49 GMT
ETag:"407cb61e99c7ca1:61a"
Last-Modified:Fri, 19 Mar 2010 19:19:39 GMT
Server:Microsoft-IIS/6.0
X-Powered-By:ASP.NET

I used the developer testing page and the test.flv file played and streamed (using the preset http setting) sort of... It is isn't smooth and the progress bar is split and you have to click the new play position a couple of times. you can also view the metadata from this page too

scratching my head a bit now...

Thanks

Hi Alf

I just tried the example you gave embedded in the player and it streamed your movie perfectly...

What server is this streaming from(apache, IIS, etc)

At least I know the player is ok and the xmoov.php script is ok, so maybe the server or the file

Will download your file to my server and try that also to try and eliminate the component parts

really appreciate the help

 
My server is nginx v0.8.30

Your script is missing the mods that allow it to deliver the file if the start parameter is missing. This is crucial, because the JW Player doesn't send the start parameter on the first request. The script that I modified will function if the start parameter is missing.

I checked your file test.flv. It does have the time/byte-position metadata.

Your server is quite slow — 0.30mbps.

Are you using some sort of rate limiting?

Hi Alf

No just a rubbish hosting company.... it is just for testing this as a public server, not the one that the service will be running on.

it still doesn't seem to hit the script from the player...

Any other suggestions to the server config maybe? are there additional mime types that I could set (or should have?)

I will see if I can trace anything else further.

Thanks

Hi there,

Would it be possible to receive a copy of this code? The server where it was posted:

http://willswonders.myip.org:8074/xmoov_Webster.txt

is no longer available.

Thanks