Skip to content
V2.97a.20140901 - iOS 8 compatibility fix, "Bar UI" player demo, durationchange, buffering, edge case tweaks for HTML5 and RTMP, and browser environment checks.

*Bug fixes*
Why UA sniffing is generally bad, real-world example #1048577: "That time a missing /s on navigator.userAgent (based on single-digit UA version assumptions) broke SM2 on iOS 8+ devices."

The upside: The fix is adding \s to a UA regex check targeting legacy iOS devices with broken HTML5 Audio() support, so that the "OS 10 " portion of the UA string does not match the pattern "OS 1 ".

This is a pre-emptive fix for the pending iOS 8 release, which reportedly includes the string "iPhone OS 10_10 like Mac OS X". Due to SM2 checking for /os ([12|3_0|3_1])/i which had broken HTML5 Audio() support, and not considering the far future possibility of "iOS 10" being included in the userAgent string at the time, HTML5 audio is incorrectly disabled on iOS 8 beta 3 and is likely to apply to the final iOS 8 release.

This is a good example and reminder of why UA checks are generally bad, and dangerous; similar issues hit other libraries doing UA and plugin checks both client and server-side when IE hit 10, and Flash hit version 10, so this iOS pattern change may affect some other libraries targeting iOS as well.

HTML5: Listen to durationchange event, catch-all for duration update events. May help on mobile if duration is determined late. (Related discussion.)

Explicitly provide buffering status to onbufferchange(). Don't set buffering(0) when loading, since playback may still be paused.

Flash: Fix edge case where play({ url: xxx, position: 0 }); on existing sound with assigned URL. New URL wouldn't take effect.

*API Updates*
SMSound onwarning and onfailure options for NetStream / RTMP error/exception handling. Removed additional sound param on onfailure() callback. Apologies if this breaks anyone's implementation (disclaimer: these options are still experimental, and undocumented. :D) "Unhandled" exceptions are now considered non-fatal, using onwarning instead of presuming playback has failed etc.

*Miscellaneous*
"Bar UI" player demo added. SVG-based iconography, degrades nicely down to IE 8. See live demo.

Retina/hi-dpi updates for 360° canvas, small 360° player buttons and basic button player demo image assets.

CommonJS + AMD (requireJS) module.exports / define() compatibility (see commit for details.)

Check window && window.document, barf if loaded in server-side node environment vs. in a browser. (Even if Node.js etc. support Audio() at some point, SM2 was designed for a browser; this check is probably A Good Thing™ to have in place.) If you feel you have a use case that makes sense here, feedback is appreciated.