View Full Version : Getting around the Firefox wmv streaming problem

01-15-2008, 12:35 PM
This code seems to work just fine when I view the page in IE. But when I view it in Firefox, the embedded WMP just says "Ready" and the play button does nothing.

<object ID='NSPlay' WIDTH=400 HEIGHT=300 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'>
<PARAM NAME='FileName' VALUE='video_play_2416.wmv'>
<PARAM NAME='ShowControls' VALUE='1'>
<PARAM NAME='ShowDisplay' VALUE='0'>
<PARAM NAME='ShowStatusBar' VALUE='1'>
<PARAM NAME='AutoSize' VALUE='0'>
<PARAM NAME='AutoStart' VALUE='1'>
<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' src='video_play_2416.wmv' Name=NSPlay ShowControls=1 ShowDisplay=0 ShowStatusBar=1 AutoStart=1 width=400 height=340></embed>

video_play_2416.wmv converts to video_get.php?id=2416 in my .htaccess. Here is the basic code for the video_get.php:

header("Content-Type: video/x-ms-wmv");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize("video_$id.wmv"));
header("Content-Disposition: attachment; filename=\"video_$id.wmv\"");

I Google'd around and all I have found is that other people seem to be having the same problem. Does anyone have a way to make it work for Firefox?

01-15-2008, 12:53 PM
Try type="application/wmplayer" in your embed tag ... I'm not promising anything but that might work!

Also, I you need to correct plugin installed in FF (but I'm sure you know that!).

01-15-2008, 07:53 PM
I forgot to mention. With that html embed code, it works fine in Firefox if I link it directly to the wmv. Just not when it goes through the script. But it works fine in IE both ways.

01-16-2008, 11:47 AM
Ok, I did a little rummage myself on Google because this is of interest to me too!

Here's something I found (http://forums.techguy.org/web-design-development/425529-embedded-wmv-video-not-working.html) (Check out Shadow2531's code and explanation) - it seems it is dependent upon specifying the correct content type, which makes sense! (Incidentally, I notice you have conflicting content types when using the script and the XHTML).

I haven't tried his solution, but upon reading his explanation I can see why your code doesn't work in FF :)

01-16-2008, 07:41 PM
I did what it said on that site and it still doesn't seem to be working. Like I said, it plays fine when I input a wmv url directly, just not when I do it through the script.

01-17-2008, 11:04 AM
Just a thought ... but might it be easier to do something in your php file like this:

$videofile = "video_$id.wmv";

if (file_exists($videofile)) print($videofile);
else <whatever>;

I got that to work just fine in conjunction with the method I posted earlier (as you might expect) and works fine in both browsers with your code too.