| Page 1 of 1 | [ 3 posts ] |
|
I would like to play an audio using the SWF utility only after an user action is performed. But unfortunately, I am not able to set the "play" and "loop" attributes / parameters to false on creating a new SWF instance. The result is that the audio plays as soon as the page is loaded and keeps playing in a loop. I don't want this to happen. It needs to be played after a user action and must not loop. Anyone run into a similar issue and know how to address it.
To play the audio after an user action, I use: SWF.callSWF("Play") |
|
OK, I solved it, but it is kind of a hack due to the SWF limitation.
this._flashPlayer = new this.Y.SWF(flashContainer, this.data.attrs.receive_sound_flash_path, {fixedAttributes: {allowScriptAccess:"always"}}); //YUI's SWF does not provide the ability to set the 'play' and 'loop' params. //that's why we do the following, without which the audio will play as soon as //the page loads and continues to loop var nodes = flashContainer.getElementsByTagName('object'); if(nodes) { nodes.appendChild(this.Y.Node.create("<param name='play' value='false'>")); nodes.appendChild(this.Y.Node.create("<param name='loop' value='false'>")); } |
|
Ok, the work around above works in most browsers and versions except for IE 7.0. Surprised this defect hasn't been noticed and fixed yet.
|
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group