# SoundManager 2: Download

## Get SoundManager 2

Get the latest and greatest.

### Download SoundManager 2

Latest changes: Simplified `onready()` behaviour (see potential `onready()` regression note), new `ontimeout()` handler, Webkit + MovieStar 30-second-pause fix. See revision history for details.

Download SoundManager 2.97a.20110101

Also on Github (dev branches, forks etc.): http://github.com/scottschiller/SoundManager2 - Related: A year of commits (Gource visualization)

Performance tip: SM2's code size varies from 90 KB (debug) down to 10 KB (optimized) over HTTP; check the pre-optimized builds for details.

Side reading: "Probably, Maybe, No": The State of HTML5 Audio, an article written for 24ways.org touching on some of the current issues and future promise of audio in HTML.

## Revision History

Latest changes and archived notes from bug fixes, API updates, feature development etc.

### Revision History

A changelog of sorts.

- ### V2.97a.20110101 - Simplified `onready()` behaviour (see potential `onready()` regression note), new `ontimeout()` handler, Webkit + MovieStar 30-second-pause fix

  `onready()` is now called only for SM2 init success (makes default case easier, no need for "supported" check) - new `ontimeout()` is called only for failure case, ie., flash blocked/missing. Special Webkit/MovieStar won't-resume-after-30-seconds-paused fix. `soundManager.supported()` renamed to `soundManager.ok()` (old method aliased for the time being.)

  - Bug fixes

    - Special bad case, Webkit/Flash+MovieStar (AAC/MPEG4/RTMP-only, not MP3): sounds don't resume after being paused for 30+ seconds(?), but `setPosition()` with current position gets things going again after a `resume()` attempt. Reported via 8tracks dudes.

  - API Updates

    - In previous releases, the soundManager.onready() queue would be processed for both OK and failure cases. The `onready()` queue is now processed only if successful initialisation occurs, making old "supported" checks within the `onready()` handlers redundant.

      Potential regression note: Old error case handling within `onready()` will never execute as a result of this change. Update your code to use the new explicit soundManager.ontimeout() handler instead.

      Old `onready()` method

          soundManager.onready(function(){
            if (soundManager.supported()) {
              // OK, play sound etc.
            } else {
              // SM2 could not start; message user?
            }
          });

      New `onready()` / `ontimeout()` method

          soundManager.onready(function(){
            // OK, play sound etc.
          });

          soundManager.ontimeout(function(){
            // SM2 could not start; message user?
          });

    - New soundManager.ontimeout(myFunction) method, for asynchronous queueing of init failure handlers. Fired only when SoundManager 2 is unable to initialise (usually due to blocked/missing flash, or flash security error.) Queue behaviour is the same style as `onready()`.

  - Miscellaneous

    - Code cleanup: Took the unsupported "jsAMP" demo (2007 prototype) out back and shot it.
    - 360° UI demo: New "allowMultiple" config option, let 2+ sounds play at once etc. (Default: false, one at a time.)
    - 360° UI, canvas visualization demo: Minor layout, UI, code tweaks
    - API/docs/demos reference and use updated onready()/ontimeout() methods.

