I have spent many hours reading/trying suggestions in this forum regarding xmoov/jwplayer, but have been unable to make it work so far!
I best test case I found is:
www.opsysguy/jwtest1/test6.html
I have verified the following:
1. It enters xmoov correctly, and downloads the image as expected, either specifying xmoov explicitly or as initiated from test6.html.
2. The player executes and displays the video box.
3. When the start button is clicked it comes back with an error saying "Video not found: "video_x.flv".
4. With debug code added to xmoov I have verified that the paths are correct, the file is opened, positioned, and that the contents are read and sent as expected. The debug output is also included below.
5. If the name of the xmoov in the .php file is modified to be invalid, then the video does display correctly, but obviously the xmoov is not entered. This implies that the paths are correct.
6. The absolute root path to the folder containing all the files (test6.html, player.swf, swfobject.js, video_x.flv, etc.) is:
/home/content/s/k/o/skottaka/html/jwtest1/
The server relative path is:
/jwtest1/
7. The headers as detected by the browser are also shown below.
8. The phpinfo can be viewed at:
www.opsysguy.com/phpinfo.html
Any suggestions would be appreciated.
test6.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>XMOOV streamer - jwtest1 - test #6</title>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>
<div id="mediaspace">This text will be replaced
<a 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('http://www.opsysguy.com/jwtest1/player.swf', 'mp1', '470', '320', '9.0.124');
so.addParam('allowscriptaccess', 'true');
so.addParam('allowfullscreen', 'true');
so.addVariable('streamer', 'http://www.opsysguy.com/jwtest1/xmoov6.php');
so.addVariable('file', 'video_x.flv');
so.addVariable('type', 'http');
so.addVariable('http.startparam', 'start');
so.write('mediaspace');
</script>
</body>
</html>xmoov6.php
<?php
//------------------------------------------------------------------------------------------
// 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', $_SERVER['DOCUMENT_ROOT']);
//define('XMOOV_PATH_ROOT', '/');
//
// points to the folder containing the video files.
//define('XMOOV_PATH_FILES', '');
define('XMOOV_PATH_FILES', '/jwtest1/');
//------------------------------------------------------------------------------------------
// 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);
//------------------------------------------------------------------------------------------
// 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', 'pos'); // v3.x player
define('XMOOV_GET_POSITION', 'start'); // v4.x player
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 //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function debtsj($line, $msg)
{
$fhd = fopen($_SERVER['REMOTE_ADDR'] . '.txt', 'a+');
fwrite($fhd, $line . ': ' . $msg . PHP_EOL);
fclose($fhd);
}
debtsj(__LINE__, date('ymdhms') . ' Server = ' . $_SERVER['REMOTE_ADDR']);
//------------------------------------------------------------------------------------------
// PROCESS FILE REQUEST
//------------------------------------------------------------------------------------------
if(isset($_GET[XMOOV_GET_FILE]))
{
// PROCESS VARIABLES
// get seek position
$seekPos = isset($_GET[XMOOV_GET_POSITION]) ? intval($_GET[XMOOV_GET_POSITION]) : 0;
// 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;
debtsj(__LINE__, 'Before file_exists=' . $file);
// security improved by by TRUI www.trui.net
if (!file_exists($file))
{
print('<b>ERROR:</b> xmoov-php could not find (' . $file . ') please check your settings.');
exit();
}
if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName) && ereg('^[^./][^/]*$', $fileName))
{
$fh = fopen($file, 'rb') or die ('<b>ERROR:</b> xmoov-php could not open (' . $fileName . ')');
$fileSize = filesize($file) - (($seekPos > 0) ? $seekPos + 1 : 0);
debtsj(__LINE__, 'Filesize=' . $fileSize);
// 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");
debtsj(__LINE__, 'nocache headers sent');
}
// 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));
debtsj(__LINE__, 'print FLV issued');
}
// seek to requested file position
fseek($fh, $seekPos);
debtsj(__LINE__, 'fseek=' . $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;
if($time_difference < (float)$packet_interval)
{
usleep((float)$packet_interval * 1000000 - (float)$time_difference * 1000000);
}
debtsj(__LINE__, 'time_start=' . $time_start . ' time_stop=' . $time_stop);
}
else
{
// output file without bandwidth limiting
debtsj(__LINE__, 'Enter output file without bandwidth limiting');
while (!feof($fh))
{
print(fread($fh, 16384));
debtsj(__LINE__, 'print from fread');
}
}
}
}
}
//------------------------------------------------------------------------------------------
// 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;
}
}
?>Debug output
75: 091024011019 Server = 72.130.73.183
95: Before file_exists=/home/content/s/k/o/skottaka/html/jwtest1/video_x.flv
110: Filesize=216690
142: fseek=0
169: Enter output file without bandwidth limiting
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from fread
173: print from freadhtml headers received by the browser
http://www.opsysguy.com/jwtest1/test6.html
GET /jwtest1/test6.html HTTP/1.1
Host: www.opsysguy.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: ja_purity_tpl=ja_purity; fontSize=100
Cache-Control: max-age=0
HTTP/1.x 200 OK
Date: Sat, 24 Oct 2009 19:30:15 GMT
Server: Apache
X-Powered-By: ModLayout/3.2.1
Cache-Control: no-cache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------
http://www.opsysguy.com/jwtest1/swfobject.js
GET /jwtest1/swfobject.js HTTP/1.1
Host: www.opsysguy.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.opsysguy.com/jwtest1/test6.html
Cookie: ja_purity_tpl=ja_purity; fontSize=100
If-Modified-Since: Wed, 21 Oct 2009 03:32:14 GMT
If-None-Match: "93b9cf-1ae7-4ade80be"
Cache-Control: max-age=0
HTTP/1.x 304 Not Modified
Date: Sat, 24 Oct 2009 19:30:15 GMT
Server: Apache
Connection: Keep-Alive, Keep-Alive
Keep-Alive: timeout=15, max=98
Etag: "93b9cf-1ae7-4ade80be"
----------------------------------------------------------
http://www.opsysguy.com/jwtest1/player.swf
GET /jwtest1/player.swf HTTP/1.1
Host: www.opsysguy.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.opsysguy.com/jwtest1/test6.html
Cookie: ja_purity_tpl=ja_purity; fontSize=100
If-Modified-Since: Wed, 21 Oct 2009 03:32:15 GMT
If-None-Match: "93b9d4-c376-4ade80bf"
Cache-Control: max-age=0
HTTP/1.x 304 Not Modified
Date: Sat, 24 Oct 2009 19:30:15 GMT
Server: Apache
Connection: Keep-Alive, Keep-Alive
Keep-Alive: timeout=15, max=97
Etag: "93b9d4-c376-4ade80bf"
----------------------------------------------------------
https://a12.alphagodaddy.com/hosting_ads/gd01.js
GET /hosting_ads/gd01.js HTTP/1.1
Host: a12.alphagodaddy.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.opsysguy.com/jwtest1/test6.html
If-Modified-Since: Wed, 02 May 2007 17:27:57 GMT
If-None-Match: "10393a-52f-4638ca1d"
Cache-Control: max-age=0
HTTP/1.x 200 OK
Date: Sat, 24 Oct 2009 19:30:15 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Thu, 17 Sep 2009 22:38:17 GMT
Etag: "137817f-52f-473cdabf08840"
Accept-Ranges: bytes
Content-Length: 1327
Connection: close
Content-Type: application/x-javascript
----------------------------------------------------------
http://a12.alphagodaddy.com/?ref=http://www.opsysguy.com/jwtest1/test6.html&url=http://www.opsysguy.com/jwtest1/test6.html&leo=0
GET /?ref=http://www.opsysguy.com/jwtest1/test6.html&url=http://www.opsysguy.com/jwtest1/test6.html&leo=0 HTTP/1.1
Host: a12.alphagodaddy.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.opsysguy.com/jwtest1/test6.html
HTTP/1.x 200 OK
Date: Sat, 24 Oct 2009 19:30:15 GMT
Server: Apache/1.3.34 (Unix) PHP/5.1.2 mod_ssl/2.8.25 OpenSSL/0.9.7a
X-Powered-By: PHP/5.1.2
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------
http://www.opsysguy.com/jwtest1/xmoov6.php?file=video_x.flv
GET /jwtest1/xmoov6.php?file=video_x.flv HTTP/1.1
Host: www.opsysguy.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: ja_purity_tpl=ja_purity; fontSize=100
HTTP/1.x 200 OK
Date: Sat, 24 Oct 2009 19:30:16 GMT
Server: Apache
X-Powered-By: ModLayout/3.2.1
Cache-Control: no-cache
Keep-Alive: timeout=15, max=97
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------
When I make this request:
http://www.opsysguy.com/jwtest1/xmoov6.php?file=video_x.flv&start=0your xmoov script returns this:<br /><b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/content/s/k/o/skottaka/html/jwtest1/xmoov6.php:1) in <b>/home/content/s/k/o/skottaka/html/jwtest1/xmoov6.php</b> on line <b>125</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/content/s/k/o/skottaka/html/jwtest1/xmoov6.php:1) in <b>/home/content/s/k/o/skottaka/html/jwtest1/xmoov6.php</b> on line <b>127</b><br />
FLV
</iframe></noscript></object></layer></span></div></table></body></html><!-- adsok -->
<script language='javascript' src='https://a12.alphagodaddy.com/hosting_ads/gd01.js'></script>
You can trouble shoot filepath problems by putting a print statement on approximately line 90, then calling the script from your broswer with the URI that I posted above.
$file = XMOOV_PATH_ROOT . XMOOV_PATH_FILES . $fileName;print "File Path: $file"; exit;
// assemble packet interval