[ 3 posts ]

Sridhar

  • Username: sridharc
  • Joined: Fri Feb 05, 2010 2:49 pm
  • Posts: 6
  • Offline
  • Profile
Tags:

Prevent autoplay and looping with SWF utility

Post Posted: Wed Oct 12, 2011 2:58 pm
+0-
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")

Sridhar

  • Username: sridharc
  • Joined: Fri Feb 05, 2010 2:49 pm
  • Posts: 6
  • Offline
  • Profile

Re: Prevent autoplay and looping with SWF utility

Post Posted: Fri Oct 14, 2011 7:10 am
+0-
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'>"));
}

Sridhar

  • Username: sridharc
  • Joined: Fri Feb 05, 2010 2:49 pm
  • Posts: 6
  • Offline
  • Profile

Re: Prevent autoplay and looping with SWF utility

Post Posted: Thu Apr 19, 2012 9:01 am
+0-
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.
  [ 3 posts ]
Display posts from previous:  Sort by  
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