V2.97a.20110918 - Code clean-up, improved comments and formatting, generated 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. 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.)