- ### V2.97a.20101221 - HTML5 loading/progress and RTMP tweaks, `onready()` double-firing fix, `hasPriority` for mobile flash, Muxtape-style player now AJAX-friendly (Download archived version)

  Improved HTML5 `whileloading()` / `whileplaying()`, `unload` and event handling. `hasPriority` for off-screen SWF loading on mobile, replaces old mobileFlash positioning tricks. Effectively re-wrote page player (Muxtape-style) demo to use event delegation + read live DOM, so should not break in AJAX cases. RTMP `onplay()` / `play()` / `buffering` fixes, `setPosition()` regression fix.

  - Bug fixes

    - Double `onready()`-firing bug (HTML5 and non-flashblock case) fixed.
    - HTML5: Don't request null/about:blank URL with `unload()`, may hang/JS error in Chrome and IE 9 preview 7.
    - RTMP: Ensure `onplay()` is called for auto-loading streams when resumed. Don't call `play()` until connected. `play()` sets flash pauseOnBufferFull = false (fix for reported "RTMP not playing audio" issue.)
    - overHTTP was likely returning incorrect values previously - now fixed.
    - `unload()` tweak: Ensure `position` is reset to 0 if `unload()` fails
    - Flash audio: Log metaDataHandler info if debug enabled, possible `duration` metaData fix
    - No HTML5 audio for any Safari on OS X Snow Leopard 10.6.[3|4|5] due to underlying bugs causing intermittent audio playback failure; ongoing Apple issue, on their radar. Amusingly, Safari on Windows appears to be fine.

  - API Updates

    - Revised HTML5 `Audio()` events, improved `whileloading()` / `whileplaying()` / `onload()` for Webkit and Firefox 4. Progress/onload are still a bit quirky as HTML5 audio is more about "non-linear" loading including range and partial requests, where supported. See related discussion.
    - New `soundManager.ok()` method, nicer alias for `soundManager.supported()`.
    - Took `soundmanager.loadFromXML()` (SM1 legacy method) out back and shot it. Last tweak was in 2008, nobody uses it.

  - Miscellaneous

    - Flash `<object>` / `<embed>`: hasPriority attribute, enables off-screen SWF loading with Flash 10.1+. Removed mobileFlash positioning/repositioning tricks in lieu of this.
    - Effectively re-wrote page-player (Muxtape-style) demo, now traverses live DOM for next item(s). Should be more AJAX-friendly. Event delegation now handles any links added at any time. Externalised experimental features, too.
    - HTML5: If URL lacks `type` attribute and extension such as `.mp3` (worst-case scenario, you shouldn't be doing this anyway) just try dumbly loading it - imitating Flash behaviour.
    - Improved `dataerror` (wave/spectrum) exception handling, should result in lowered CPU use if playback continues with access exceptions (eg. YouTube video going in another tab.)
    - Start-up debug output/messaging clean-up (no movieStar in flash 8, minimal output in HTML5-only mode, etc.)
    - Add window unload handler if Flash being used, so back button will cause a page refresh (vs. the browser showing "previous state") to reinstate Flash in good browsers. Previously, the "previous state" was be shown but Flash audio would be broken.
    - ipod (ipod touch) gets HTML5 now, too.
    - Microsoft have added `Audio()` to Internet Explorer 9 as of "Platform Preview 7" - previous pre-releases of IE 9 only implemented `<audio>`, which SM2 does not use.

- ### V2.97a.20101010 - Code cleanup, HTML5 audio tweaks, merged RTMP fork, removal of experimental video, optional usePolicyFile crossdomain.xml feature (Download archived version)

  Shuffling of SoundManager 2 core, approximately 5% shaved off full debug-enabled file size after bug fixes, additional comments, new features and so on. Internal event handling code cleaned up. .SWF builds optimized, Flash 9 non-debug version now under 10 KB. Debug version now flash debugger-enabled. Merged GitHub user kjvarga's RTMP fork including improvements for Red5 + Flash Media Server streaming cases - buffering, event and state handling. Experimental video feature is toast, createVideo() no longer implemented. iPhone + iPad touch events on page player + 360° player UI demos; tap and drag to seek, etc.

  - Bug fixes

    - No HTML5 audio for *any* Safari on OS X Snow Leopard 10.6.[3|4] due to underlying bugs causing intermittent audio playback failure; ongoing Apple issue, on their radar. (See related GitHub commit)
    - Don't `unload()` at `onfinish()` for HTML5 audio (was originally done to be conservative, but results in additional HTTP requests despite caching expectations?)
    - `onload()` for HTML5 now using proper boolean values
    - Fix NetStream-specific `autoLoad`/`autoPlay`/`volume` `createSound()` call, specific null flash sound object error scenario. (Related changes on GitHub.)
    - Fix for "`onbufferchange(1)` followed immediately by `onbufferchange(0)`" case when audio was actually still buffering.
    - Removed `setPosition()` within `unload()`, cleaner exit when destroying a sound

  - Merged: RTMP Fork

    - Merged GitHub user kjvarga's RTMP fork of SoundManager 2, including buffering, event and state handling fixes and improvements. For more RTMP documentation/features, see the readme on GitHub, or view locally.

  - API Updates

    - Removed experimental video feature (originally added late 2008, never developed further.) `createVideo()`, `allowFullScreen` and related video methods are now gone. Other dedicated HTML5/flash video player projects have since solved this problem.
    - New SMSound option: usePolicyFile - (boolean, default: `false`) - enables Flash to request /crossdomain.xml file for content on third-party domains, if access to ID3/metadata such as wave/peak/spectrum is needed. Will automagically enable if `onid3()` or peak/wave/spectrum features are being used.
    - `console.warn()`-style messaging (instead of throwing exceptions) if `createSound()` etc. are called before SM2 init has fired. Now calls similar warning and exits if called after a failed, unsuccessful startup (ie., timeout or not-supported case.)

  - Miscellaneous

    - SoundManager 2 core code cleanup, ~5% shaved off soundmanager2.js code size after new features, bug fixes and comments etc. Internal event handling (DOM-related events for init, IE 6 vs. everybody else) improved.
    - Flash builds optimized; Flash 9 SWF build now under 10 KB. Debug-enabled Flash 9 SWF now hooks into Flash debug player/IDE debugging tools (compiled with `-debug=true`)
    - Attempt to detect RTL documents, position Flash accordingly if so to avoid long horizontal scrollbar issue (related discussion)
    - iPhone + iPad `touchmove()` and related events added to page player + 360° player UI demos; tap and drag to seek should now work.

- ### V2.96a.20100822 - HTML5 audio support no longer alpha, Safari 5.0.1/SL HTML5 audio issues continue, iPad/iPhone "play through", Flash tweak for Android (Download archived version)

  `useHTML5Audio` feature now considered beta-worthy, though disabled by default to be safe (with the exception of iPhone + iPad.) iPhone/iPad will now play a sequence of sounds, user interaction only required to start first one. Flash on-screen positioning tweak for Android devices that run Flash. Safari 5.0.1 on Snow Leopard exhibits same buggy HTML5 audio issue, disabled by default; Apple have been notified. IE 9 "Platform Preview 4" has `<audio>` but no `Audio()` support (yet?) See bug #586311 (may require connect.microsoft.com / Windows Live ID, login first etc.)

  - Bug fixes

    - HTML5 `Audio()` still broken in Safari 5.0.1 on Snow Leopard (10.6.3, 10.6.4), where sounds intermittently fail to load and play. Apple are aware of the regression. Related bug: #32519. Include `sm2-ignorebadua` in URL on SM2 pages to ignore this check and verify broken behaviour, etc.
    - Tweaks for experimental RTMP feature re: handling of paused state, tracking of position and `onfinish()` firing early.
    - Bumped SWF z-index to 5000 for Safari 5, SoundCloud-reported bug-and-fix for Safari 5-specific bad redraw issues, and occasional crash case referencing WebCore::RenderLayer::paintLayer

  - API Updates

    - iPhone/iOS 4 and iPad can now play a sequence of sounds (once the user starts sound initially), provided `onfinish()` is used to create/play the next sound. Example: Muxtape-style UI on homepage will play through list without further interaction once a user plays something in the list.

  - Miscellaneous

    - Special case for getting SM2 working more reliably on HTC Android + Flash 10.1, where flash does not load until on-screen (ie., in view.) If off-screen, Flash is repositioned at left/top 0px in order to load (including scroll/resize if needed), then events released and movie is repositioned off-screen. If movie is in the DOM already eg. as in `useFlashBlock` cases, `flashLoadTimeout` is set to 0 to allow infinite wait (eg., SM2 will not timeout with an error, and will simply load when the flash is scrolled into view.)
    - Documentation: Clarified `createSound()` behaviour if an existing sound ID is given (returns sound object "as-is", ignores any options passed.)
    - Page-player demo updated to use `canPlayLink()` instead of `canPlayURL`, more flexible link/type handling.
    - Homepage and documentation UI/layout and language tweaks, a few new "as seen on the internets" icons etc.

- ### V2.96a.20100624 - Safari 5/Snow Leopard 10.6.3/10.6.4 HTML5 Audio() issue, X-domain SWF build fixes (Download archived version)

  Disabling HTML5 Audio for Safari 5 on Snow Leopard 10.6.3 + 10.6.4 (current release) only, as it is broken similar to Safari 4.x (also on Snow Leopard only.) Related bug: #32519. Also, version info in SWFs and fixed X-domain SWF build.

  - Bug fixes

    - HTML5 Audio() still broken in Safari 5 on Snow Leopard (10.6.3, 10.6.4) - disabling for now, falling back to Flash as with Safari 4.x on Snow Leopard. Include `sm2-ignorebadua` in URL to ignore this check and verify broken behaviour, etc.
    - Fixed X-domain SWF builds to actually work cross-domain.

  - Miscellaneous

    - Added version info string to SWFs in Flash right-click / context menu, helpful when troubleshooting SWFs.

- ### V2.96a.20100606 - RTMP (Flash Media Server) Support, HTML5 Updates (Download archived version)

  HTML5 update, new RTMP feature: Experimental Flash Media Server support, `onposition()` event listener, SMSound `type` option and code cleanup.

  - API Updates

    - New experimental RTMP support via kjvarga's fork at http://github.com/kjvarga/SoundManager2/ while maintaining existing NetStream-based behaviour for non-RTMP MPEG4 audio, etc. Uses new `serverURL` parameter for FMS (I used Red5 for dev/testing,) eg. `soundManager.createSound({id:'rtmpTest',serverURL:'rtmp://localhost/oflaDemo',url:'oh-alberta.mp3'}).play();`
    - New SMSound option for createSound(), load(), play(): 'type', for specifying MIME type alongside URL to help with detecting playability. eg. `soundManager.createSound({id:'foo', url:'/player.php?stream=1', type:'audio/mp3'}).play();` and so on. Hat tip: sylvinus.org
    - New SMSound event: onposition(), for attaching listeners to specific times within a sound.

  - Bug fixes

    - Flash sound unload/destroy ActionScript "could not close stream" exception/warning (finally?) fixed.
    - Sound looping updated for Flash 8, working (albeit with a quirk - requires preloading.)

  - Miscellaneous

    - Removed Base64 HTML5 Audio() tests, redundant as numerous MIME (audio/mpeg, audio/mp3 etc.) checks seem to cover it.
    - Updated MPC (drum machine) demo from 2006-era design, modernizing the CSS a bit.
    - `nullURL = 'about:blank'` tweak for unloading (flash 8.) May have finally fixed that dumb stream closing error on unload/destroy.
    - set `soundManager.didFlashBlock` *before* firing `onready()`/`onerror()` listeners

- ### V2.96a.20100520 - HTML5 Edition (Download archived version)

  Experimental HTML5 support, lots of code shuffling and performance tweaks.

  - API Updates

    - New soundManager.useHTML5Audio (disabled by default except for iPad, Palm Pre) - adds experimental HTML5 Audio support, with Flash fallback for MP3/MP4 formats as needed.
    - Sound looping now works in Flash! eg. `mySound.play({loops:3});` - for an example + discussion of how to get near-seamless looping, see Seamless Looping MP3s in Flash (demo video) on Flickr.

  - Bug fixes

    - `beginDelayedInit()` is always used in lazy loading case (eg. via dynamic script tag/XHR etc.,) as some cases where SM2 won't auto-start eg. document.readyState empty for Firefox 3.5.5 (seen on Win32) with an HTML5 DOCTYPE.
    - SWF is now 8x8 pixels by default, vs. 6x6 pixels (odd fix for HTML5 Doctype on Firefox 3.6/win32)
    - Fixed dumb IE undefined ID bug

  - Miscellaneous

    - soundmanager2.swf and soundmanager2_flash9.swf are now "non-debug" versions; with debugMode enabled, soundmanager2_debug.swf and soundmanager2_flash9_debug.swf are loaded instead.
    - New build script for JS + SWFs, see file size table. JS compression now done via Google Closure compiler; new soundmanager-jsmin.js build, debug-enabled but compressed, in addition to build-script-optimized, no-debug, compressed JS (~9 KB with gzip vs. ~90 KB for raw, commented, debug-enabled version.)
    - Null check fix for unavailable eq/waveform data
    - Experimental video (flash 9-only) change: Use stage width/height instead of 0/0 when lacking metadata
    - Page player whileloading() calls now being throttled
    - Better page player click handling for IE 7

- ### V2.95b.20100323 (Download archived version)

  `useFlashBlock`, better handling of time-out/errors (CSS-based SWF repositioning options for unblocking on time-out), "play MP3 button" demo, `canPlayLink()`, `canPlayMIME()`, `eqData` + `waveformData` for AAC/H.264 (movieStar) content, missing documentation and miscellaneous bug fixes.

  - API Updates

    - New `soundManager.useFlashBlock` (disabled by default) - enables CSS classes assigned to SWF container indicate start-up state (ok/error/blocked), allowing positioning/display of SWF for unblock cases and successful recovery from unblocking. Built into homepage + (most) demos. Updated flashblock demo as well.
    - playableClass attribute eg. `<a href="foo.php" class="inline-playable">`, allowing URLs without .mp3 to be picked up
    - New `soundManager.canPlayLink()` + `canPlayMIME()`, ability to check <a href="foo.php" type="audio/mp3"> for example

  - Bug fixes

    - `soundManager.play()` type check fix, instanceof Object vs. typeof x === 'Object' (typo)
    - `computeSpectrum()` can access waveform and eq (spectrum) data for movieStar (AAC/MP4, netstream-based) objects, too.

  - Miscellaneous

    - Moved old demo code using `$()` to `_id()`, `_$` in `soundManager2` to `_id()` to avoid potential jQuery (and other $-based library) collisions
    - Make `new SoundManager('/path/to/swfs/');` actually work.
    - Flash time-out (flash blockers) vs. security failure detection/other error cases is smarter on the SM2 homepage now
    - New "MP3 player button" demo
    - Removed old IE onclick handler fix in several demos for non-MP3 links
    - `eqeqeq = true` for jslint, why not.

- ### V2.95b.20100101 (Download archived version)

  New features: Flash movie debugging in SWF via `debugFlash` (default:false), `SMSound.eqData = { left:[], right:[] }`, code tidying and debug output clean-up

  - API Updates

    - New `soundManager.debugFlash` property, enables debug messages from within flash (output to flash movie). Useful for troubleshooting start-up, security issues etc. Flash debug output example
    - `SMSound.eqData` now has left and right channels - e.g. `eqData = { left: [], right: [] }` - was previously a single array: `eqData = [];` Backwards-compatibility is maintained for now as `eqData[i]` still works with the new structure.

    Bug fixes

    - `stream = true` is no longer automatically set when `SMSound.play()` is called and `readyState == 0`, as it was breaking the `stream:false` case where playback should not start until the sound has fully-loaded.
    - `soundManager.reboot()` forces recreation of object/embed rather than old method of node remove/re-append (in case other options changed, eg. debugFlash was false, but assigned to true after an error during start-up.)

    Miscellaneous

    - Review of all SM2 debug output, more concise and informative messaging - especially around start-up troubleshooting/error debugging, security sandbox errors, SWF 404 case etc.
    - Code formatting clean-up (via jsbeautifier.org) soundmanager2.js tested and passes JSLint, Edition 2009-11-22 + options: /*jslint undef: true, bitwise: true, newcap: true, immed: true */
    - Better organization/use of strings for debug output
    - New canvas-based favicon VU meter demo for home page, 360 player and muxtape-style player demos where supported (Firefox and Opera, currently.) Firefox 3.6 is disappearing support for XBM images, which were previously used.

- ### V2.95a.20090717 (Download archived version)

  New features: onready(), fast polling, flash blocking demos etc.

  - API Updates

    - New `soundManager.onready(myFunction[,scope])` method, for asynchronous queueing of `onload()`-style handlers. Fires when SM2 has finished initialising. Accepts an optional scope parameter to apply to handler; if none given, window object is used. A "status" object is passed to your handler (can be ignored) which includes a `success` boolean indicating whether SM2 loaded OK or not. Handlers added via onready() after successful initialisation will fire immediately.
    - New `soundManager.oninitmovie()` event callback, single assignment similar to `onload()`. Fires when the flash movie has first been written to (or read from) the DOM. Used internally for a flashblock-handler-related example, custom timeout condition.
    - New `soundManager.useFastPolling` property (false by default), enables 1 msec Flash 9+ timer for highest-possible `whileplaying()` and related JS callback frequency (default is 20 msec.) Use with `soundManager.useHighPerformance = true` for best performance, frame rates while updating the UI via whileplaying() etc.
    - New sound option (soundManager.defaultOptions): `multiShotEvents` (default:false) - enable support for multiShot-style events (currently `onfinish()` only). Eg. When `mySound.play()` is called three times, `onfinish()` will subsequently fire three times.

  - Bug fixes

    - `createSound` now writes a warning to debug output if the sound ID is a number, or is a string starting with a numeric character. Because SMSound objects are stored in `soundManager.sounds[]`, while not syntactically invalid, numeric IDs will be treated as array indices and are likely to break things.

  - Miscellaneous

    - New flashblock / "click to flash" demo, example of handling blocked conditions and graceful recovery when flash is initially blocked until user chooses to allow it.
    - Cross-domain-scripting enabled SWF (using `allowDomain("*")`) included in swf/ directory (in its own .zip file.) Use when you must have domain A loading SM2 .SWF from domain B, or for testing etc and can't compile your own custom x-domain SWF from source.
    - Documentation, layout and menu tweaks

- ### V2.95a.20090501 (Download archived version)

  Lots of updates.

  - API Updates

    - Added `soundManager.allowFullVideo` for full-screen video playback, triggered by double-clicking. Also, related `soundManager.onfullscreenchange` event handler.
    - Updated `waveformData` to include stereo channels. Now an object literal instead of a single array. New format: `SMSound.waveformData = { left: [], right: [] }`
    - New `SMSound.ondataerror()` (flash 9+) handler for cases where waveform/eq data is inaccessible due to other flash movies in the current browser which have loaded sound. (Flash must have security permissions to "read" all data currently being output, long story short. Having a YouTube tab open can cause this, for example.)
    - New `isBuffering` property for MovieStar (MP4 audio/video) content, related `onbufferchange()` event handler (sound object)
    - New `bufferTime` property for MovieStream content. Defines seconds of data to buffer before playback begins (null = flash default of 0.1 seconds; if AAC playback is gappy, try up to 3 seconds.)

  - Bug fixes

    - Off-screen flash with `wmode` set to non-default value (transparent/opaque) will break SM2 for non-IE on Windows, time-out error style. SM2 will now revert wmode to default for this case (losing transparency/layering of movie) - or set `soundManager.flashLoadTimeout` to 0 and SM2 will retain wmode, but must now wait potentially infinitely for flash to load (until user scrolls it into view.) `soundManager.specialWmodeCase` reflects if this fix has been applied after init time.
    - Calling `soundObject.load()` after directly assigning a value to `soundObject.url` should now work as expected.

  - Miscellaneous

    - Shiny new "360° UI" canvas + visualization demos (Warning: Beta-ish code.)
    - Experimental SM2 exception/error handling + stack trace reporting added, an attempt to make custom errors thrown from SM2 more meaningful (ideally showing the user's call to SM2 where things went wrong in the stack.)
    - Calling `soundObject.load()` after directly assigning a value to `soundObject.url` should now work as expected.
    - `soundManager.useHighPerformance` update: Now false/disabled by default. Strange bug with JS/flash communication breaking with wmode=opaque on flash, specific (?) to Firefox on windows. SM2 does not normally set wmode. When `useHighPerformance = true`, wmode=transparent will be used on the flash movie by default.
    - Tweaks related to position, whileplaying(), playState, buffering and state resetting when sound has finished playing (fixes for a few edge cases if replaying or reusing the same sound or video.)
    - Better code/feature separation and clean-up on inline player, Muxtape-style demos

- ### V2.94a.20090206 (Download archived version)

  - API Updates

    - New `isBuffering` property, related `onbufferchange()` event handler (sound object)
    - New `soundManager.reboot()` method (experimental): Shut down and re-initialise SoundManager, remove and recreate flash movie (possibly handy for cases where you want to restart after flashblock-type whitelisting, etc.)
    - New `soundManager.flashLoadTimeout` property, milliseconds SM2 will wait for flash movie callback before failing and calling soundManager.onerror() during start-up/init. If set to 0, SM2 will wait indefinitely for flash (good for reboot/flashblock-type scenarios.)

  - Bug fixes

    - Reverted Firebug 1.3 console.log().apply() hack, was breaking console.log() under IE 8 RC1 (as used with debug mode.) Firebug 1.3 seems to have a bug, occasional "console undefined" error.
    - Fixed a dumb flash 9/AS3 bug with setVolume() passing an extra parameter to flash.
    - `soundManager.useHighPerformance` update: Now false/disabled by default. Strange bug with JS/flash communication breaking with wmode=opaque on flash, specific (?) to Firefox on windows. SM2 does not normally set wmode. When `useHighPerformance = true`, wmode=transparent will be used on the flash movie by default.

  - Miscellaneous

    - Tweaked project page / documentation UI, nicer code/debug formatting
    - Misc. API documentation fixes, improvements

- ### V2.93a.20090117 (Download archived version)

  - General Updates

    - New SoundManager 2 start-up debugger / troubleshooting tool, built into project home (see troubleshooting, and a standalone version - see "troubleshoot/" directory of download package)
    - New soundManager.getMemoryUse() method (flash 9+.) Returns RAM use for flash plugin (appears to be browser-wide, possibly system-wide by design.) Video demo includes an example RAM use monitor.
    - highPerformance disabled by default for Firefox on Windows due to reports of bugs preventing SM2 start-up in some cases. To override the disabling safety check, set `soundManager.useHighPerformance = 'always';`
    - Updated API demo testcases (API Demo page)

  - Bug fixes

    - Fixed Flash 8 bug with `autoLoad`/`autoPlay` and `playState` not being correctly set.
    - Fixed a bug with `onfinish()` not firing when `autoPlay` is used.
    - Fixed a bug with pan and volume defaults not being correctly inherited and handled
    - console[method]() now uses apply(), preventing possible Firebug 1.3-related scope issue where this != console
    - IE now appends (vs. destructive .innerHTML write) SWF movie to target element, appends DIV with className "sm2-object-box"

- ### V2.92a.20081224 (Download archived version)

  - General Updates

    - Note: Flash (SWF) assets moved to swf/ subdirectory, starting with this version.
    - Updated design on API demo page, new looping example

  - Bug fixes

    - Improved regular-expression-based URL detection for `canPlayURL()`, flash 8/9 and MovieStar (video) formats
    - Improved `soundManager.url`-related `normalizeURL()` handling. If GET parameters are in the URL including the SWF, it will be left alone.
    - Fixed out-of-bounds issue with `setPosition()`.
    - Fixed a `setPosition(0)` and before `onfinish()`-related issue, so it is possible to nicely loop sounds from within `onfinish()` - see looping a sound (API demo)
    - Fixed an error condition where destroying a loading sound would not terminate the HTTP request, relating to error cases involving `netStream.close()`.

- ### V2.91a.20081205 (Download archived version)

  - General Updates

    - Completely-redesigned project page, multiple pages/sections, more-legible grid-based documentation layout
    - Code verified with jslint. 0 errors reported with default settings, Edition 2008-11-26

  - Bug fixes

    - True XHTML DOM compatibility. Rewrote `createMovie()` to use standard DOM `createElement()` methods, vs. previous writing to .innerHTML method which caused exceptions with XHTML documents.
    - Special-cased `useHighPerformance` for Firefox 2 only, disabling it as it seems to be problematic. Further research pending.
    - Removed try .. catch error handling within `soundManager.onload()`, catching exceptions when calling user-defined onload handler. Errors should now fall through as normally expected.
    - Fixed several `setPosition()`-related bugs (NaN/undefined error, seeking to invalid position, position inconsistencies with pause/resume)

- ### V2.90a.20081028 (Old documentation theme) - Download archived version

  - API: Bug fixes

    - Fixed numerous Flash AS3 exceptions for Flash 10 plugin users of SM2 with Flash 9 .SWF
    - Fixed a `setPosition()` bug where position > duration would stop sounds playing in other tabs
    - Fixed `createSound(); play(); destruct();` sequence to correctly stop sound under Flash 9
    - Changed Flash 9 `onload()` to properly pass boolean "false" on load failure, same as Flash 8
    - Fixed `autoLoad`=true bug with Flash 9 movieStar (MPEG4) content, now pauses after creating

  - API: New shiny!

    - `soundManager.useHighPerformance`: Minimize JS/Flash lag, ~3x `whileplaying()` frequency! (Most noticeable on Mac OS X, and Safari on Windows? Investigating IE cases.)
    - `soundManager.pauseAll()` / `soundManager.resumeAll()`: Global pause/resume
    - `soundManager.muteAll()` / `soundManager.unmuteAll()`: Global mute/unmute

  - MovieStar MPEG4 video support! (experimental)

    - `soundManager.createVideo()` / `soundManager.destroyVideo()` for MovieStar MPEG4 formats!
    - Uses same SMSound instance object and API methods/options as regular sounds, with a few extra parameters
    - `soundManager.useVideo` will show video when applicable (false/disabled by default)
    - `SMSound.onmetadata`: Meta data handler for MPEG4 video files - provides dimensions (w/h)

  - Miscellaneous

    - Removed experimental flashBlock support. Considering eliminating SM2 timeout-based onerror() behaviour in favour of asynchronous loading (eg. user may initially block, notice flash movie and take action to unblock many seconds after loading - thus, flash movie eventually loads and can eventually trigger successful SM2 init.)
    - Modified `pause()` and `resume()` to only affect playing sounds (eg. `playState != 0`).

- ### V2.80a.20081005

  - API: Bug fixes

    - Changed Flash 8 `onload()` boolean "loaded" to be based on sound duration being >0, better test of load success.
    - Modified Flash 9 `onload()` to include boolean result for success/fail, parity with Flash 8

  - API: New shiny!

    - Added experimental Flash 9.0r115+ (flash codename "MovieStar", Flash 9 Update 3) MPEG4 / HE-AAC support (audio only.) A subset of MPEG4 should be supported including FLV, MP4, M4A, MOV, MP4V, 3GP and 3G2 files. Feature is disabled by default.

      - New soundManager `useMovieStar` property, controls feature availability (currently disabled by default.)
      - New SMSound option, `isMovieStar`, configures feature behaviour on a per-sound basis. Default (null) is to auto-detect .mp4, .mov etc. in URL and enable if found, but can also be forced on or off (true / false).
      - Video-based formats use the Flash 9 `NetStream` and `NetConnection` objects, whose API differs slightly from the Sound object. Seeking is limited to video key frames and is not as smooth as an MP3.
      - Audio playback has been seen to pause during certain events (window scrolling, etc.) while playing MovieStar formats. It doesn't appear to be from CPU overload. More investigation is needed.
      - Basic load, progress, onload, whileplaying API support is provided (page player demo includes MP4 and FLV formats). Not all methods (eg. setVolume) have been tested.
      - .AVI is not included by default, but may work if the format is actually MPEG4-based.
      - Format limitation note: EQ, peak and spectrumData are not available with MovieStar content. This may be a Flash 9/AS3 limitation.

  - - Miscellaneous

      - Added CSS checks to page player: "exclude" and "playable" to override default URL matching behaviour.

- ### V2.78a.20080920

  - API: Bug fixes

    - Added `SoundLoaderContext` parameter to `load()`, Flash should now check policy-related (crossdomain.xml) files when loading resources from remote domains. Should fix previous security exception warnings when trying to access ID3 and/or waveform/EQ data. See related SoundLoaderContext documentation (ActionScript 3)
    - Fixed a bug with `load()`, was improperly expecting an options object - now works properly.

  - API: New shiny!

    - Added `soundManager.altURL` property (and `useAltURL` conditional) for convenient offline and other URL switching cases (dev vs. production environments, etc.)

  - Miscellaneous

    - Renamed internal soundManager and SMSound `self` closure references to `_s` and `_t`, respectively, to avoid potential conflicts with others' code
    - Moved self-destruct to use `window.onunload` instead of `onbeforeunload`, given the latter event can be caught and canceled if desired by the user
    - Inline player demo: Added `autoPlay` option
    - "Basic" demo directory (demo/basic/) moved to demo/api/, added `load()`-related testcase

- ### V2.78a.20080920

  - API: Bug fixes

    - Added `SoundLoaderContext` parameter to `load()`, Flash should now check policy-related (crossdomain.xml) files when loading resources from remote domains. Should fix previous security exception warnings when trying to access ID3 and/or waveform/EQ data. See related SoundLoaderContext documentation (ActionScript 3)
    - Fixed a bug with `load()`, was improperly expecting an options object - now works properly.

  - API: New shiny!

    - Added `soundManager.altURL` property (and `useAltURL` conditional) for convenient offline and other URL switching cases (dev vs. production environments, etc.)

  - Miscellaneous

    - Renamed internal soundManager and SMSound `self` closure references to `_s` and `_t`, respectively, to avoid potential conflicts with others' code
    - Moved self-destruct to use `window.onunload` instead of `onbeforeunload`, given the latter event can be caught and canceled if desired by the user
    - Inline player demo: Added `autoPlay` option
    - "Basic" demo directory (demo/basic/) moved to demo/api/, added `load()`-related testcase

- ### V2.77a.20080901

  - API: Bug fixes

    - Fixed some `mute()` / `unmute()`-related bugs, global muting should now work properly. Added some related demo page examples.
    - Removed comment on flash9Options merging code, was previously new and didn't actually work as it was commented out. Oops. :D
    - Added experimental Flashblock exception handling (mozilla/firefox extension), "notification bar"-style UI which can message and assist users in unblocking SM2 .swf. Configured via `soundManager.flashBlockHelper` object, currently disabled by default.
    - Modified `soundManager.destroySound()` and `sound.destruct()`, fixed a bug with these methods and flash's unloading of sounds which was breaking things. Hopefully fixes destroying sounds within whileplaying() and related event handlers, too.
    - Modified flash 9 "peak data" code to only set the data if the feature is actually enabled.
    - Modified `soundManager._debug()` to list all sound object details, instead of just ID/URL.

- ### V2.76a.20080808

  - API: Bug fixes

    - Fixed some memory "leaks" / garbage collection issues. RAM allocated to load sounds previously wasn't freed until page unload; now memory should be garbage collected some time after `sound.unload()` and/or `soundManager.destroySound()`/`sound.destruct()` methods are called. In certain cases, Flash sound objects may be destroyed and re-created (transparent to the JS-side) to release memory. Note that garbage collection is not instantaneous, and is affected by CPU/system load and other variables.
    - Fixed an issue with `play()` not working on sounds created with `autoPlay`.
    - Fixed SM2 to work under proper XHTML (served as `application/xhtml+xml` MIME type). Rewrote object/embed code again, now version-agnostic for IE (no CLSID parameters.)
    - Corrected reported `loadFromXML()` bug, multiple loadFromXML() calls should work.

  - API: New shiny!

    - New `useWaveformData` and `useEQData` sound options, providing access to raw waveform and sound frequency/EQ spectrum data via sound.waveformData and sound.eqData.
    - Renamed `useSpectrumData` to `useWaveformData` - if using waveform stuff currently, make sure you update your code!
    - Added `soundManager.features` object, which reflects the "support" state for `peakData`, `waveformData` and `eqData`. Handy for current and future version/support branching.

  - API: Miscellaneous

    - New `flash9Options` configuration object for logical separation. When Flash 9+ is used, these options are merged into the `defaultOptions` object.
    - Added `allowDomain()` stubs and documentation to .as source for allowing .swf on external domains to work (recompile of .swf required)

  - "Page As Playlist" demo: Updates

    - Added "favicon" VU meter display option (Flash 9+ only, experimental, currently Firefox/Opera only)
    - More-efficient RAM use via `unload()` and `destruct()` sound methods, discarding inactive sounds and freeing RAM as appropriate.
    - Added `useEQData`, showing sound spectrum (frequency range) instead of raw waveform
    - Added `fillGraph` config option, allowing solid waveform graphs instead of only peak points
    - Fixed `playNext` bug where same track couldn't be played twice in a row.
    - Fixed duplicate URL bug; items with identical MP3 URLs will now work. (Previously, URL was the ID for items and thus had to be unique. Lookup is now done by object.)
    - Modified MP3 URL search to include URL parameters, characters after ".mp3"

  - Other updates

    - Demo code clean-up, externalised CSS, prettier demo layout and code color highlighting

- ### V2.75a.20080707

  - Flash 9 support! (soundmanager2_flash9.swf) - `multiShot` now actually works (layering/"chorus" effects on sounds), new `spectrumData` and `peakData` API features. All existing API features should have parity.
  - Added `soundManager.flashVersion` property. Flash 8 is the supplied default.
  - Modified `soundManager.url` to require only a path, eg. `/path/to/soundmanager-swfs/` to allow loading of varying .SWF versions.
  - Basic (API) demo: Updated multiShot/Flash 9 behaviour documentation
  - Page player demo: Added optional spectrum and VU (spectrumData/peakData) features
  - MPC + animation demos: Modified to use Flash 9 (demo improved multiShot feature)
  - Flash 9 behaviour differences:
    - `multiShot` properly allows `play()` to be called multiple times on a sound object, creating desired "chorus" effect. Will call `onfinish()` multiple times, but `whileplaying()` etc. are called only for the first "play instance" to avoid complications.
    - New `soundSpectrum` and `peakData` sound features (spectrum graph / "VU" meter-style data) available
    - Sounds can be actually unloaded ("null" MP3 no longer needed to cancel loading of an MP3), but URL cannot be changed without destroying and recreating the related Flash sound object. The Flash 9 version does this to maintain API consistency.
  - New + improved documentation/project page, updated 2-column layout with content filters, "Get Satisfaction" integration and self-update checks (and a light-switch-related easter egg.)

- ### V2.5b.20080525

  - Added `waitForWindowLoad` for delayed init
  - Added `onpause()` and `onresume()` event handlers
  - Added `mute()` and `unmute()`
  - Updated demos, revised documentation

- ### V2.5b.20080505

  - To improve startup time, `soundManager.go()` (`createMovie()` alias) now fires at `onDOMContentLoaded()` by default if supported. (Otherwise, falls back to `window.onload()`.)
  - Improved initialisation routine - `soundManager.onerror()` is called when the Flash init "times out." Specifically, `onerror()` is called when Flash fails to make an ExternalInterface (Flash-> JS) call to SM2 within 1 second of `window.onload()` firing.
  - Added logic to handle special Safari delayed init case (Flash not loading when in a new, unfocused tab until focused) as a exception to the above.
  - Added better exception handling + debug messaging for initialisation failure cases (Flash security restrictions due to loading from local file system, no flash support, no ExternalInterface support etc.)
  - Updated .swf appendChild() target to use best-to-worst options: `(document.body || document.documentElement || document.getElementsByTagName('div')[0])`
  - Safari console[log|warn|error]-style messages are now properly formatted.
  - Added tons of semicolons to closing braces, eg. `};`
  - "No-debug", minified version of SM2 included: soundmanager2-nodebug-jsmin.js (17.4 KB, down from full size of 35 KB.) With Gzip compression, file size is ~6 KB. (Commented, debug-enabled version compresses to 10 KB with Gzip.)

- ### V2.5b.20080501

  Warning: A little experimental too, read details below.

  Changelog:

  - Rewrote SoundManager initialisation: "Way faster." Communication now initiated from Flash, verification callback then performed by JS; far faster, hopefully more-reliable (TBD.) Init time drastically reduced from seconds to milliseconds in most cases, dependent primarily on Flash movie load rather than `window.onload()`.
  - Above change also fixes Safari "loading SM2 in background tab" issue, where Safari does not init Flash until background tab comes into focus (when a link is opened in a new, non-focused tab.)
  - Current drawback: Difficult to determine, save for falling back to `window.onload()` plus focus methods due to above issue, whether SM2 is actually available or not (ie., `soundManager.onerror()` will not likely be called as in past.) However, the `supported()` method will correctly reflect if SM2 has successfully initialised, for example.
  - Added sandbox/security model code; SM2 can now tell if it is restricted to either local or internet access only, for example. Helpful in potential debugging errors, plus viewing demos off the local filesystem should no longer throw init errors requiring whitelisting (seemingly due to the new initialisation method.) Win!
  - Opera 9.27 has been noted to have some bugs relating to ExternalInterface, seems to be unable to make calls from ActionScript-level methods using `setTimeout()` or `setInterval()`. As a reulst, SoundManager 2 events like `onfinish()`, `whileplaying()` and `onfinish()` can be sporadically called or missed altogether. No known workaround at this time, but Opera 9.5 (beta 2) does not have this issue. Popular MP3 "mix tape" site muxtape.com uses similar techniques for JS-Flash communication and appears to suffer from the same problem.
  - Warning: Random crash issue noticed when using IE 6 + 7 and this demo page, calling `createSound()` when `soundManager.defaultOptions.autoLoad = true;` from within `soundManager.onload()`, for creating + preloading the tab/theme switch sounds. Removing autoLoad=true (leaving the default of false) fixed the crash. Exact reason not determined, perhaps recursive calls or pre-onload issue (?), seems to be isolated to the home page. MPC demo uses autoLoad also, but did not crash. Mentioning just in case.
  - Updated Muxtape-style demo: More themes, load/security debugging info etc.

- ### V2.2.20080420

  Changelog:

  - More demos! "Page as a playlist" (muxtape.com-style) example, "Make MP3 links playable inline" demo
  - Corrected `onStop()` handler inheritance/overriding behaviour (was incorrectly checking defaultOptions)
  - Added debug output of options object for `createSound()` calls. Full options (result of merging global default + sound-instance-specific options) displayed, helpful in troubleshooting. Event handler function code is intelligently (hopefully) displayed, truncated at 64 characters of first block or end of line, whichever comes first.
  - Removed most HTML markup from non-HTML (eg. console) `_writeDebug()` calls
  - `soundManager.destruct()` writes to console, to be consistent

- ### V2.1.20080331

  Changelog:

  - Modified `createSound()` to return a sound object if successful (more logical)
  - Updated `setPosition()` method and added `position` option parameter, documentation + demo (bugfix)
  - Corrected `createSound()` and `play()` sound option inheritance/overriding behaviour (eg. `position`) to work as expected (most to least important: Method call options -> sound object instance options -> SM2 global options)
  - Updated `deleteSound()` so Array.splice() is used instead of delete, the latter doesn't cause Array.length to update (bugfix)
  - Modified debug=alert to only work when debug mode is enabled (potential annoyance aversion)
  - Modified `togglePause()` to use `position` option parameter rather than undocumented `offset` (oops :D)
  - Added `supported()` convenience method (indicates pass/fail after SM2 has initialised.)
  - Added disabling debug calls from Flash (performance)
  - Added URL hash updating/bookmarking and page title updating to jsAMP demo app
  - Updated project page layout

- ### V2.0b.20070415

  Changelog:

  - Added `destroySound()` method
  - Made debug output slightly less-verbose (commented out)
  - Safety tweak for position-related Flash bug when loading new sounds
  - Highly-expanded documentation (`SMSound` events + properties, examples, caveats, FAQs etc.)
  - Added time-sensitive light/dark theme for documentation

- ### V2.0b.20070201

  Second beta?

  Changelog:

  - Fixed stopAll() bug (previously broken)
  - Added `nullURL` parameter
  - Updated documentation

  ### V2.0b.20070123

  ### V2.0b.20070118

  ### V2.0b.20070115

- ### V2.0b.20070107

  First beta

- ### V2.0a.20060904

  Prerelease alpha

## Discussion / Support

Get Satisfaction support network