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

how to set self.getSoundByURL(soundURL) unique key? #243

Open thadeu opened 5 years ago

thadeu commented 5 years ago

Problem

In my case, I have many sounds with same URL, but I would like that it was different player instance.

Today self.getSoundByURL(soundURL) get search into self.soundsByURL[soundURL] based soundURL, how to make that soundURL be unique and not side effect others player on the page?

Example:

var url = new URL(o.href)
soundURL = o.href + (url.search.length ? `&overcache=${Date.now()}` : `?overcache=${Date.now()}`)

But, when to createSound use it:

thisSound = sm.createSound({
       id: 'ui360Sound' + (self.soundCount++),
       url: removeParameter(soundURL, 'overcache'),
       ......
})