[SWFObject] SWFObject-Loaded Flash not working with autoplay MP3

Jay Jennings jay at jayjennings.com
Mon May 15 17:20:20 PDT 2006


I have a problem that only shows up in Safari (which sucks since I’m a 
Mac guy). Here’s the code:

<div id="51sm-intro-24.mp3"></div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("smplayers/b_smword21.swf", "sotester", "76", 
"23", "6.0.65", "#FFFFFF");
so.addVariable("src", "mp3files/51sm-intro-24.mp3");
so.addVariable("ap", "1");
so.write("51sm-intro-24.mp3");
// ]]>
</script>

That loads the flash widget which then grabs the MP3 file that’s passed 
in and plays it. The problem is with the “ap” variable I’m passing – 
that tells the widget to start playing the MP3 file as soon as it’s loaded.

It works as it should in Firefox for Mac and in IE for Windows (only 
other browsers I checked) but in Safari 2.0.3 (and OS X 10.4.6) the 
auto-play doesn’t work. The Flash widget *does* get the instruction, 
because the state of it changes, but I actually get an error message in 
the Activity Window: Plug-in Cancelled, and it shows the URL to the MP3 
file.

I really want to use SWFObject but I hate to do it if I also have to 
tell people the auto-play doesn’t work with Safari.

Any tips?

Thanks.

Jay Jennings





More information about the Swfobject mailing list