Internet Explorer won't load Flash that's requested with AJAX
I have a piece of jQuery that requests a file (using .load() method) with some HTML and an embedded Flash video player. IE7 doesn't seem to load the Flash video player, but it does load all the HTML and applies proper CSS to the elements. It works at least on FF3.6.6. I've tried both static embedding [1] and SWFObject [2]. I've also tried several different Flash video players and neither works. Both of the flash players load just fine if I don't request them with AJAX.
Now is this is even possible? Are there any tricks to make this work? Or do I have to implement another way for IE?
[1]:
<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
<param name="movie" value="player.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=video.flv&image=preview.jpg" />
<embed
type="application/x-shockwave-flash"
id="player2"
name="player2"
src="player.swf"
width="400"
height="315"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=video.flv&image=preview.jpg"
/>
</object>
[2]:
<p id="preview">The player will show in this paragraph</p>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript"&g开发者_运维技巧t;
var s1 = new SWFObject('player.swf','player','400','300','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=video.flv');
s1.write('preview');
</script>
Edit: the SWFObject lib seems to be old, I'll try with a newer version...
Ah, that did it. I was using an old version of SWFObject. Updating to the latest fixed it.
Anyway, if anyone has an answer to why the static version won't work (or how to make it to work), but the dynamic does, I'll select your answer as the correct one.
精彩评论