# SoundManager 2: Download

## Get SoundManager 2

Get the latest and greatest.

### Download SoundManager 2

Latest changes: `from` / `to` and `onplay()` bug fixes, `canPlayMIME()` and `canPlayLink()` Flash-specific corrections. See revision history for details.

Download SoundManager 2.97a.20120318

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

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

Side reading + video talks, slides etc.

- Video, 02/2012: Web Audio: HTML5 + Flash (in a tree) (slides.) Updated HTML5 content, demos and SURVIVOR C64 game demo.
- Video, 12/2011: Adding Sound To HTML (slides.) Overview + updated content from 06/2011 talk.
- Video, 06/2011: The State Of HTML5 Audio
- Article: "Probably, Maybe, No": The State of HTML5 Audio.

## Revision History

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

### Revision History

A changelog of sorts.

- ### V2.97a.20120318 - Minor updates. `from` / `to` and `onplay()` bug fixes, `canPlayMIME()` and `canPlayLink()` Flash-specific corrections.

  - Bug fixes

    - Fix silly `undefined"soundID"` debug output message shown at `SMSound.onload` (now says `SMSound._onload()` as previously.)

    - `soundManager.sounds = {}` instead of `[]` on reboot (per bug report)

    - Fix logic for calling `onplay()`, was always non-truthy. D'oh!

    - Add missing `typeof` to fix html5 MIME check for playability tests

    - Don't apply `width:auto` to SWF (invalid per HTML5, allegedly: Related patch.)

    - Make `soundManager.canPlayMIME()` and `canPlayLink()` check flash support before returning (check after `ontimeout()` was returning truthy when flash required under Firefox, for example, for `'audio/mp3'`)

    - Fix `play()` "`from`" + "`to`" sound sprite playback issue: In some cases, previously-fired "to" events were re-firing due to not being removed, because an equality check was comparing against a potential "to" value of a string rather than a number. (eg., 0-700 followed by 1500-2000; playback would stop in second case, saying 700 had been reached. (Related bug report.)

    - Re-appeased the jslint gods, removed unused variables and two-statement reverse loop `(for i=x; i--;) { }` trickery.

  - Miscellaneous

    - The SoundManager project turned 10 years old, having originally launched in late 2001. Thanks for using it!

- ### V2.97a.20111220 - HTML5 src/onload()/onstop() fixes, new HTML5 polling, `onPosition()` updates, "audio sprites" (`from`/`to`) and multiple URL support. (Also: New homepage design!) (Download archived version)

  Fixes for HTML5 audio including redundant `src` assignment, `onload` and `onstop`. New `html5PollingInterval` property, `onPosition()` and `clearOnPosition()` methods, "audio sprites" support via `from` and `to` parameters. Updated `onposition()` sound method, added new `onposition` sound parameter, and multiple URLs / URL formats now allowed for a sound. Also: Version checking between JS and SWF, brand-new optimized homepage design and demo UI tweaks + optimizations.

  - Bug fixes

    - HTML5: Fixed `Audio()` `src` attribute re-assignment bug seen in `createSound()`->`play()` use case.

    - HTML5: `mySound.load({onload:function(){}})` callback fixed so it works.

    - HTML5 + Flash: `onload()` now called immediately when `load({onload:function(){}})` is used on a sound with the same URL which has already loaded.

    - `onstop()` now mimics `onfinish()` in terms of sequence. HTML5 sets `position` to 0, but retains pre-`stop()` position property value (like Flash does.)

    - Amazon Kindle Fire UA looks like Safari on OS X 10.6.3, but does not have broken HTML5 audio (i.e., intermittent playback failure) like the "isBadSafari" case.

    - MovieStar/NetStream (non-RTMP) edge case: Correct `onfinish()` after `play()` and a seek so that it always fires. Remove `metadata()` after first call (as it was) for non-RTMP. Reduce buffer-near-end logic to 3 seconds from 5.

    - Flash 9 MovieStar/RTMP: Only fire `onconnect()` for RTMP (was firing for flash 9/NetStream, too, breaking MovieStar `createSound({autoLoad:true,onload:function(){this.play()}})` case.)

    - RTMP: Exclude RTMP from 30-second `resume()` reposition hack (streaming does not have this issue.) May have been breaking buffer due to seek on resume.

    - Fix edge case where `soundManager.waitForWindowLoad = true` (non-async startup case), but `_initComplete()` may fire after `window.onload()` and thus `onready()` never fired.

  - API updates

    - Added `soundManager.html5PollingInterval` property, for increased `whileplaying()` callback frequency (higher UI framerates) similar to `flashPollingInterval`. (By default, null/off.) Also excludes mobile (eg., iOS) by default.

    - `soundManager.onPosition()`: Queues a callback that will be fired each time a sound reaches a given position during playback. Applies for the life of the sound object.

    - `soundManager.clearOnPosition()`: Removes `onPosition()` callback(s) from a sound, by position and/or callback. (If no position or callback are specified, then all callbacks are cleared for the given sound.)

      Optionally, an `onstop: function(){}` handler can be passed to capture the moment when "to" is reached. When using Flash, sound is preloaded 100% in order to guarantee playback can start at the "from" position.

    - Added support for "audio sprites." New sound options, `from` and `to` allow segments, samples or slices of sound to be played. eg., `mySound.play({ from: 5000, to: 10000});`

    - New sound option, `onposition`, defines times and related callbacks for positions of interest within a sound. Applies on a per-play basis. eg. `onposition: {500: function(p) { console.log('position ' + p + ' was reached.') } }`

    - Experimental: Multiple formats/encodings support in the sound `url` parameter; now accepts an array as an alternate to a single string. eg. `soundManager.createSound({id:'foo', url:['bar.ogg','bar.mp3']});` - SM2 will use the first playable URL it finds and the URL property will then reflect the one URL after that point. Note that this means the original array data will be lost.

      Also accepts `type` attributes, eg. `url:[{type:'audio/mp3',url:'/path/to/play.php?song=123'},...]` - useful for URLs without obvious filetype extensions.

    - Flash 9 + MovieStar (NetStream) / RTMP: `onmetadata` (sound parameter) callback, allows capturing of metadata events from flash (eg., streaming song / title updates) similar to `onid3()`. Can now fire multiple times, eg., when RTMP streaming and new song / artist info is provided.

    - Added JS version + Flash SWF build/version check to SM2 during start-up. (Finally! :D) ... Will now throw `new Error()` if soundmanager.js version reports V2.97a.20111030 and SWF version is V2.97a.20110918, for example. (Happens when upgrading/replacing old versions of SM2, you may forget to update one of the SWFs etc.)

  - Miscellaneous

    - Homepage: Brand-new, shinier design, improved three-column layout; looks better even in IE 6. Small UI tweaks on inline demos. Combined demo JS + CSS files for performance; cut HTTP requests by over 50% (now down to 14 HTTP requests in most cases) via concatenation and data: URIs for some background images and sprites.

    - 360 player demos: Updated UI with more circles and a few gradients, border-radius etc. Small 50x50 UI is now clickable over entire area, rather than small circular button.

    - Demos: Some data: URIs added to inline player and 360 player for performance (reduced HTTP requests.) Christmas lights demo now uses YUI 3 seed + animation.

    - `soundManager.useConsoleOnly = true` by default, was previously false. New "true" default means no HTML debug output if `console.log()` is available.

    - soundmanager2.js: Micro-optimizations, further -nodebug-jsmin optimizations and minor comment formatting. Eliminated last Google Closure Compiler warning (caused by an empty "if" block.)

    - Debug output no longer shows "loops: 1" (redundant), only interesting values eg. 2+ are reported.

    - Documentation: Small theme tweaks, textured background and re-organization of properties (left menu) for easier navigation. Fixed "onsuspend" event labeling, clarify SMSound events as properties and not methods. Re-sorted property lists, tidied up code formatting. Added missing `soundManager.onPosition()` documentation (side note: previously named onposition(), old lower-case method name maintained for backward compatibility.)

    - Page player / Muxtape demos: Removed `useMovieStar` sound option - no longer exists, redundant.

- ### V2.97a.20111030 - HTML5 `unload()` improvements, Android 2.3 fix and new `onsuspend()` event (Download archived version)

  Fixes for HTML5 `unload()` on Webkit (connection was not closing), playback on Android 2.3, and IE 9 "not implemented" / unsupported HTML5 case. Addition of `onsuspend()` HTML5 event, possibly applicable to iOS where stalled events suggest that user action is needed to play or resume audio playback.

  - Bug fixes

    - HTML5 `unload()`: Correctly apply `about:blank` (_emptyURL default) to everyone except Firefox, which allegedly likes `''`. Webkit was not actually closing the connection of loading streams, in this case.

    - HTML5 audio playback fix for Android 2.3 (Honeycomb), which doesn't seem to like `new Audio('foo.mp3')` followed by `load()` -> `play()`; first request/attempt stalls and eventually fires `ended` event. Rather odd. (Related discussion.)

    - Added `try...catch` for dumb IE 9 `Audio()` "not implemented" error in Windows server case without "desktop experience" installed, means no HTML5 audio/video support. Hat tip: Modernizr issue 224

  - API updates

    - Added `soundManager.noSWFCache` (boolean) for easy cache busting - good for dev/testing. SWFs tend to be aggressively cached by browsers, especially in offline cases.

    - HTML5 `suspend` events are now listened for and fired via SMSound option `onsuspend()`. This event may be the best way to detect when mobile Safari (eg. iOS) is blocking autoplay-style behaviour, and user interaction is required to start or resume playback.

  - Miscellaneous

    - Fix "playable MP3 links" demo for iOS, playing 2nd+ sound now works. Due to single sound object reuse, "old" sound must be paused before new one is created. Previously, playing sound 1 -> sound 2 -> sound 1 would fail.

    - Tweaked 360player behaviour to support being initialized multiple times (for dynamic content, "decorating" new MP3 links etc.)

    - Modified soundManager core property documentation to be multi-line, allowing longer comments

- ### V2.97a.20110918 - Code clean-up, improved comments and formatting, generated documentation, polling and `onbefore-` removal, HTML5 `stop()`/`unload()` fixes (Download archived version)

  Added block comments above major SM2 methods (and Docco-generated documentation), more line breaks for consistent vertical spacing and readability, removal of `onbefore`-related SMSound options, `allowPolling` + `useFastPolling` features. Improved build task optimizing of -nodebug JS build, removing comments, extra line breaks and debug code blocks which were previously only commented out.

  - Bug fixes

    - HTML5 unload: Gecko can use url = '' to cancel request etc., others seem to need `about:blank` or similar empty URL (matching Flash 8.)
    - HTML5 `stop()`: Don't call `unload()` here (file under "durrr." This fixes a few state-related bugs.)
    - Fire the `onposition` callback after setting item.fired, instead of before. This allows looping in the form of `mySound.onposition(200, function(){ mySound.setposition(100); });`
    - Fix movieStar (MPEG-4) handling for URLs without MIME hints (eg. a URL ending in .php) if `type: 'audio/mp4'` is passed, for example. (Possible regression introduced with V2.97a.20110801, one report was received.)
    - Fire `onposition()` after increasing the internal "onPositionFired" counter.

  - API updates

    - Clean-up time! The following soundManager properties have been removed as they're ineffective and/or have modern replacements:

      `soundManager.nullURL = 'about:blank';` (internalized; search for 'about:blank' in the source if you want to customize it.)

      `soundManager.allowPolling = true;` (ignored, always true now. `whileloading()` / `whileplaying()` calls rely on it.)

      `soundManager.useFastPolling = false;` (redundant, now determined by flashPollingInterval now being specified as a number eg., 20, instead of the default of null.)

      The following SMSound (sound options) have been removed, in favour of modern replacements (and also didn't work with HTML5 sounds.)

          soundManager.defaultOptions.onbeforefinish = null;
          soundManager.defaultOptions.onbeforefinishtime = 5000;
          soundManager.defaultOptions.onbeforefinishcomplete = null;
          soundManager.defaultOptions.onjustbeforefinish = null;
          soundManager.defaultOptions.onjustbeforefinishtime: 200;

      As a replacement, use the `SMSound.onposition()` method to assign an event callback handler to fire at the relevant time.

          mySound.onposition(10000, function() {
            console.log('the sound ' + this.sID + ' is now at position ' + this.position);
          });

      If you need to fire an event relative to the true end of the sound, reference its duration once the sound has fully-loaded - ie., at or after the `onload()` event - as the duration will not be completely accurate until that time. `durationEstimate` may be referenced before `onload()`, but it should not be relied on when "precise" timings of say, < 1 second are desired.

          mySound.load({
            onload: function() {
              this.onposition(this.duration - 5000, function() {
                console.log('the sound ' + this.sID + ' is now at position ' + this.position);
              }
            }
          });

      Again, note that due to the interval / polling-based methods of both HTML5 and flash audio, sound status updates and thus precision can vary between 20 msec to perhaps 0.5 seconds and the sound's position property will reflect this delta when the onposition() callback fires.

    - Added `soundManager.onposition()` (forgot to mirror the SMSound method)

    - Privatize `soundManager.netStreamMimeTypes`, etc. `soundManager.mimePattern`, the resulting one applied to `canPlayMIME()` etc., is still exposed.

    - Simplify getMovie() to use _id(smID) || _doc[smID] || _win[smID] rather than IE / Safari special checks. Sometimes (old?) IE and Safari would return null on getElementById(), but window[id] or document[id] would work. Presumably related to Flash + ExternalInterface wackiness.

  - Miscellaneous

    - Reviewed soundmanager2.js code for readability and comments. Added linebreaks, spacing and block-style comments around main functions.
    - Added generated documentation via "Rocco" (ruby port of Docco.)
    - Added build.xml notes re: Closure compiler, MTASC and where to find working builds
    - Modified soundmanager-nodebug.js build so comments and debug blocks are removed entirely from the code. Double-spaced linebreaks are also removed.
    - Removed executable permissions from almost all files
    - parseInt() on soundManager.flashVersion, invalidate strings like "9"
    - Use 10 / 50 msec polling interval for high performance mode vs. regular mode
    - Page cache/unload/restore (back button case): Only apply window unload event if using flash, since plugin is more likely to break (ie., state won't be recalled correctly.)

- ### V2.97a.20110801 - "100% HTML5 mode" desktop browser (+no flash) fix, `useHTML5Audio` enabled by default, flash 9 end-of-sound correction, ClickToFlash improvements (Download archived version)

  Last release introduced a regression with HTML5-only mode on desktops when flash was not installed/present, now fixed; HTM5 audio support is enabled by default, although flash is still preferred for MP3/MP4 by default. `probably|maybe` is now the default when testing HTML5 format support. Flash 9 now does not reset sound position to 0 at `onfinish()`, matching flash 8 and HTML5 behaviour. Better ClickToPlugin / ClickToFlash compatibility (CSS tweaks for display of blocked SWF.) Minor internal flash polling loop improvements. soundManager `onload`, `onerror` and `oninitmovie` events have been deprecated in favour of `onready()` and `ontimeout()`, but remain functional.

  - Bug fixes

    - A regression was introduced in V2.97.20110706 where SM2 would fail to start in HTML5-only mode on supported desktop browsers when flash was disabled or not installed, eg., Safari on new Macs or IE 9 without flash. (iOS was not affected.) This has been fixed with the 2.97.20110801 release.

  - API Updates

    - `soundManager.useHTML5Audio` is now `true` by default; however, `soundManager.preferFlash` is also `true` and HTML5 browsers will still attempt to use flash for playing MP3/MP4 by default, if those formats are marked as "required".

      If you wish to have 100% HTML5 mode in more cases, set `soundManager.preferFlash = false`. Presently, the MP3 links and MP3 button SM2 demos are more HTML5-friendly and will serve as a test for exposing bugs that may be in the wild.

    - `soundManager.html5Test` has been relaxed to use `(probably|maybe)` for Audio's `canPlayType()` test (previously, was only "probably") - so formats will be more likely to work on HTML5-only devices that conservatively report "maybe" for MIME types like `audio/mpeg; codecs="mp3"` at this point.

    - Certain mobile and tablet-like devices are special-cased as preferring HTML5, and will ignore checking for flash altogether; this presently includes the iPad, iPhone and iPod, Palm Pre and Motorola Xoom.

    - The HTML5 audio "loadeddata" event triggers an SMSound `onload()` event, which now fires `whileplaying()` and tries to pass identical `bytesLoaded, bytesTotal` parameters so that UIs will correctly show the sound as fully-"loaded" - even if in truth, not all bytes have actually been fetched (depending on the browser and server, etc.) because of the ability to do arbitrary seeking.

    - Updated Flash 9 `onfinish()` / end-of-sound behaviour: Sound objects' `position` property no longer resets to 0 when a sound ends (and when `onfinish()` fires.) This now matches both HTML5 and flash 8's existing behaviour; therefore, a sound's `position` will equal its `duration` at `onfinish()` in all cases now. In the event `play()` is called from the end of a sound at or after `onfinish()`, the sound's position will be set to 0 before playback begins if using flash 9.

      Edge case covered: if at internal SOUND_COMPLETE the SMSound.position is < its duration, flash will match position to duration and fire `whileplaying()` one last time so "100%" is always reached before `onfinish()` is called.

      `multiShot` + `multiShotEvent` case has been verified as working (eg. `onfinish()` fires 5x if `play()` called 5x.)

    - soundManager.onload, soundManager.onerror and soundManager.oninitmovie have been deprecated in favour of soundManager.onready() and soundManager.ontimeout(). The deprecated methods are still present and work with this release, but you should migrate to their modern replacements.

  - Miscellaneous

    - Flash 8 + 9 internal `whileplaying()` + `whileloading()` polling improvements: Internal check previously looped through all sounds from onLoad(), registerOnComplete(), _load() and _setPosition(). Now only the relevant sound is checked.

    - Improved HTML5 support debug ouput/messaging, now right up top. Better messaging and error handling when Flash isn't present, yet required case (Flash plugin either not installed or disabled, but needed in some cases) - eg., Firefox and `audioFormats.mp3.required = true;` ... Also, only one _detectFlash() call now made.

    - Playable MP3 links and MP3 button demos use `soundManager.preferFlash = false`, so they should be able to run in 100% HTML5 mode. Some HTML5 bugs are anticipated, and these may help to reveal issues via a smaller audience.

    - Initialization code reorganized, minor edits and clean-up, removal of some unused objects and ternary optimizations per jslint

    - Cleaned up IE <`object>` code, added highPriority flash param (affects flash 10.1+, if at all.)

    - Improved flashblock handling / compatibility (CSS layout tweaks) with newer ClickToPlugin/ClickToFlash Safari (5.0.6 / 5.1+) extensions.

    - SM2 homepage demos try HTML5 + Flash if available, with "safe" reboot + fallback to HTML5-only mode (if supported - eg., Safari with flashBlock/ClickToFlash.)

    - Basic MP3 player demo: Fix event JS error when manually calling things like `basicMP3Player.handleClick({target:document.getElementById('foo')});`

    - Flash SWFs, debug versions: Mention right-click -> security panel options when troubleshooting security errors

- ### V2.97a.20110706 - improved HTML5/flash "mixed mode" via `preferFlash`, Safari + Snow Leopard HTML5 audio bug update, better ClickToFlash compatibility, minor demo tweaks (Download archived version)

  Special note: This was V2.97a.20110705, but the latest Flex SDK (4.5.1.21328) was downloaded and used for this build, and it compiled a Flash 9 SWF that wouldn't fully-start on some Windows machines running Firefox and IE 7, possibly others - thus, SM2 would fail to start up. The Flash 9 SWFs are now compiled with an older, working SDK version 4.1.0.16076, used in previous working releases. See discussion for more details.

  Improved "mixed mode" HTML5/flash handling via new (experimental) `preferFlash` option, enabled by default. (If present, MP3/MP4 get flash for stability; HTML5 is used for other formats.) OS X 10.6.8 (finally?) fixes HTML5 audio in Safari. SoundManager 2 SWF adjusted to fall under ClickToFlash's "invisible" rules, may lower chance of blocking.

  - Bug fixes

    - ClickToFlash (Safari/Mac flashblock-style extension) compatibility improvement: Use `width/height: auto` on SWF instead of 100%. The latter is not recognized as being within ClickToFlash's <= 8x8px "invisible flash" rules, almost guaranteed to be blocked. (When considered "invisible", SWF is allowed to load normally if user has the invisibles option enabled.)
    - Flash blocking/handling improvements: Default `#sm2-container` size now always 8x8px to fall under "invisible" flash rules, better chance of load being allowed. If blocked and using flashblock.css, `#sm2-container` reverts to 48x48px at `ontimeout()` for visibility (so user can see, and unblock the flash bit.)
    - OS X 10.6.8 "pre-Lion release" update finally appears to have fixed the broken Safari HTML5 audio issue. Thus, audio was broken from OS X 10.6.3 to 10.6.7 and SM2 will use Flash for these known cases. Related: Testcase and Webkit bug #32159.
    - HTML5 audio: Playback now does not start after a `setPosition()` call (if the sound was not already playing), or if it was paused - matching the existing Flash API behaviour.
    - Fix `ontimeout()` queue incorrectly processing after `onload()` and successful startup.
    - Debug output: extraneous "%s" fixes for `onready()` / `ontimeout()`

  - API Updates

    - Added experimental `soundManager.preferFlash` (default:`true`) for a more consistent MP3/MP4 playback option in certain HTML5 cases. If using `soundManager.useHTML5Audio` + `preferFlash` and flash is available, flash will be used for MP3/MP4.

      HTML5 is still new and relatively unstable, and bugs are yet to be found and fixed across a growing number of browsers/platforms etc. (consider that it was broken on Safari between OS X 10.6.3 and 10.6.7.) If flash is not installed or `preferFlash = false`, 100% HTML5 mode can still apply. In any event, HTML5 will still be used (if enabled) for all other formats.

    - Moved internal html5Only to (experimental) `soundManager.html5Only`, for detecting "HTML5-only mode" - eg., iOS, Safari without `preferFlash` or other environments where SM2 is operating without the flash portion of SM2.

  - Miscellaneous

    - Improved "can play" detection (`canPlayURL()` + `canPlayMIME()`) for HTML5 + flash cases. Increased "getting impatient, waiting for flash" message to 1 second.
    - 360°, inline, MP3 button players: Event add/remove: use addEventListener based on typeof attachEvent === null (old IE behaviour)
    - MP3 player button demo: Fix IE 6/7 display issue on button (d'oh!)
    - Muxtape-style demo: Added `pagePlayer.playPrevious()`, to match `pagePlayer.playNext()` (call when a sound is currently playing.)
    - Fixed 360° player basic visualization demo (missing class in HTML), clarified canvas support (no eq/spectrum) re: IE <9.
    - 360° UI: Old "empty element doesn't catch mouse events" bug apparently still applies to IE 9. Fix with invisible background image.
    - Minor homepage stylistic updates, source code order change for API docs (CTRL-F search now hits left column first)
    - Small debug output clean-up in SM2, object/embed, init etc.

- ### V2.97a.20110424 - Minor HTML5 tweaks, option inheritance fixes, improved build.xml file (Download archived version)

  HTML5 bulletproofing, `Audio(null)` argument fix for iOS + Opera, `load()` vs. `createSound()` and `setVolume()`/`setPan()` options/inheritance correction

  - Bug fixes

    - HTML5: `new Audio(null)` fix for differences between iOS (which would try to load `null`) and Opera 9.64, which would throw a WRONG_ARGUMENTS_ERR if `null` was not passed.
    - HTML5: Restrict internal volume value range to 0..1, avoid DOM exceptions.
    - HTML5: `load{url:x})` improvements for desktop, better old vs. new URL comparison.
    - HTML5, iOS 4.2/4.3+, SM2 Muxtape/inline/link demos: `onfinish()`->`unload()`->`playNext()` was breaking on newer iOS versions, "play through" affected. Removing `unload()` for iOS fixed issue.
    - Flash `object`/`embed` `pluginspage`/`codebase` attribute now uses http:// when being used from file:// (offline), and http/https-agnostic //macromedia.com syntax to avoid SSL mixed-content warnings.
    - Fix `setVolume()` / `setPan()` to properly update `SMSound.options` (when not "instance-only"), so settings are retained for future `play()` calls. Bug was that original volume/pan were incorrectly restored after the first instance completed.

  - Miscellaneous

    - New and improved (nearly platform-independent) build.xml file, thanks to github user "dolmen". A `.build.properties` file is now needed, defining "mxmlc", "mtasc", and "closure-compiler.jar" paths. e.g.:

          <!-- .build.properties file in SM2 root -->
          mxmlc=/Applications/flexsdk/bin/mxmlc
          mtasc=/Applications/mtasc/mtasc
          closure-compiler.jar=${user.home}/compiler.jar

      Running `ant` from the SM2 root will build the no-debug and minified versions of the script, as well as the SWF files.

- ### V2.97a.20110306 - HTML5 audio updates, Flash/HTML5 mode detection, IE flash init tweaks, reuse and instance options fixes (Download archived version)

  Bug fixes and improvements for HTML5 audio (object reuse on iOS), improved URL comparison. `onfinish()` -> `this.play()` instance option fix. IE flash wmode initialization tweak. Flash/NetStream (MP4) unpause()/resume() hack now applies to everyone. If no flash found (eg., new Mac desktops), HTML5 audio will now be tried. Make `hasPriority` actually work (d'oh!)

  - Bug fixes

    - HTML5: `_resetProperties()` when setting Audio().src, fix sound1.play() -> sound2.play() -> sound1.play() case on iOS 4.1 not correctly re-assigning original sound URL (related to global audio object.)
    - HTML5 audio: If no flash, try forcing `useHTML5Audio = true` (eg. desktop safari on new Macs which don't come with Flash.) Related: flash detection code tweak.
    - Improved _iO vs. old _iO URL comparison, rather than .src which gets translated from local paths to file:// etc.
    - Correctly trash instanceOptions (and _iO) before calling onfinish(), but maintain local copy of onfinish() so it still works. Fix play({onfinish:this.play}) bug where _iO was being incorrectly remembered.
    - Flash 9/movieStar: `setPosition()` unpause hack for everyone, not just Webkit (via 8tracks dudes, reported now in Firefox? Should not cause regressions.)
    - Special wmode tweak for reports of SM2 start-up failures, may be admin/non-admin account related, IE 8-only on Windows 7 (possibly Vista, too?) as of late January, 2011.
    - Apply `hasPriority` to object/embed, not its style. D'oh. :P
    - HTML5: use new Audio(null) vs new Audio(), Opera 9.64 expects URL argument; throws WRONG_ARGUMENTS_ERR otherwise. Doesn't implement canPlayType() either, but both are fixed in future releases.

  - Miscellaneous

    - Don't actually apply new value in `setPosition()` if a sound has not yet loaded (and if so, hasn't errored out.)
    - isNaN() check for HTML5 loading (saw one under Safari, in testing).
    - Added CLSID and codebase attributes for IE `<object>` (same as used in SWFObject), just to be safe.
    - Removed some HTML5 debug bits, unused _HTML5_states/codes block.
    - Flashblock CSS: Correctly hide the SWF via left/top:-9999em when it hits `.swf_loaded {}`, ie., never blocked in the first place. Minor flashblock regression fixes after .swf_loaded / .swf_unblocked changes with last release.
    - Ant build script parameter change, now uses .build.properties file (related pull request)

- ### V2.97a.20110123 - HTML5 audio improvements for desktop + mobile (iOS), 360° UI demo tweaks (Download archived version)

  Tweaks to HTML5 features, "mixed-mode" HTML5 + flash cases, desktop and iOS tweaks. Improved sound re-use and "play-through" on iOS (believed previously working, may have regressed with iOS 4.2.1.) Code clean-up and shuffling of homepage, 360° demo (jslinted and improved functionality), `load({options})` fix, better handling of broken Safari/Snow Leopard audio case.

  - Bug fixes

    - Fix for `soundManager.load({options})` / `SMSound.load({options})`-specific case (regular `load()` sans-parameters was fine), where `load({onload:...})` would fail if a URL parameter was not specified. `load({url:...,onload:...})` was OK. If unspecified, load now takes URL from SMSound.url.
    - Fixed unload/replay case on iOS: play sound #1, interrupt it by starting sound #2, then play sound #1 again - previously, #1 would fail on replay due to interrupted state since iOS only allows one sound at a time. Should now restart OK. (This applies to the new `soundManager.useGlobalHTML5Audio` stuff.) Playlist auto-advance looks to be OK as well.

  - API Updates

    - New (experimental) `soundManager.useGlobalHTML5Audio` property - if true (default for iOS/mobile), reuses a single `Audio()` object for loading sound. Helps make playlist / `onfinish()`->`play()` work on iOS without user interaction.
    - New (experimental) `soundManager.requireFlash` property (default: false.) If true, prevents HTML5-only mode on devices with both HTML5 and Flash. May be useful when HTML5 is enabled (and can play MP3), but Flash is desired to play RTMP content etc. As of this version, will only use Flash for RTMP.
    - HTML5: Fix for `type:'audio/mp3'` returning false on `canPlay()`. Timer update-while-paused tweak.
    - HTML5: More event listeners, ignore events on destroyed sounds, improved event clean-up, "seek before load" fix

  - Miscellaneous

    - Improved broken Safari/Snow Leopard HTML5 audio situation: HTML5 mode is no longer disabled - and if available, Flash is used to play MP3/MP4 content to work around known playback issues with native HTML5 audio.
    - (Finally) report "true" position of MovieStar (MPEG4/AAC) content while scrubbing a playing/paused sound. Previously did not fire updates while scrubbing. Imperfect on resume due to buffer, but should be negligible and an improvement vs. old behaviour.
    - 360° player refresh, works with multiple types (eg. small 48x48 square vs. large 256x256 square w/spectrum + EQ visualizations) on the same page now. Can play and seek simultaneously, as well. More configurable. Removed old empty.gif + imageRoot junk. Core JS now appeases the jslint gods.
    - Code clean-up, removed undocumented/experimental `playOnSeek` and related methods from a prior fork.
    - Fresh homepage demo design/layout, should be nicer for new users.

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

  `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, RTMP features, 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. RTMP 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

  - 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 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