• Sep 17, 2012


    V2.97a.20120916 - Inline, deferred and lazy-load init improvements, H…
    …TML5 format / detection improvements, "re-use" load/play URL fix.
        API Updates
            Init improvement: Don't fail if Flash URL is null in normal include + init case. Instead, show note in debug input and wait for soundManager.setup() with url param, then treat as delayed init case. Improved experience if including <script>, then trying to do setup() after DOM Ready (common jQuery case).
            soundManager.setup({url:...}) + lazy-loading (dynamically-loaded JS) case: If setup() given url parameter after DOMContentLoaded has fired, assume we should start right away. (Helps reduce need for beginDelayedInit() + "just works" for most users)
            Don't init inline after document.readyState === 'complete' (improve lazy-loading case, wait for setup() with url: instead)
        Bug fixes
            Fix 'audio/mpeg' canPlay() checks, was incorrectly returning false due to audio/mpeg; codecs="mp3" working and preventing audio/mpeg from being checked.
            More paranoid Audio() handling for "bad" Opera (< 10) where new Audio() would throw not_enough_arguments (always required URL).
            Safer HTML5 duration checks - null now assigned instead of undefined.
            Improve durationEstimate under HTML5 during whileloading().
            Flash 9/RTMP: Actually provide caption data to oncaptiondata().
            Fix SMSound.play({url:...}) "re-use" case where new URL wasn't being assigned + loaded right away, and SMSound.url property was not being updated.
            Correct load() and play() with new URL parameter, so that subsequent play() call uses new URL (and not URL assigned with original createSound() call).
            Use seconds for SMSound.buffered (time ranges) whether HTML5 or Flash, since SM2 API uses seconds for setPosition() etc.
            Correct play() -> pause() -> setPosition(0) -> play() -> pause() case where the latter wasn't firing due to invalid state.
            New Cassette Tape UI Prototype/demo (experimental).
            Tweaked documentation layout for legibility. Webfont (deja vu sans mono) from dejavu-fonts.org for code examples.
            Improved lazy-load / deferred example based on new setup() logic
            Added SMSound.buffered documentation
            Added m4b extension as an mp4 format
            Safer initial HTML5 support checks
  • Jun 25, 2012


    V2.97a.20120624 - New soundManager.setup() method, numerous HTML5 imp…
    …rovements for createSound(), load(), progress and reuse cases, and minor flash audio bug fixes
        API: New sugar-like stuff
            New soundManager.setup() mixin-style method for assigning properties and common start-up callbacks. Collects top-level soundManager configuration properties and object collections - onready, ontimeout, defaultOptions, flash9Options and movieStarOptions - under a single method call.
            Upgrade / legacy note: This is a modern replacement for the direct property assignment method used in all previous versions - eg., soundManager.url = '/swfs/' - the old method continues to work for legacy support, but you should migrate to using the new method as it's much cleaner. All included demos use the new method where applicable.
            New soundManager.setup() method example
              // required
              url: '/path/to/swfs/',
              // optional
              flashVersion: 9,
              // convenience
              onready: function() {
                console.log('Ready to play sound!');
              ontimeout: function() {
                console.log('SM2 start-up failed.');
              // more custom parameters
              defaultOptions: {
                volume: 50
            See soundManager.setup() for details.
        Bug fixes
            Improve HTML5 audio load/playback reliability + stability on iOS, and for object reuse cases (play() -> load({url: ...}). Prior behaviour was making initial HTTP request when object was created (meta/preload, not necessarily loading entire file.) Request now only happens with preload/load/play-related calls.
            HTML5: Firefox seems to have changed when unloading HTML5 audio, url = '' now loads hosting page HTML (boo) instead of null / no request. Changed to about:blank like everyone else. Also fixed boolean logic on isMovieStar assignment.
            Add audio/mp3 and related MIME checks for flash, correct edge case where play({type:'audio/mp3'}) would use HTML5 when preferFlash = true, due to seeming lack of Flash support for the MIME type.
            Fixed old Flash 8 onload() edge case where loading from cache might return incorrect didLoad: false result - corrected by checking for a non-zero sound duration.
            Properly reset SMSound.id3 = {} with internal resetProperty and public methods like load().
            Edge case fix: Don't attempt to remove flash unless reference exists (prevent false warning when reboot() called in 100% HTML5 mode.)
            Correct empty options JS error on internal _setup_html5() when reusing HTML5 audio object per V2.97a.20120527 bug report
            Fix minor false positive (undocumented error handler case) with HTML5 play() falsely reporting 32-sound ceiling edge case and calling SMSound.onplayerror() (if assigned) when using flashVersion = 9. Should only apply when flash 9 is being used for playback, and ceiling hit.
            Finally assign + use SMSound.id (instead of sID), matching createSound({id: 'foo'}) pattern; maintain legacy sID property (ancient behaviour, originally intended to avoid potential namespace conflicts many years ago - now silly and not a concern.)
            Improved handling of whileloading() vs. HTML5 onload (when using HTTP range/partial requests).
            HTML5 onload() (now triggered via native canplaythrough event) may fire early, followed by numerous HTML5 progress requests during playback as the audio object requests and buffers more audio ranges (eg., 0-10 seconds), eventually matching the total sound duration.
            Bytes loaded / total are not available, so bytesLoaded instead reflects a fraction of "duration loaded", between 0 and 1 as data is buffered in. Previously, whileloading events would not fire once onload had fired under HTML5.
            New (undocumented, for now) buffered array on SMSound objects; list of objects following the pattern SMSound.buffered = [{ start: 0, end: 706 }] representing loaded time ranges (somewhat similar to HTML5 TimeRanges spec, but using static properties instead of method calls with an index parameter.) Array will initially be empty, zero-length. This can be looped through to show overlays of "loaded" time fragments on progress bars, for example.
            SMSound buffered is updated during whileloading() calls, where values are provided by the browser. For flash, will always be one item with { start: 0, end: SMSound.duration } assigned. Also stopped sending 1/1 values to whileplaying() at onload(), since HTML5 can fire onload() (via canplaythrough) very early followed by many progress (whileloading()) events.
            Support note: Not all browsers (eg., Safari 5.1.7) appear to provide buffer / TimeRanges data for HTML5 audio objects. At time of writing (06/2012), Firefox, Chrome Canary, IE 9 and Opera provide TimeRanges alongside progress events.
            Upgraded demos to use to soundManager.setup({...}) for most configuration cases (vs. setting soundManager.url, soundManager.defaultOptions.autoLoad directly etc.)
            Warn if soundManager.setup() called with url or flashVersion, and init has already fired (ie., flash options already set + movie already loaded) where changes will not take effect until soundManager.reboot().
            Assign top-level soundManager properties (eg. soundManager.url) from soundManager.setupOptions at DOMReady time; this allows legacy soundManager.url = ... assignment to work, and helps to ensure legacy-style, directly-assigned top-level property values get written back to soundManager.setupOptions.
  • May 27, 2012


    V2.97a.20120527 - Fix for ontimeout() regression. GWT/JSNI compatibil…
    …ity, slow connection and Safari "background tab" SWF load handling improvements
        Bug fixes
            Fix for ontimeout() regression seen when using lazy-loading / SM2_DEFER introduced with V2.97a.20120513; bug introduced when making edits to pass newer jslint rules regarding return within if...else blocks.
            Replaced instanceof Function with "safer" typeof x === 'function' for onready(), ontimeout() and related callback argument checks as GWT + JSNI was passing arguments that failed the instanceof check. (Related bug report.)
            Corrected another small regression for the ontimeout() -> onready() "recovery" edge case, ensuring "ready" does not fire after a timeout when init was unsuccessful.
            Improved handling for special Safari page load case: When a new tab is opened that does not have focus, the Flash SWF does not load/init until the tab is brought to the foreground. SM2 now recognizes this special case and waits until window.onfocus() before attempting to do the JS/Flash part of init. Previously, it would fail with a timeout.
            Code written to originally handle Safari 3.1, which did not support document.hasFocus(), was modified and updated for this purpose. The Safari 3.1 logic previously deferred SM2's start-up in a similar fashion. (The old Safari 3.1 mousemove() focus-detection hack has been removed as Safari 4 has been out since mid-2009, and Safari 5 since mid-2010.)
            SM2 init process will now delay and retry if no Flash response, and SWF has loaded > 0 and < 100%. Timeout will now happen only after delay and when SWF has loaded 100%. Should help prevent first-visit (non-cached) failure on very slow or laggy connections.
            Added note about potential Firefox regression: Offline JS/Flash start-up (viewing HTML pages via file:// and/or c:/ and so forth), possibly not working as of Firefox 9 and newer (at time of writing, also up to and including Firefox 12), even despite special security whitelisting under Flash Player "trusted locations" preferences / control panel.
            After successful Flash -> JS call, SM2's "return" JS -> Flash call fails with unusual JS/Flash exception, "Error in ActionScript" error with no further detail. Offline viewing still works in other browsers.
  • May 14, 2012


    V2.97a.20120513 - Fixes for Android 2.3 playback, onPosition() in HTM…
    …L5, Flash 9 double-play edge case. Minor new Flash 9-specific features.
        Bug fixes
            Android 2.3 playback fix (some sounds started only after 2+ play attempts due to Android not liking load() immediately followed by play()?)
            onPosition() fix for HTML5 playback, items were mistakenly being removed.
            Fix RTMP stream duration reporting via onmetadata() (wrong value was being returned, previously.)
            Fix for Flash 9 double-play edge case found with pause() + setPosition() calls.
            JSLINT validation per 04-15-2012 edition rules, mostly removal of multiple return statements within if ... else blocks and inverted loop tricks.
        API updates
            Enabled waveform/eq/spectrum data features for MovieStar (H.264/NetStream content.)
            Added oncaptiondata() callback for caption data from Flash 9 (NetStream/RTMP-only, similar to onmetadata(). Contributor: GitHub user karma.)
            Added SMSound.onplayerror(), presently for Flash 9 (non-MovieStar/NetStream) which can detect lack of available sound hardware or 32-channel ceiling as reasons for playback failure.
            Added oncaptiondata() callback for caption data from Flash 9 (NetStream/RTMP-only, similar to onmetadata().)
            Scaling added to 360 UI (via GitHub user tomasdev)
  • Mar 19, 2012


    V2.97a.20120318 - Minor updates. from / to and onplay() bug fixes, ca…
    …nPlayMIME() 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.
            The SoundManager project turned 10 years old, having originally launched in late 2001. Thanks for using it!
  • Dec 20, 2011


    V2.97a.20111220 - HTML5 src/onload()/onstop() fixes, new HTML5 pollin…
    …g, onPosition() updates, "audio sprites" (from/to) and multiple URL support. (Also: New homepage design!)
    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.)
            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.
  • Oct 30, 2011


    V2.97a.20111030 - HTML5 unload() improvements, Android 2.3 fix and ne…
    …w onsuspend() event
    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.
            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
  • Sep 18, 2011


    V2.97a.20110918 - Code clean-up, improved comments and formatting, ge…
    …nerated documentation, polling and onbefore- removal, HTML5 stop()/unload() fixes
    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.
              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.
            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.)
  • Jul 31, 2011


    V2.97a.20110801 - "100% HTML5 mode" desktop browser (+no flash) fix, …
    …useHTML5Audio enabled by default, flash 9 end-of-sound correction, ClickToFlash improvements
    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.
            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
  • Jul 7, 2011


    V2.97a.20110706 - improved HTML5/flash "mixed mode" via preferFlash, …
    …Safari + Snow Leopard HTML5 audio bug update, better ClickToFlash compatibility, minor demo tweaks
    Special note: This was V2.97a.20110705, but the latest Flex SDK ( 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, 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.
            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.