Oct. 16, 2009Hermy
I wanted to upgrade from player 4.5 to 4.6 and for this I've replaced the files 'swfobject.js' and 'player.swf' on my web site as I did in the past when newer versions were released. The two files are located in a subfolder called 'embed'.
But this time the new player doesn't work. I get a JavaScript error 'SWFObject not defined', but the JavaScript code is still the same as before, according to the examples on this site. When I upload the older files of player 4.5 everything works fine again.
To fix the error by myself I've tried to run the new player.swf together with the swfobject.js of version 4.5, but this doesn't work, too. In this case the player doesn't find the video file.
Oct. 16, 2009teetered
Check the version of swfobject.js that you are using. Open it with a text editor, the version will be in the first few lines.
The error message "SWFObject..." means that you need v1.5.
You can get SWFObject v1.5 here http://blog.deconcept.com/swfobject/#download
Oct. 16, 2009Hermy
Thanks, teetered, for your reply. The JavaScript error really came from the wrong swfobject.js file, but there seem to be another problem with the new player.
The new player doesn't find the video files anymore. I'm using HTTP streaming with an xmoov-php as pseudo streamer. The player.swf and swfobject.js are in a subfolder named embed, the video files are in a subfolder called video and the xmoov.php resides in the root directory. The JavaScript part of the calling PHP script (also in the root directory) looks as follows:
...
$code="<script type='text/javascript' src='/embed/swfobject.js'></script>";
$code.="<div id='preview' style='z-index:1'>This div will be replaced</div>";
$code.="<script type='text/javascript'>";
$code.="var s1 = new SWFObject('/embed/player.swf','ply','$playerwidth','".$playerheight."','9','#00000');";
$code.="s1.addParam('allowfullscreen','true');";
$code.="s1.addParam('allowscriptaccess','always');";
$code.="s1.addParam('wmode','opaque');";
$code.="s1.addParam('flashvars',\"".
"file=$filename".
"&streamer=../xmoov.php".
"&start=0".
"&type=http".
"&autostart=true".
"\");";
$code.="s1.write('preview');";
$code.="</script>";
...
$filename contents the name of the FLV file (e.g. video.flv) and has to be without any path information (because xmoov.php expect it in this way).
With the old 4.5 player the code sequence above worked absolutely fine, but the new version shows a 'Video xxx not found' message instead. Have tried to add path information to the file flashvar, but the result was the same, file couldn't be found.
The behaviour of old and new player is obviously different in this point and I can't find the reason for this. Has anyone got a good idea?
N.B.: When I use the player without HTTP streaming, it works. But switching off streaming permanently would be a really bad solution.
Oct. 26, 2009Zachary Ozer
We've opened a ticket to investigate the issue with Xmoov:
http://developer.longtailvideo.com/trac/ticket/589
Nov. 02, 2009Hermy
Thanks for all your efforts, guys. After ticket 589 was closed I've downloaded the fixed version and gave it another try.
The good thing: now the .ZIP file contents again the right swfobject.js, but the odd: the new player.swf still doesn't find my video files.
When I replace the player.swf version 4.6 with its predecessor 4.5 without altering anything else everything works fine.
For me it looks a lot that you can't have pseudo streaming via xmoov-php and player 4.6 together. Still there seems to be a bug.
Nov. 02, 2009hobbs
Pseudostreaming using a serverside script works fine with all player versions, including v4.6.
Post a link to your Test Page so someone can help you further. We can't guess.
Nov. 04, 2009Hermy
Thanks, but guessing won't be necessary. Here I've created a test scenario for you:
http://www.test.pix-online.com/video.php
As you see, both players react differently! Here is the PHP coding for both players:
//Player 1
$code.="<div style='margin:20px'>FLV Player 4.5:<br><div style='z-index:1;border:0px;width:384px;height:308px'>";
$code.="<script type='text/javascript' src='/embed/swfobject.js'></script>";
$code.="<div id='preview1'>This div will be replaced</div>";
$code.="<script type='text/javascript'>";
$code.="var s1 = new SWFObject('/embed/player_old.swf','ply','384','308','9','#00000');";
$code.="s1.addParam('allowfullscreen','true');";
$code.="s1.addParam('allowscriptaccess','always');";
$code.="s1.addParam('wmode','opaque');";
$code.="s1.addParam('flashvars',\"".
"file=test.flv".
"&streamer=../xmoov.php".
"&http.startparam=start".
"&start=0".
"&type=http".
"&displayclick=none".
"&smoothing=true".
"&bufferlength=2".
"&autostart=false".
"&controlbar=bottom".
"&stretching=fill".
"\");";
$code.="s1.write('preview1');";
$code.="</script>";
$code.="</div></div>";
//Player 2
$code.="<div style='margin:20px'>FLV Player 4.6:<br><div class='x_body' style='z-index:1;border:0px;width:384px;height:308px'>";
$code.="<script type='text/javascript' src='/embed/swfobject.js'></script>";
$code.="<div id='preview2'>This div will be replaced</div>";
$code.="<script type='text/javascript'>";
$code.="var s2 = new SWFObject('/embed/player.swf','ply','384','308','9','#00000');";
$code.="s2.addParam('allowfullscreen','true');";
$code.="s2.addParam('allowscriptaccess','always');";
$code.="s2.addParam('wmode','opaque');";
$code.="s2.addParam('flashvars',\"".
"file=test.flv".
"&streamer=../xmoov.php".
"&http.startparam=start".
"&start=0".
"&type=http".
"&displayclick=none".
"&smoothing=true".
"&bufferlength=2".
"&autostart=false".
"&controlbar=bottom".
"&stretching=fill".
"\");";
$code.="s2.write('preview2');";
$code.="</script>";
$code.="</div></div>";
Nov. 04, 2009hobbs
This should be ONCE in the head element of your HTML document.
$code.="<script src=\"/embed/swfobject.js\"></script>";
This should be placed where you want Player 1 to appear:
$code.="<div style=\"margin:20px\">FLV Player 4.5:<br></div>\n";
$code.="<div id=\"preview1\" style=\"z-index:1;border:0px;width:384px;height:308px\"><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>\n\n";
This should be placed where you want Player 2 to appear:
$code.="<div style=\"margin:20px\">FLV Player 4.6:<br></div>\n";
$code.="<div id=\"preview2\" style=\"z-index:1;border:0px;width:384px;height:308px\"><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>\n\n";
Your JavaScript code can go anywhere after the "container" division elements. Each player needs a unique name/id for the object element that is generated by SWFObject:
$code.="<script type=\"text/javascript\">";
$code.="var s1 = new SWFObject('/embed/player_old.swf', 'ply1', '384', '308', '9.0.124', '#000000');";
$code.="s1.addParam('allowfullscreen', 'true');";
$code.="s1.addParam('allowscriptaccess', 'always');";
$code.="s1.addParam('wmode', 'opaque');";
$code.="s1.addVariable('file', 'test.flv');";
$code.="s1.addVariable('streamer', 'http://www.test.pix-online.com/xmoov.php');";
$code.="//s1.addVariable('http.startparam', 'start');"; // v4.6 player only
$code.="s1.addVariable('start', '0')";
$code.="//s1.addVariable('type', 'http');"; // v4.6 player only
$code.="s1.addVariable('displayclick', 'none');";
$code.="s1.addVariable('smoothing', 'true');";
$code.="s1.addVariable('bufferlength', '2');";
$code.="s1.addVariable('autostart', 'false');";
$code.="s1.addVariable('controlbar', 'bottom');";
$code.="s1.addVariable('stretching', 'fill');";
$code.="s1.write('preview1');";
$code.="var s1 = new SWFObject('/embed/player.swf', 'ply2', '384', '308', '9.0.124', '#000000');";
$code.="s1.addParam('allowfullscreen', 'true');";
$code.="s1.addParam('allowscriptaccess', 'always');";
$code.="s1.addParam('wmode', 'opaque');";
$code.="s1.addVariable('file', 'test.flv');";
$code.="s1.addVariable('streamer', 'http://www.test.pix-online.com/xmoov.php');";
$code.="s1.addVariable('http.startparam', 'start');";
$code.="s1.addVariable('start', '0')";
$code.="s1.addVariable('type', 'http');";
$code.="s1.addVariable('displayclick', 'none');";
$code.="s1.addVariable('smoothing', 'true');";
$code.="s1.addVariable('bufferlength', '2');";
$code.="s1.addVariable('autostart', 'false');";
$code.="s1.addVariable('controlbar', 'bottom');";
$code.="s1.addVariable('stretching', 'fill');";
$code.="s1.write('preview2');";
$code.="</script>";
Also, you need to fix your xmoov script. The v4.6 player doesn't send the start parameter on the first request, so it fails.
On approximately line 77 of xmoov.php, you need to change the line in bold.
// PROCESS VARIABLES
// get seek position
//...JW FLV Player doesn't send the start parameter on the first request
$seekPos = isset($_GET[XMOOV_GET_POSITION]) ? intval($_GET[XMOOV_GET_POSITION]) : 0;
// get file name
$fileName = htmlspecialchars($_GET[XMOOV_GET_FILE]);
You can see your updated code functioning correctly here: http://willswonders.myip.org:8074/Hermy.php
Nov. 04, 2009Hermy
Hi hobbs,
thanks for all your efforts. Have changed my files as you told me.
What shall I say? First it doesn't work! Why? Maybe I have downloaded another xmoov.php version. In mine there's an IF-statement before the PROCESS VARIABLES section:
if(isset($_GET[XMOOV_GET_FILE]) && isset($_GET[XMOOV_GET_POSITION]))
{...}
Because $_GET[XMOOV_GET_POSITION] isn't set by the first call since FLV Player 4.6 the following process variables aren't set anymore. After I've changed the statement to
if(isset($_GET[XMOOV_GET_FILE]))
{...}
the new player runs, too.
Hope this all helps other users with similar troubles.
Thanks again for the quick substitution.
Nov. 04, 2009hobbs
You're welcome, glad to hear that you got your player working.
You can find the complete, updated xmoov script here: http://www.longtailvideo.com/support/forum/Setup-Problems/20112/Help-with-Xmoov#msg134309
Good Luck!
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.