One quick answer to your question, and another that I will follow up on when I get a few minutes.
Animate uses the HTML5 audio API to control audio elements, so you can only use methods and properties that are specified for audio elements in HTML5 browsers.
To "stop" audio, you need to pause it and then set its currentTime property to 0, like so:
sym.$("your_audio_element").currentTime = 0;
The next time you play this audio element, it will play back from the beginning.
The other part of your question (stopping other playing audio when another symbol audio starts playing) can be done by getting all instances of the audio tag in jQuery and then pausing all audio. I don't have the exact syntax for that at hand as I reply, but I'll respond back with it soon.
You can control audio at the tag level using jQuery - this allows you to issue a single command that affects all audio elements in the composition.
So if you want to "stop" all audio from playing and then play the one in your symbol, you could do it this way:
// these commands affect ALL audio elements in the composition
// this applies only to the audio element you want to play
Thank you so much for this. I just tested and it does exactly what I was looking for. Again, thank you for you quick and effective response.
I have similar question up.
The issue is that I am unable to stop the other audio from playing.
Even using the $("audio").trigger("pause");
Does not seem to work.
Could you please have a look at the example codes in the question, and assist if you can please.