On Apr 29, 4:47 pm, Evan <e...@nthdegree-designs.com> wrote:
> On Mar 13, 3:06 pm, Paul Hutson <hutsonphu...@googlemail.com> wrote:
>
>
>
>
>
> > Hello,
>
> > I've been trying to get the following working :
>
> >http://dev.jquery.com/view/trunk/plugins/sound/
>
> > However, it only plays about a second to three seconds of the
> > designatedsoundbefore shutting off (in FF and Safari) but loads
> > fully in Opera.  The music is hosted locally at the moment.
>
> > Any ideas?
>
> > The test code I'm using is as follows :
>
> >         $.sound.play('Sounds/Music/OE1.mp3');
>
> > TIA,
> > Paul
>
> I was running in to the same problem. I had playback working fine with
> the @5750 build, but was not able to stop playback.
>
> If you look at line 84 of the @5854 build, you will see that the when
> the timeout occurs it is set to remove the entire element. I finally
> gave up, and instead of trying to stop the timeout, I just commented
> out the element.remove() line. Now audio plays fine and I can stop it
> viajquery.
>
> Here is what my lines 83 - 87 look like now:
> setTimeout(function() {
>                         //element.remove();
>                 }, options.timeout)
>
>                 return element;
>
> Hope that helps someone.
>
> Now I need to figure out how to get it to loop the audio.

Excellent find, thank you.

As a bit of repayment, do the following to loop the sound :

Change the play: function to : play: function(url, loopNumber,
options)

then change this bit of code :

var element = $.browser.msie
                        ? $('<bgsound/>').attr({
                        src: options.url,
                                loop: 1,
                                autostart: true
                      })
                        : $(this.template(options.url));

to be :

var element = $.browser.msie
                        ? $('<bgsound/>').attr({
                        src: options.url,
                                loop: loopNumber,
                                autostart: true
                      })
                        : $(this.template(options.url));

I think that should work, although I've not tested it (I'm playing
with adding in a length of track option that works).

Reply via email to