scottschiller / SoundManager2

A JavaScript Sound API supporting MP3, MPEG4 and HTML5 audio + RTMP, providing reliable cross-browser/platform audio control in as little as 12 KB. BSD licensed.
http://www.schillmania.com/projects/soundmanager2/
Other
4.99k stars 768 forks source link

Doesn't handle duplicate play links well #215

Open ann-brown opened 6 years ago

ann-brown commented 6 years ago

When hitting the play button for an audio link that is repeated in a page, whichever one was hit first seems to take precedence over the other and stop the other from being a viable input. I'd expect something more like both activating, and both remaining usable.

scottschiller commented 6 years ago

Apologies for super-late follow-up, here. The assumption is URLs are always the same and so clicking a link with the identical href will cause a current playing sound to toggle, etc.

It's a bit of a hack, but you could make the URLs unique by appending a hash fragment eg., #1, #2 etc., and thus the URLs wouldn't be the same. Query params could also work, e.g., ?offset=1 or similar. However, the browser would download the asset twice in that case.

ann-brown commented 6 years ago

The second is how I handled it for now - media is often embedded in a location where the hash fragment in the URL might already be used for an anchor.