From SoundManager2's Revision History:
Flash Player 11.6.602.171, released by Adobe on 02/26/2013, introduced an issue with SM2's default Flash 8 (flashVersion: 8) API-based JS/Flash interaction, where SM2 methods called from callbacks such as
onfinish()
would not work. This primarily broke methods used for playing sounds in sequence, serially loading a series of sounds and so on. (See discussion for more.)Note that this does not affect cases where
soundManager.setup({ flashVersion: 9})
is being used; however, SM2 does useflashVersion: 8
by default.Specifically, Flash-initiated events (such as a sound finishing) make Flash -> JS calls to the SM2 API, which subsequently call user-specified event handlers. If the user-specified SM2
onfinish()
handler immediately calls a SM2 method like play() that makes a JS -> Flash call, this call either silently fails or is blocked. Other JS + Flash libraries that use similar callback patterns may also be affected, if their SWF is built targeting the Flash 8 API.Suspecting a timing or recursion/stack issue, it was found that introducing a
setTimeout(callback, 0)
to user-specified SM2 callbacks likeonfinish()
restored sequential/playlist functionality.Flash Player 11.6.602.180, relased by Adobe on 3/12/2013, exhibits the same behaviour. To avoid additional hacks, SM2 applies this to all Flash 8-based API callbacks regardless of what version of Flash Player is installed. No regressions are anticipated as a result of this change.
Alternately, this issue can be avoided by using
soundManager.setup({ flashVersion: 9 })
as the Flash 9-based API does not appear to have this problem.