Read the last EDIT, please.
I have a page in which I should display some media data. For this I'm using html tag, like this:
<object type="video/x-ms-wmv" width="320" height="240">
<param name="src" value="some_media_url" />
<param name="AutoSize" value="true">
<param name="ShowDisplay" value="false">
<param name="AutoStart" value="false">
<param name="StretchToFit" value="true">
<param name="bgcolor" value="#ffffff" />
</object>
In my case, I should get media data from SQL server by some MediaHandler.ashx http handler.
When I get an audio(.mp3, .wma) or video(.flv, .mp4) stream this works fine.
But I'm getting some problems with .swf flash files.
For this type of files I change <object> type
to be "application/x-shockwave-flash". In this case when I use some remote path, like http://www.tizag.com/pics/example.swf, it works fine:
<object type="application/x-shockwave-flash" width="320" height="240">
<param name="src" value='http://www.tizag.com/pics/example.swf' />
<param name="AutoSize" value="true">
<param name="ShowDisplay" value="false">
<param name="AutoStart" value="false">
<param name="StretchToFit" value="true">
</object>
But, it doesn't work with my handler. It neither works with local paths,like "c:\videos\example.swf"
Any idea?
EDIT: Actually src for media looks like this:
<object type="video/x-ms-wmv" width="320" height="240">
<param name="src" value="http://localhost:11111/MediaHandler.ashx?Id=1111" />
<param name="AutoSize" value="true">
<param name="ShowDisplay" value="false">
<param name="AutoStart" value="false">
<param name="StretchToFit" value="true">
<param name="bgcolor" value="#ffffff" />
</object>
EDIT:
This works fine, if I directly refer to an existing file:
<object type="application/x-shockwave-flash" width="320" height="240">
<param name="src" value="/videos/ETFflash1016.swf" />
<param name="AutoSize" value="true">
<param name="ShowDisplay" value="false">
<param name="AutoStart" value="true">
<param name="StretchToFit" value="true">
</object>
But when I use httpHandler to get file from DB:
<object type="application/x-shockwave-flash" width="320" height="240">
<param name="src" value="http://localhost:57031/MediaHandler.ashx?Id=512429" />
<param name="AutoSize" value="true">
<param name="ShowDisplay" value="false">
<param name="AutoStart" value="true">
<param name="StretchToFit" value="true">
</object>
flash is not displayed.
I've compared the output html for these cases, they're the same in both cases (except src param value). Fiddler shows the same result for both requests for .swf file and the browser shows(e.g. in IE dev tool's Netwok tab) that the file was downloaded to client in both cases. BUT in the case with the handler, flash is not being displayed.
try this:
it worked for me
In Fiddler, Response Headers, do both the local file and ASHX handler return the same
Content-Type: application/x-shockwave-flash
?I've solved it!
In the handler, I was setting Response Header's parameters the same values as they were in the case with directly referring to an existing file.
Now, I just removed all this values, and it works! I still can't understand why, but it works :)