From 753f60c7d4769fa72d3b910e491f37db6f130898 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:19:21 -0500 Subject: dymaxion --- .../doc/download/index.html | 1041 ++++++++++++ .../doc/getstarted/index.html | 549 +++++++ .../soundmanagerv297a-20101010/doc/index.html | 1667 ++++++++++++++++++++ .../doc/resources/index.html | 239 +++ .../doc/technotes/index.html | 305 ++++ 5 files changed, 3801 insertions(+) create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/doc/download/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/doc/getstarted/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/doc/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/doc/resources/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/doc/technotes/index.html (limited to 'docs/dymaxion/soundmanagerv297a-20101010/doc') diff --git a/docs/dymaxion/soundmanagerv297a-20101010/doc/download/index.html b/docs/dymaxion/soundmanagerv297a-20101010/doc/download/index.html new file mode 100755 index 0000000..67a6b14 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/doc/download/index.html @@ -0,0 +1,1041 @@ + + + +SoundManager 2: Download + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+
+
+ +
+
+
+ +
+ +
+ +
+

Get SoundManager 2

+

Get the latest and greatest.

+
+ +
+

Download SoundManager 2

+

Code cleanup (full debug codebase ~5% lighter), HTML5 audio tweaks, merged RTMP fork from GitHub, experimental video feature removed, optional crossdomain.xml feature. See revision history for details.

+ +

Download SoundManager 2.97a.20101010

+

Also on Github (dev branches, forks etc.): http://github.com/scottschiller/SoundManager2

+

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

+
+ +
+ + +
+ +
+

Revision History

+

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

+
+ +
+ +
+ +

Revision History

+ +

A changelog of sorts.

+ +
    + +
  • +

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

    +

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

    + +
      + +
    • +

      Bug fixes

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

      Merged: RTMP Fork

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

      API Updates

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

      Miscellaneous

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

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

    +

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

    + +
      + +
    • +

      Bug fixes

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

      API Updates

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

      Miscellaneous

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

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

    + +

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

    + +
      + +
    • +

      Bug fixes

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

      Miscellaneous

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

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

    + +

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

    + +
      + +
    • +

      API Updates

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

      Bug fixes

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

      Miscellaneous

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

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

    + +

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

    + +
      + +
    • +

      API Updates

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

      Bug fixes

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

      Miscellaneous

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

    V2.95b.20100323 (Download archived version)

    +

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

    + +
      + +
    • +

      API Updates

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

      Bug fixes

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

      Miscellaneous

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

    V2.95b.20100101 (Download archived version)

    +

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

    + +
      + +
    • +

      API Updates

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

      Bug fixes

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

      Miscellaneous

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

    V2.95a.20090717 (Download archived version)

    +

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

    + +
      + +
    • +

      API Updates

      +
        +
      • New soundManager.onready(myFunction[,scope]) method, for asynchronous queueing of onload()-style handlers. Fires when SM2 has finished initializing. 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

    +
  • + +
+ + + +
+ +
+ +
+ + +
+ + + + +
+ + + +
+ + + +
+ +
+ + +
+ + +
+ + + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/doc/getstarted/index.html b/docs/dymaxion/soundmanagerv297a-20101010/doc/getstarted/index.html new file mode 100755 index 0000000..9f096af --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/doc/getstarted/index.html @@ -0,0 +1,549 @@ + + + +SoundManager 2 Tutorial: Getting Started + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+
+

How SoundManager Works

+

It starts out easy, but you can go down the rabbit hole if you want.

+
+ +
+ +
+ + + +

SoundManager 2 Tutorial: What, Why, How

+ +

Problem: Browsers lack good, consistent native audio support. (HTML 5's Audio() is the future, but does not have majority support yet.)

+

Solution: Javascript API via Flash + ExternalInterface, works almost everywhere. If HTML5 audio support is enabled, flash fallback used for browsers that don't support "non-free" MP3 + MP4 formats.

+

SoundManager 2 wraps and extends both the Flash and HTML Audio Sound APIs, providing a single, unified sound API to Javascript; the API is the same, whether HTML or Flash is ultimately used to play sound. (The flash portion is hidden, transparent to both developers and end users.)

+ +
+ +
+ + +

Including SoundManager

+ +

The soundmanager2.js core can get down to 10 KB over the wire, depending on what version you use. A few versions of the SM2 script are available, balancing code size between commented, debug-enabled and production-optimized builds.

+

Regardless of which build you use, take advantage of gzip compression on your server for big savings. As shown below, SoundManager 2 compresses quite well with gzip; the full debug-enabled version served with gzip is smaller than even the minified, no-debug version served without it.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Build versionRecommended useFile size+ gzip
+

Original, formatted debug-enabled version with comments. Passes jslint.

+
<script src="soundmanager2.js"></script>
+
Development, testing, debugging90 KB~25 KB
+

Minified (Google Closure Compiler-munged, no comments or whitespace), debug-enabled version

+
<script src="soundmanager2-jsmin.js"></script>
+
Production, with debug code42 KB~14 KB
+

Build-script optimized, minified, no-debug version

+
<script src="soundmanager2-nodebug-jsmin.js"></script>
+
Production-optimized, debug code removed30 KB~9.5 KB!
+ +

You then need to tell SM2 where to find the flash .SWF it will need (if no HTML5 support), and optionally what version of Flash (~3 KB for flash 8, ~10 KB for flash 9) depending on what API features you want, as well as other features:

+ +
+<script>
+soundManager.url = '/path/to/swf-files/';
+soundManager.flashVersion = 9; // optional: shiny features (default = 8)
+soundManager.useFlashBlock = false; // optionally, enable when you're ready to dive in
+// enable HTML5 audio support, if you're feeling adventurous. iPad/iPhone will always get this.
+// soundManager.useHTML5Audio = true;
+</script>
+ +

If you plan to eventually use the flash block handling feature (disabled in this example), you'll want to look at the flash block demo and include the relevant CSS it uses.

+ + + +

Basic SoundManager Template

+ +

For a live example of a page including SoundManager 2, check the bare-bones template.

+ +

SoundManager File Structure

+

Or, "What you get when you download SM2."

+

The core audio API bits require script/soundmanager2.js and the SWF files swf/soundmanager2.swf and swf/soundmanager2_flash9.swf, as well as the _debug versions of the SWFs. The flash 9 SWF enables some extra API features, and is only used if you set soundManager.flashVersion = 9 (the default is 8.)

+ +
    +
  • + soundmanager2/ +
      +
    • + demo/ - Examples, MP3 player UIs etc. +
    • +
    • + doc/ - API method documentation, notes, troubleshooting +
    • +
    • + script/ - API core, soundmanager2.js +
    • +
    • + src/ - AS2/AS3 Flash source used to build SWFs (for flash development) +
    • +
    • + swf/ - API core, SoundManager 2 .SWF files +
    • +
    • + troubleshoot/ - Tool for finding/fixing startup issues +
    • +
    +
  • +
+ +

How SoundManager 2 Really Works

+ +

SoundManager 2 is the result of Javascript talking to a hidden Flash movie. The Flash layer is not something you have to work with directly, but it is the component which makes audio control possible behind the scenes.

+ +
+ +
+ soundmanager2.js <-flash externalinterface magic-> soundmanager2.swf <- HTTP -> .mp3/.mp4 +
+ +
+ +

Flash can expose methods to Javascript via ExternalInterface, allowing bi-directional calls to be made and thus providing additional functionality to Javascript.

+ +

For the real gory details on the behind-the-scenes action of JS + Flash, see How SoundManager 2 Works on schillmania.com.

+ + +
+ +
+ +

Startup / Initialization

+ +

In brief, here is now SM2 starts up:

+
    +
  • soundmanager2.js loads
  • +
  • new SoundManager() constructor call, event listeners attached for dom ready/init
  • +
  • document.createElement('embed') (or 'object' for IE), append Flash .SWF to document
  • +
  • SWF loads, Flash makes call to JS function: "Hi, JS!"
  • +
  • JS -> Flash test (JS calls Flash function): "Hello, Flash!"
  • +
  • -- startup is complete, soundManager.onready() fires --
  • +
+ +

A single Javascript include will link in all of the required code for the library, which will automatically begin loading either at onDOMContentLoaded() if supported, or alternately, after window.onload() (eg., IE 6 and others.) The default behaviour is to start "as soon as possible", but the library can be configured to wait for window.onload() in all cases as well. Loading and initialisation are separate events.

+ +

Once initialised, SM2 will call event handlers/listeners registered via soundManager.onready(). There are also "old-skool" onload()/onerror() event handlers which you can define just as you would with window.onload().

+ +

If you want to lazy-load or defer SM2, see Lazy-loading and SM2_DEFER.

+ +

SoundManager onready/onload/onerror Event Handlers

+ +

onready() is the most flexible and can be used to queue numerous listeners for SM2's start-up. It is a single handler for completion of start-up. Simply pass a callback function, and check soundManager.supported() to know whether sound is available or not:

+ +
soundManager.onready(function() {
+  if (soundManager.supported()) {
+    // SM2 is ready to go!
+    makeSomeNoise(); // soundManager.createSound(), etc.
+  } else {
+    // unsupported/error case
+  }
+});
+ +

The above example is simplified, slightly; onready() also passes an object literal parameter to your handler that indicates success/fail, so you can check state without having to use soundManager.supported(). For more examples and detail, see soundManager.onready().

+ +

SoundManager onload() + onerror()

+ +

A more traditional, less-flexible style of event handling is to assign single onload() / onerror() handlers. You should use onready() as it can be assigned at any time once soundManager has been defined, and is more robust.

+ +
soundManager.onload = function() {
+  // SM2 is ready to go!
+  makeSomeNoise(); // soundManager.createSound(), etc.
+}
+
+soundManager.onerror = function() {
+  // SM2 could not start, no sound support, something broke etc. Handle gracefully.
+  disableSoundInMyApp(); // for example
+}
+ +

Lazy-loading SM2 (deferred start-up): SM2_DEFER

+ +

Let's say you wanted to load and start SM2 after your page has loaded, using Javascript to insert a script node etc., or otherwise only start SM2 conditionally. You can edit soundmanager2.js and take out the SoundManager() constructor call at the bottom, or set the global variable SM2_DEFER = true which will have the same effect.

+

Example:

+ +
function lazy_load_sm2() {
+  window.SM2_DEFER = true;
+  // -- load soundmanager2.js via <script>, createElement('script') or XHR etc. --
+  // imaginary load_script() function ..
+  load_script('/path/to/soundmanager2.js', function() {
+    // once soundmanager2.js has loaded and has parsed, construct + init.
+    window.soundManager = new SoundManager(); // Flash expects window.soundManager.
+    soundManager.beginDelayedInit(); // start SM2 init.
+  });
+}
+ +

For a live demo, check out the deferred loading example.

+ +
+ + +
+ +
+ +
+ +
+

Sound Options Object Format

+

Object Literal, JSON-style data passed to createSound() and play()

+
+ +
+ +
+ +

Object Literal Format

+ +

Sounds can be created with instance-specific parameters in an object literal (JSON-style) format, where omitted parameters inherit default values as defined in soundManager.

+ +
soundManager.createSound({
+  id: 'mySound',
+  url: '/path/to/some.mp3',
+  autoLoad: true,
+  autoPlay: false,
+  onload: function() {
+    alert('The sound '+this.sID+' loaded!');
+  },
+  volume: 50
+});
+ +

This object can also be passed as an optional argument to the play method, overriding options set at creation time.

+ +

For a full list of available options, see Sound Properties Object

+ +
+ + +
+ +
+ +
+
+

"Use Responsibly"

+

Only you can prevent audio pollution?

+
+ +
+ +
+ +

A Word Of Vice

+

Not every button, link, element or paragraph on the web needs to zoom, move, change colour and be noisy, repetitive and annoying all at the same time. Use your own discretion!

+

Sites which automatically start playing background sound, and/or don't have volume or mute controls are the kind of things you should avoid building. As a developer, gentle reader, you may eventually find yourself in such a situation. Please do your part in enhancing the web with sound if you use SM2, while at the same time keeping it audibly usable. :)

+ +
+ +
+ +
+ +
+ +
+

Troubleshooting

+

Console-style messaging, useful for troubleshooting start-up and runtime issues.

+
+ +
+ +

SoundManager 2 Start-up and Debug Tools

+

This troubleshooting tool can come in handy for debugging SM2 start-up problems.

+ +

Flash options: Flash 8 (default), Flash 9 (normal) or Flash 9 + highPerformance + fastPolling modes.

+ +
+
    + +
  • +

    OKFAILN/AUnknownSoundManager 2 start-up

    +
    +

    soundManager.onload() or soundManager.onerror() is ultimately called when start-up completes.

    +

    If you're seeing a failure, refer to the below for troubleshooting details for common causes.

    +
    +
  • + +
  • +

    OKErrorN/AUnknownFlash

    +
    +

    The Flash 8 plugin is a minimal requirement for SoundManager 2, but the exact requirement varies based on soundManager.flashVersion. You are currently using [unknown].

    +
    +
  • + +
  • +

    OKErrorN/AUnknownFlash SWF

    +
    +

    SoundManager 2 must load a flash movie before initialisation can proceed. If you have errors here, check that soundManager.url is correctly defined and that the URL being loaded is correct.

    +

    If the Flash movie URL is OK, Flash security or flash blockers are the likely cause. Check the section below.

    +
    +
  • + +
  • +

    OKErrorN/AUnknownFlash -> JS

    +
    +

    Once the flash component of SM2 has loaded, it tries to make a call to Javascript-land. This is a common point of failure, for security reasons.

    +
      +
    • +

      Have a flash blocker? Check that the SM2 flash movie (below) is loading and is not being blocked.

      +
    • +
    • + First time opening SM2 after downloading it? Is your browser URL at file:// or c:/path/ or otherwise not using HTTP? Flash security "whitelisting" is required to allow Flash + JS to work when offline, placing it in the "LocalTrusted" Flash security sandbox rather than "localWithFile". + +
      +

      Offline viewing: Adding a "trusted location" to the Flash Security Settings Panel

      +

      The Flash Player Global Security Settings Panel is a web-based control panel which allows you to configure Flash security. You will need to add the path of the SoundManager 2 project in order for it to work "offline" (ie., when viewing via file:// or c:/)

      +

      Show me how: Adding a "trusted location"

      + +

      Launch the Flash Security Settings Panel

      +
      + +
    • +
    • Flash blockers (FlashBlock, "click to flash" etc.) preventing flash load and start-up - need whitelisting/"allow this domain" to work smoothly. If you suspect blocking is the issue, try the SoundManager 2 Flashblock demo.
    • +
    • Online viewing (HTTP/S): Same-domain security rules apply to HTML + Flash content by default (crossdomain.xml/allowDomain() in .AS source required to override.)
    • +
    +

    See Flash debug output for more security error details.

    + +
    +

    Online viewing: Cross-domain security restrictions

    +

    HTML page on domain A loading .SWF from domain B: Flash security prevents JS + Flash when a cross-domain XML permission file is not available on domain B, and/or flash movie was not compiled with allowDomain('domainA') or allowDomain('*') - note that the SWF distributed with SM2 does not use this by default; try using the cross-domain version of the SWF, or compile your own which whitelists your own domain(s).

    + +

    Flash Blockers

    +

    Browser extensions/add-ons like "FlashBlock" and "click to flash" can prevent the .SWF from loading, and this will mean SM2 will time-out and fail waiting for a response from Flash. For development, it's best to whitelist the domain(s) or the .SWF for SM2 to allow it to work.

    +

    Have a flash blocker installed? Want to test it? Try the SoundManager 2 Flashblock demo.

    + +
    + +
    +
  • + +
  • +

    OKErrorN/AUnknownJS -> Flash

    +
    +

    At this point, Javascript attempts to respond to Flash's initial outgoing Flash -> JS call, completing the test for JS/flash communication. If SM2 does not receive a response from flash, it will eventually fail.

    +

    Offline viewing conditions and cross-domain security rules will prevent Flash <-> JS communication. See the details of Flash -> JS for information.

    +
    +
  • + +
  • +

    OKErrorN/AUnknownSound test

    +
    +

    Here, a simple createSound() call is made to test SM2's actual operation. A sound should load and play provided SM2 was able to start successfully.

    +
    +
  • + +
+
+ +

Flash detection code from Flash Detect (featureblend.com)

+ +

Flash Movie Debug Output

+

When soundManager.debugFlash = true, Flash will write debug info as text to the flash movie. This can be helpful for troubleshooting Flash/JS issues when timeouts or security errors are involved which prevent Flash from talking to Javascript, potentially hiding useful debug information. A CSS class of flash_debug will also be appended to the Flash #sm2-container DIV element when enabled, if you wish to style it differently.

+

You can also specify ?debug=1 in the URL to the SWF, and it will write debug output. Try soundmanager2_debug.swf?debug=1, or soundmanager2_flash9_debug.swf?debug=1. + +

+ +
+ +

Live Debug Output

+

SoundManager 2 relies on Javascript and Flash communicating via ExternalInterface, and this is subject to a number of timing, loading and browser security conditions. Because of this complexity, debug information is essential for troubleshooting start-up, loading, initialization and error conditions between Flash and Javascript.

+

With debug mode enabled via soundManager.debugMode = true, SM2 can write helpful troubleshooting information to javascript console.log()-style interfaces. Additionally, output can be written to an optional DIV element with the ID of "soundmanager-debug".

+

If loading from the local filesystem (offline eg. file://, not over HTTP), Flash security is likely preventing SM2 from talking to Javascript. You will need to add this project's directory to the trusted locations in the Flash global security settings panel, or simply view this page over HTTP.

+

Below is a live example of debug output.

+
+
+ +
+
+

For more examples of live debug output, see the Basic Template, API demo and other demos in the top navigation.

+ +

Standalone version of troubleshooting tool

+

For debugging your development/production environment with this widget, see the troubleshooting subdirectory of the SoundManager 2 package.

+ +
+ +
+ +
+ + + + +
+ +
+ + + +
+ +
+ + +
+ + +
+ + + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/doc/index.html b/docs/dymaxion/soundmanagerv297a-20101010/doc/index.html new file mode 100755 index 0000000..9411539 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/doc/index.html @@ -0,0 +1,1667 @@ + + + +SoundManager 2: Documentation + + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+
+
+ +
+
+
+ +
+ +
+
+

SoundManager Configuration

+

Flash URLs, version + performance options

+
+
+ +

SoundManager Properties

+ +
+ +

SoundManager has properties which configure debug mode, flash movie path and other behaviours. At minimum, the soundManager.url property must be assigned a path used to look for the necessary flash movie.

+ +
allowPolling = true;     // enable flash status updates. Required for whileloading/whileplaying.
+consoleOnly = false;     // if console is being used, do not create/write to #soundmanager-debug
+debugMode = true;        // enable debugging output (div#soundmanager-debug, OR console..)
+debugFlash = false;      // enable debugging output inside SWF, troubleshoot Flash/browser issues
+flashLoadTimeout = 1000; // ms to wait for flash movie to load before failing (0 = infinity)
+flashVersion = 8;        // version of flash to require, either 8 or 9. Some features require 9.
+nullURL = 'about:blank'; // (Flash 8 only): URL of silent/blank MP3 for unloading/stop request.
+url = '/path/to/swfs/';  // path (directory) where SM2 .SWF files will be found.
+useConsole = true;       // use firebug/safari console.log()-type debug console if available
+useMovieStar = true;     // enable Flash 9.0r115+ MPEG4 audio support
+useFastPolling = false;  // fast timer=higher callback frequency, combine w/useHighPerformance
+useHighPerformance = false;// position:fixed flash movie for faster JS/flash callbacks
+waitForWindowLoad = false; // always delay soundManager.onload() until after window.onload()
+wmode = 'transparent';     // null, transparent, opaque (last two allow HTML on top of flash)
+allowScriptAccess = 'always'; // for scripting SWF (object/embed prop.), 'always' or 'sameDomain'
+useFlashBlock = true;      // better handling of SWF if load fails, let user unblock. See demo.
+useHTML5Audio = false;     // beta feature: Use HTML5 Audio() where supported.
+
+

To modify global SoundManager default parameters for SM2 itself or for all sound objects, edit the main soundmanager2.js file (look for above section in code) or assign new values in your own application script before either onDOMContentLoaded() or window.onload() fire. (Specifically, both external and inline script blocks which immediately execute are OK.)

+

Example per-application override:

+
soundManager.debugMode = false;          // disable debug mode
+soundManager.defaultOptions.volume = 33; // set global default volume for all sound objects
+
+ +
+ +
+

soundManager.debugMode

+

soundManager.debugMode configures SM2's debug behaviour, enabled (true) by default. When enabled, SoundManager 2 will write console-like output to console.log()-style javascript interfaces, and/or an HTML element with the ID soundmanager-debug (will be created if not found in the DOM at runtime.)

+

For a live example of debug output, see Debug + Console Output.

+
+ +
+

soundManager.debugFlash

+

soundManager.debugFlash configures SM2's flash debugging output, disabled (false) by default. When enabled, the Flash portion of SM2 will write debug statements within the Flash movie. This can be useful for troubleshooting Flash/JS/browser (ExternalInterface) issues and so on.

+

A CSS class of flash_debug will also be appended to the Flash #sm2-container DIV element when enabled, if you wish to style it differently.

+

For a live example, see Flash Movie Debug Output in the Troubleshooting section.

+
+ +
+

soundManager.url

+

soundManager.url specifies the "online", generally HTTP-based path which SM2 will load .SWF movies from. The "local" (current) directory will be used by default. The appropriate .SWF required (depending on the desired Flash version) will be appended to the URL.

+

Example: soundManager.url = '/path/to/swfs/'; (Note trailing slash)

+

For cases where SM2 is being used "offline" in non-HTTP cases (eg., development environments), see altURL.

+
+ +
+

soundManager.altURL

+

soundManager.altURL specifies an alternate path to soundManager.url which SM2 can load its SWF from. It is a simple convenience for when you may need to load SWFs from different paths depending on your hosting environment (eg., offline development vs. production.)

+

Example: soundManager.altURL = '../'; (Load from parent directory - note trailing slash)

+

For altURL to be used, it must be defined and an "alternate environment" condition must be met:

+

soundManager.useAltURL = (!document.location.protocol.match(/http/i));

+

By default and as shown above, SM2 will use this property when the hosting page is not being served over HTTP, and thus is assumed to being served "offline" - for example, when loading via file://, from the local file system.

+

This can easily be adapted to taste, eg., checking the domain matching yourdomain.com vs. localhost:

+

soundManager.useAltURL = (!document.location.match(/mydomain.com/i));

+

If soundManager.altURL is null (the default), soundManager.url will be used for all cases.

+
+ +
+ +

soundManager.flashVersion

+ +

SoundManager 2 started with a Flash 8 base requirement, but can also now use Flash 9 and take advantages of some new features Flash 9 offers. By default Flash 8 will be used, but the version can be easily changed by setting flashVersion appropriately.

+ +

Example: soundManager.flashVersion = 9;

+ +

The Flash 8 version is soundmanager2.swf, and the flash 9 version is soundmanager2_flash9.swf, accordingly. Note that only Flash 8 and Flash 9 are supported at this time; other values will result in errors.

+ +
+ + +
+ +

New Flash 9-only features:

+ +
    +
  • MPEG-4 (HE-AAC/H.264) audio support
  • +
  • True "multi-shot" sound behaviour. play() can be called multiple times, giving a layered, "chorus" effect. Sound will also fire onfinish() multiple times. (Previous behaviour did not layer sounds, but would re-play a single instance.)
  • +
  • waveformData array: 256 waveform data values available while playing sound
  • +
  • eqData array: 256 EQ spectrum data values available while playing sound
  • +
  • peakData object: Left and right channel peak/volume data available while playing sound
  • +
+ +
+ + +
+

soundManager.flashLoadTimeout

+

After initializing the flash component during start-up, SM2 will wait for a defined period of time before timing out and calling soundManager.onerror().

+

The default value is 1000 (msec.) Setting a value of 0 disables the timeout and makes SM2 wait indefinitely for a call from the flash component. If you want to handle flash block-type situations, see soundManager.useFlashBlock.

+

Setting this parameter to 0 may be useful when attempting to gracefully recover from a flashBlock situation, where the user has whitelisted the movie after it was blocked etc.

+

Note that when the timeout is disabled, soundManager will not fire its onerror() handler if there is an error at the flash loading stage.

+
+ +
+

soundManager.useFastPolling

+

By default useFastPolling = false, and thus SoundManager uses a 20-milisecond timer inside Flash when polling for updated sound properties such as bytesLoaded and data and event callbacks eg. whileloading(), whileplaying() and so on. With useFastPolling = true, a 1-msec timer is used and callback frequency may noticeably increase. This is best combined with useHighPerformance for optimal results.

+
+ +
+

soundManager.useHighPerformance

+

Perhaps intuitively, Flash is given higher priority when positioned within the viewable area of the browser, at least 6px in height (oddly), fully-opaque, visible and displayed on the screen. By default, soundManager.useHighPerformance is enabled and should noticeably reduce JS/flash lag and increase the frequency of callbacks such as whileplaying() in some circumstances.

+

soundManager.useHighPerformance = true;

+

This has made a noticeable impact in responsiveness on Mac OS X, and Safari on Windows; animation lag is practically non-existent (see demo). Because setting wmode=transparent and fixed position has been reported to cause some issues, the feature is disabled by default.

+

To be least-obtrusive, SM2 attempts to set position:fixed, and uses bottom/left:0px to stay within view (though using wmode=transparent where possible, to be hidden from view.) It occupies an 8x8px square. If you wish to position the movie yourself or show it inline, have a DIV element with the ID of sm2-container present in the DOM for SM2 to reference and it will write the movie there without positioning.

+
+ +
+

soundManager.useFlashBlock

+

Flash blockers (eg. FlashBlock, "Click To Flash") can prevent the flash portion of SM2 from loading, which will cause a start-up error with a time-out.

+

SM2 historically has kept the flash movie off-screen and out of view, and thus the user could not click on and unblock it. Now with useFlashBlock = true, the movie positioning can be handled by CSS. The initial state is still off-screen by default, but will change to be in view when a blocking (time-out) situation may be encountered. You can also edit the CSS to taste, of course.

+

When starting up, CSS classes are appended to the #sm2-container DIV (which you can provide, or SM2 will create and append to the document.) The CSS classes change with the state of SM2's start-up, eg. #sm2-container.swf_timedout { border:1px solid red; } could be used to highlight the movie to the user for unblocking and so on.

+

Setting useFlashBlock = true will cause SM2 to wait infinitely for the Flash content to load after an initial (non-fatal) timeout, having already waited for flashLoadTimeout to pass. If flashLoadTimeout = 0, SM2 will immediately go into "flash block mode" on start-up.

+

The relevant CSS is as follows:

+
#sm2-container {
+ /* Initial state: position:absolute/off-screen, or left/top:0 */
+}
+#sm2-container.swf_timedout {
+  /* Didn't load before time-out, show to user.
+  Maybe highlight on-screen, red border, etc..? */
+}
+#sm2-container.swf_unblocked {
+  /* Applied if movie loads successfully
+  (flash started, so move off-screen etc.) */
+}
+#sm2-container.swf_error {
+  /* "Fatal" error case: SWF loaded,
+  but SM2 was unable to start for some reason.
+  (Flash security or other error case.) */
+}
+#sm2-container.high_performance {
+  /* Additional modifier for "high performance" mode
+  should apply position:fixed and left/bottom 0 to stay on-screen
+  at all times (better flash performance) */
+}
+#sm2-container.flash_debug {
+  /* Additional modifier for flash debug output mode
+  should use width/height 100% so you can read debug messages */
+}
+ +

For a live example, see the FlashBlock Demo.

+
+ +
+ +

soundManager.useHTML5Audio

+ +

Warning: Beta-ish, in-progress feature; subject to bugs, API changes etc. By default, special check to enable feature for the Apple iPad 3.2+ (which does not support Flash) and Palm Pre, otherwise currently disabled by default. Works on iPhone OS 4.0 / iOS 4.0+.

+

Determines whether HTML5 Audio() support is used to play sound, if available, with Flash as the fallback for playing MP3/MP4 (AAC) formats. Browser support for HTML5 Audio varies, and format support (eg. MP3, MP4/AAC, OGG, WAV) can vary by browser/platform.

+

The SM2 API is effectively transparent, consistent whether using Flash or HTML5 Audio() for sound playback behind the scenes. The HTML5 Audio API is roughly equivalent to the Flash 8 feature set, minus ID3 tag support and a few other items. (Flash 9 features like waveform data etc. are not available.)

+ +
SoundManager 2 + useHTML5Audio: Init Process
+ +

At DOM ready (if useHTML5Audio = true), a test for Audio() is done followed by a series of canPlayType() tests to see if MP3, MP4, WAV and OGG formats are supported. If none of the "required" formats (MP3 + MP4, by default) are supported natively, then Flash is also added as a requirement for SM2 to start.

+

soundManager.audioFormats currently defines the list of formats to check (MP3, MP4 and so on), their possible canPlayType() strings (long story short, it's complicated) and whether or not they are "required" - that is, whether Flash should be loaded if they don't work under HTML5. (Again, only MP3 + MP4 are supported by Flash.) If you had a page solely using OGG, you could make MP3/MP4 non-required, but many browsers would not play them inline.

+

SM2 will indicate its state (HTML 5 support or not, using Flash or not) in console.log()-style debug output messages when debugMode = true.

+ +
"My browser does HTML5, why not MP3"?
+ +

Despite best efforts, some browsers eg. Chrome on Windows may only return "maybe" for Audio().canPlayType('audio/mpeg; codecs=mp3') and variants; by default, SoundManager 2 will only assume a format is supported if a "probably" response is given. You can modify soundManager.html5Test to something like /(probably|maybe)/i if you want to be a bit riskier, but you should consider potential false positives.

+ +

At this time, only Safari and Chrome (excluding Chromium?) support MP3 and MP4 formats. Other browsers have excluded them because MP3 and MP4 are not "free" formats. For these cases, Flash is used as the fallback support for MP3/MP4 as needed.

+ +
Bonus HTML5 formats: OGG, WAV
+ +

WAVe (an old standard) and OGG (a MP3-like codec, except free) are both supported in a majority of browsers via HTML5, so SoundManager 2 will also test for support for these formats. A Flash fallback for these formats has not been implemented.

+ +
Testing audio format support
+ +

Once soundManager.onready() has fired and SM2 has started, you can check for support via a number of methods. Namely, soundManager.canPlayLink() will take an <a> element and check its href and type attributes, if available, for hints as to its format or type. You can also pass arbitrary URLs to soundManager.canPlayURL(), which will make a "best guess" based on the extension it finds. In any event, SM2 will return a true/false value from canPlay methods based on HTML and/or flash capabilities.

+ +

To see what formats are supported by HTML5, watch SM2's debug/console output when debug is enabled, or dump the contents of soundManager.html5 to the console; it will show the results of tests for simple items like "mp3", as well as canPlayType() strings such as 'mpeg; codecs=mp3' + +

Apple iPad, iPhone, Palm Pre: Special Cases
+

The "Big iPhone" doesn't do Flash, and does support HTML5 Audio() pretty decently - so SM2 makes a special exception to enable useHTML5Audio when it detects an iPad, iPhone or Palm Pre user agent string by default. Feel free to disable this if you wish.

+

iPad and iPhone require user interaction to start a sound, eg. the createSound() and play() call should happen within an onclick() handler on a link, etc. The "security" model here seems to be implemented similarly to the way pop-up blockers work. You may "chain" sounds (eg. create and play a new one) provided it is done via the onfinish() event of a sound initiated by a user, however. The Muxtape-style demo on the SM2 homepage uses this, and will advance the playlist on the iPad/iPhone if allowed.

+

iPad 3.2 gets hung up on the "BC quail" HE-AAC example sound for some reason, and endlessly loops it rather than finishing and moving on to the next item. May be an iPad playback bug, as other formats are fine. iPhone OS 4 (iOS 4) does not show this issue.

+

iPhone OS version < 3.1 doesn't work, but 3.1 (and possibly earlier versions, not verified) have a native Audio() object. However, they seem to simply not play sound when play() is called, so SM2 looks for and ignores the iPhone with these OS revisions.

+

The Palm Pre supports a number of MP3, MP4 and WAV formats (WebOS 1.4.1 was tested; it didn't seem to like MP3s at 192kbps, but 128kbps was fine.)

+ +
Known HTML5 Audio bugs/limitations/annoyances
+ +

As of the October, 2010 release of SM2 (V2.97a.20101010):

+
    +
  • HTML5 audio is disabled for all versions of Safari (4 and 5) on Snow Leopard (OS X 10.6.3 and 10.6.4) until Apple fixes issues with audio loading and playback due to bugs in "underlying frameworks." See Webkit #32159.
  • +
+ +

As of the August, 2010 release of SM2 (V2.96a.20100822):

+
    +
  • Safari 5.0.1 (533.17.18) on Snow Leopard (10.6.x) continues to show buggy HTML5 audio load/playback behaviour. Apple are aware of the regression, which began with Safari 4.0 on Snow Leopard (perhaps with the new QuickTime.) See Webkit #32159.
  • +
  • iPad/iPhone iOS4 will now play a sequence of sounds if using onfinish() to create/start the next (eg., the Muxtape-style playlist on the SM2 homepage will play through once the user starts it.) In any event, user interaction is always required to start the first sound.
  • +
+ +

As of the June, 2010 release of SM2 (V2.96a.20100624):

+
    +
  • Safari 5.0 (533.16) on OS X Snow Leopard (10.6.x) continues to show buggy HTML5 audio load/playback behaviour, same as with Safari 4.0.5 on Snow Leopard only - may be related to underlying QuickTime implementation (a guess, at this point.) SM2 will disable HTML5 audio support by default for this specific browser + OS combo. See Webkit #32159 for discussion + testcases.
  • +
+ +

As of the May, 2010 release of SM2 (V2.96a.20100520):

+
    +
  • Safari 4.0.5 on OS X Snow Leopard (10.6.x) appears to have an annoying bug where audio inconsistently fails to load / play; SM2 will currently disable or ignore the HTML5 feature on this exact browser + OS version. See Webkit #32159 for discussion + testcases. Note that Safari on OS X 10.5 "Leopard" and on Windows do not appear to have this bug; it seems to be limited to Snow Leopard, seen on OS X 10.6.3.
  • +
  • Some browsers (and iPad 3.2?) do not fire progress events, and/or do not implement bytesLoaded/bytesTotal-style attributes.
  • +
  • iPad 3.2 appears to be able to only play one sound at a time, and will terminate other sounds.
  • +
  • iPad 3.2 may also loop AAC+ (HE-AAC) and WAV sounds, perhaps not firing onfinish() and resetting the position to 0 each time, but is fine with MP3s. This has been observed, but not fully-tested.
  • +
  • Looping in HTML5 is either "infinite" or "none". A wrapper may be created for SM2 so that a number of loops can be specified, as with Flash. This is not yet implemented.
  • +
  • Panning (left/right channel balance) does not appear to be in HTML5.
  • +
  • Flash-only features such as ID3 tag reading, waveform and spectrum data will simply be ignored, and their related events will not fire on SMSound objects which are using HTML5.
  • +
+ +
General Disclaimer
+

HTML5 audio support may still be in flux, and may not be fully-supported or implemented consistently in modern browsers. Be careful out there.

+
+ +
+

soundManager.wmode

+

The wmode property is applied directly to the flash movie, and can be either null, 'window', 'transparent' or 'opaque'. By default if useHighPerformance is enabled, transparency will be attempted by SM2 unless there are known issues with the rendering mode.

+

It appears that non-IE browsers on Windows will not load SWF content "below the fold" (out of scrollable view) when wmode is set to anything other than null (window). This will break SM2 as it expects Flash to load within a reasonably short amount of time - so SM2 by default will reset wmode for this case. If you wish to force retention of your wmode, set soundManager.flashTimeout = 0 which will ensure that if the content is below the fold, SM2 will not time out waiting for it to load.

+

Additionally, soundManager.specialWmodeCase will be set to true if wmode has been reset due to this special condition.

+
+ +
+ + +
+ +
+ +
+

SoundManager Core API

+

Methods for the soundManager object.

+
+ +
+ +
+ +

SoundManager Global Object

+ +

This is a collection of methods, collections, properties and event handlers available via the soundManager Javascript object. Sound properties and methods can be set on a global (inherited) default, or per-sound basis.

+ +
+ + + +
+
canPlay:boolean canPlayMIME(MIMEtype:string)
+
Returns a boolean indicating whether soundManager can play the given MIME type - eg., audio/mp3. The types supported vary based on Flash version and MPEG4 (MovieStar mode) options.
+
+ MIME type patterns are as follows: +
    +
  • Defaults: /^audio\/(?:x-)?(?:mp(?:eg|3))\s*;?/i; - eg. audio/mp3 or audio/mpeg
  • +
  • MovieStar-only formats: /^audio\/(?:x-)?(?:mp(?:eg|3)|mp4a-latm|aac|speex)\s*;?/i; - eg. audio/m4a or audio/aac
  • +
+
+
Example: +
// link example: <a id="song1" href="foo.php?songID=1" type="audio/mp3">play song 1</a>
+var aLink = document.getElementById('song1');
+if (soundManager.canPlayLink(aLink)) {
+ soundManager.play('song1Sound',aLink.href);
+}
+
If no type attribute is found, this method will return null instead of false.
+
+ +
+
canplay:boolean canPlayURL(mediaURL:string)
+
Returns a boolean indicating whether soundManager can play the given URL. Playability is determined by a matching URL pattern set at runtime, based on Flash version and MPEG4 (MovieStar mode) support.
+
Example: +
var sURL = '/path/to/some.mp3';
+if (soundManager.canPlayURL(sURL)) {
+ soundManager.createSound('fooSound',sURL);
+}
+
If no href attribute is found, this method will return null instead of false.
+
+ +
+ +
object:SMSound createSound(object:options)
+
Creates a sound with an arbitrary number of optional arguments. Returns a SMSound object instance. Requires id and url at a minimum.
+
+ Example: +
soundManager.createSound({
+ id: 'mySound', // required
+ url: '/audio/mysoundfile.mp3', // required
+ // optional sound parameters here, see Sound Properties for full list
+ volume: 50,
+ autoPlay: true,
+ whileloading: soundIsLoading
+});
+

Each createSound() call results in the creation of a SMSound object which stores all properties, methods and events relevant to that particular sound instance.

+

Individual sound objects can also easily be referenced as returned from createSound():

+
var mySoundObject = soundManager.createSound({
+ id: 'mySound',
+ url: '/audio/mysoundfile.mp3'
+});
+mySoundObject.play(); // SMSound object reference, same as soundManager.getSoundById('mySound')
+ +

(Note: Code formatting is stylistic, not necessarily recommended.) See Object Literal Format.

+
+
If createSound is called with the ID of an existing sound, that sound object will be returned "as-is". Any other createSound options passed (eg., url or volume, etc.) will be ignored.
+ +
+ +
+
object:SMSound createSound(id:string,url:string) - overloaded method
+
Creates a sound with the specified ID and URL (simple two-parameter method.)
+
Example: soundManager.createSound('mySound','/audio/mysoundfile.mp3');
+
+ +
+
destroySound(id:string)
+
Stops, unloads and destroys a sound specified by ID.
+
Example: soundManager.destroySound('mySound');
+
SMSound equivalent example: mySound.destruct();
+
+ +
+
object:SMSound mute([id:string])
+
Mutes the sound specified by ID and returns that sound object. If no ID specified, all sounds will be muted and null is returned. Affects muted property (boolean.)
+
Example: soundManager.mute('mySound');
+
+ +
+
onready(callback:function(status),[scope])
+
Queue onload()-style event listener(s) processed at (or immediately, if added after) SM2 initialization, just before soundManager.onload() or onerror() are called. More flexible than single soundManager.onload() event, allows separate scripts to add listeners etc. An optional scope parameter can be specified; if none, the callback is scoped to the window.
+
Example: soundManager.onready(myOnReadyHandler); soundManager.onready(myOtherHandler);
+
A "status" object is also passed to the callback, which can be safely ignored. It includes a "success" parameter, indicating the state of soundManager.supported().
+
Example: +
soundManager.onready(function(oStatus) {
+  if (oStatus.success) {
+    alert('Yay, SM2 loaded OK!');	
+  } else {
+    alert('Oh snap, SM2 could not start.');
+  }
+});
+

You may also check soundManager.supported() instead.

+
soundManager.onready(function() {
+  if (soundManager.supported()) {
+    alert('Yay, SM2 loaded OK!');	
+  } else {
+    alert('Oh snap, SM2 could not start.');
+  }
+});
+
+
The same listener may be added multiple times; there is no duplicate checking. Queue is processed in order of addition.
+
If soundManager.reboot() is called, all listeners' "fired" flags will be reset and they will be eligible to fire again when SM2 starts up.
+
+ +
+
object:SMSound play(id:string,[options object])
+
Starts playing the sound specified by ID. (Will start loading if applicable, and will play ASAP.)
+
Returns an SMSound (sound object) instance.
+
Example: soundManager.play('mySound');
+
Note that the second parameter, options object, is not required and can take almost any argument from the object literal format (eg. volume.) It is convenient when you wish to override the sound defaults for a single instance.
+
Example: soundManager.play('mySound',{volume:50,onfinish:playNextSound});
+
+ +
+
object:SMSound pause(id:string)
+
Pauses the sound specified by ID. Does not toggle. Affects paused property (boolean.) Returns the given sound object.
+
Example: soundManager.pause('mySound');
+
+ +
+
pauseAll()
+
Pauses all sounds whose playState is >0. Affects paused property (boolean.)
+
Example: soundManager.pauseAll();
+
+ +
+
reboot()
+
Destroys any created SMSound objects, unloads the flash movie (removing it from the DOM) and restarts the SM2 init process, retaining all currently-set properties.
+
Example: +
soundManager.onerror = function() {
+  // Something went wrong during init - in this example, we *assume* flashblock etc.
+  soundManager.flashLoadTimeout = 0; // When restarting, wait indefinitely for flash
+  soundManager.onerror = {}; // Prevent an infinite loop, in case it's not flashblock
+  soundManager.reboot(); // and, go!
+}
+
+
This method may be helpful when trying to gracefully recover from FlashBlock-type situations where the user has prevented the SWF from loading, but is able to whitelist it. For more ideas, see Flashblock demo.
+
When using this method also consider flashLoadTimeout, which can have SM2 wait indefinitely for the flash to load if desired.
+
+ +
+
object:SMSound resume(id:string)
+
Resumes and returns the currently-paused sound specified by ID.
+
Example: soundManager.resume('mySound');
+
+ +
+
resumeAll()
+
Resumes all currently-paused sounds.
+
Example: soundManager.resumeAll();
+
+ +
+
object:SMSound setPan(id:string,volume:integer)
+
Sets the stereo pan (left/right bias) of the sound specified by ID, and returns the related sound object. Accepted values: -100 to 100 (L/R, 0 = center.) Affects pan property.
+
Example: soundManager.setPan('mySound',-80);
+
+ +
+
object:SMSound setPosition(id:string,msecOffset:integer)
+
Seeeks to a given position within a sound, specified by miliseconds (1000 msec = 1 second) and returns the related sound object. Affects position property.
+
Example: soundManager.setPosition('mySound',2500);
+
Can only seek within loaded sound data, as defined by the duration property.
+
+ +
+
object:SMSound setVolume(id:string,volume:integer)
+
Sets the volume of the sound specified by ID and returns the related sound object. Accepted values: 0-100. Affects volume property.
+
Example: soundManager.setVolume('mySound',50);
+
+ +
+
object:SMSound stop(id:string)
+
Stops playing the sound specified by ID. Returns the related sound object.
+
Example: soundManager.stop('mySound');
+
+ +
+
stopAll()
+
Stops any currently-playing sounds.
+
Example: soundManager.stopAll();
+
+ +
+
object:SMSound toggleMute(id:string)
+
Mutes/unmutes the sound specified by ID. Returns the related sound object.
+
Example: soundManager.toggleMute('mySound');
+
+ +
+
object:SMSound togglePause(id:string)
+
Pauses/resumes play on the sound specified by ID. Returns the related sound object.
+
Example: soundManager.togglePause('mySound');
+
+ +
+
object:SMSound unload(id:string)
+
Stops loading the sound specified by ID, canceling any current HTTP request. Returns the related sound object.
+
Example: soundManager.unload('mySound');
+
Note that for Flash 8, SoundManager does this by loading a new, tiny "stub" MP3 file, ./null.mp3, which replaces the current one from loading. This is defined in the SM2 global object as nullURL, and can be edited.
+
+ +
+
object:SMSound unmute([id:string])
+
Unmutes the sound specified by ID. If no ID specified, all sounds will be unmuted. Affects muted property (boolean.) Returns the related sound object.
+
Example: soundManager.unmute('mySound');
+
+ +
+
object:SMSound load(id:string,[options object])
+
Starts loading the sound specified by ID, with options if specified. Returns the related sound object.
+
Example: soundManager.load('mySound');
+
Example 2: soundManager.load('mySound',{volume:50,onfinish:playNextSound});
+
+ +
+
object:SMSound getSoundById(id:string)
+
Returns an SMSound object specified by ID, or null if a sound with that ID is not found.
+
Example: var mySMSound = soundManager.getSoundById('mySound');
+
+ +
+
number:bytesUsed getMemoryUse()
+
Returns the total number of bytes allocated to the Adobe Flash player or Adobe AIR, or 0 if unsupported (Flash 9+ only.) This number may include memory use across all tabs, browsers etc. See system.totalMemory (livedocs.adobe.com)
+
Example: var mbUsed = (soundManager.getMemoryUse()/1024/1024).toFixed(2); // eg. 12.05 MB
+
+ +
+
loadFromXML(xmlURL:string)
+
Loads and creates sounds as defined in a SoundManager v1 XML file (legacy)
+
Note that per-sound options are not supported with this method, and sound objects will be created immediately upon loading and parsing of the XML. The sounds will inherit the defaultOptions settings, with the exception of the stream attribute as set in the XML (true if defined, defaultOption applied if omitted.)
+
Example: soundManager.loadFromXML('/path/to/some.xml');
+
XML format example: MPC drumkit XML file
+
+ +
+
isSupported:boolean supported()
+
Returns a boolean indicating whether soundManager has attempted to and succeeded in initialising. This function will return false if called before initialisation has occurred.
+
Example: var isSupported = soundManager.supported();
+
+ +
+ +
+ +
+ +
+

SMSound (Sound Object) API

+

Each createSound() call generates a matching SMSound (sound instance) object, which lasts for the life of the page or until explicitly destroyed. Each instance stores stateful information (eg. playState) and provides event handlers for state changes (eg. onload().)

+

SoundManager is a convenient wrapper for most sound object methods: It will check for and gracefully exit if a sound object (specified by ID) does not exist, and provides convenient global functionality, eg. muting or pausing of all sounds.

+

Nonetheless, each SMSound object can have its methods called directly. eg. mySound.mute() instead of soundManager.mute('mySound'), and so on.

+

Note that for code examples, mySound is assumed to be a valid SMSound instance object - eg.,
var mySound = soundManager.createSound(); or
var mySound = soundManager.getSoundById();

+
+ +
+ +
+ +

Sound Object Methods

+ +

Each sound under SoundManager 2 is given a SMSound object instance which includes the following events, methods and properties. Note that most methods will return the sound object instance, allowing for method chaining if desired.

+ +
+
destruct()
+
Stops, unloads and destroys a sound, freeing resources etc.
+
Example: mySound.destruct();
+
+ +
+
object:SMSound load([options object])
+
Starts loading the given sound, with options if specified.
+
Example: mySound.load();
+
Example 2: mySound.load({volume:50,onfinish:playNextSound});
+
+ +
+
object:SMSound mute()
+
Mutes the given sound. Affects muted property.
+
Example: mySound.mute();
+
+ +
+
object:SMSound onposition(msecOffset:integer, callback:function, [scope])
+
Registers an event listener, fired when a sound reaches or passes a certain position while playing. Position being "listened" for is passed back to event handler. Will also fire if a sound is "rewound" (eg. via setPosition() to an earlier point) and the given position is reached again. Listeners will be removed if a sound is unloaded. An optional scope can be passed as well.
+
Note that for multiShot cases, only the first play instance's position is tracked in Flash; therefore, subsequent "shots" will not have onposition() events being fired.
+
Example: mySound.onposition(3000, function(eventPosition){console.log(this.sID+' reached '+eventPosition});
+
+ +
+
object:SMSound pause()
+
Pauses the given sound. (Does not toggle.) Affects paused property (boolean.)
+
Example: mySound.pause();
+
+ +
+
object:SMSound play([options object])
+
Starts playing the given sound, with an optional options object. (Will start loading if applicable, and will play ASAP.)
+
Note that the options object parameter is not required and can take almost any argument from the object literal format (eg. volume.)
+
Example: mySound.play('mySound',{volume:50,onfinish:playNextSound});
+
+ +
+
object:SMSound setPosition(msecOffset:integer)
+
Seeks to a given position within a sound, specified by miliseconds (1000 msec = 1 second.) Affects position property.
+
Example: mySound.setPosition(2500);
+
Can only seek within loaded sound data, as defined by the duration property.
+
+ +
+
object:SMSound resume()
+
Resumes the currently-paused sound. Does not affect currently-playing sounds.
+
Example: mySound.resume();
+
+ +
+
object:SMSound setPan(volume:integer)
+
Sets the stereo pan (left/right bias) of the given sound. Accepted values: -100 to 100 (L/R, 0 = center.) Affects pan property.
+
Example: mySound.setPan(-80);
+
+ +
+
object:SMSound setVolume(volume:integer)
+
Sets the volume of the given sound. Accepted values: 0-100. Affects volume property.
+
Example: mySound.setVolume(50);
+
+ +
+
object:SMSound toggleMute()
+
Mutes/unmutes the given sound. Affected muted property (boolean.)
+
Example: mySound.toggleMute();
+
+ +
+
object:SMSound togglePause()
+
Pauses/resumes play of the given sound. Will also start a sound if it is has not yet been played.
+
Example: mySound.togglePause();
+
+ +
+
object:SMSound stop()
+
Stops playing the given sound.
+
Example: mySound.stop();
+
+ +
+
object:SMSound unload()
+
Stops loading the given sound, canceling any current HTTP request.
+
Example: mySound.unload();
+
Note that for Flash 8, SoundManager does this by loading a new, tiny "stub" MP3 file, ./null.mp3, which replaces the current one from loading. This is defined in the SM2 global object as nullURL, and can be edited.
+
+ +
+
object:SMSound unmute()
+
Unmutes the given sound. Affects muted property.
+
Example: mySound.unmute();
+
+ +
+ +
+ + +
+ +
+ +
+

SMSound Events

+

Event handlers for SMSound objects.

+
+ +
+ +
+ +

Sound Object Events

+ +

Like native javascript objects, each SoundManager SMSound (sound instance) object can fire a number of onload-like events. Handlers cannot be "directly" assigned (eg. someSound.onload), but can be passed as option parameters to several sound methods.

+
+
soundManager.play('mySound',{
+  onfinish: function() {
+    alert('The sound '+this.sID+' finished playing.');
+  }
+});
+
+

Event handlers are scoped to the relevant sound object, so the this keyword will point to the sound object on which the event fired such that its properties can easily be accessed - eg. within an SMSound event handler, this.sID will give the sound ID.

+ +
+ +
+ +
+
onbufferchange()
+
Fires when a sound's reported buffering state has changed while playing and/or loading. The current state is reflected in the boolean isBuffering property.
+
Flash 9+ only. Related information on Adobe, Sound.isBuffering.
+
+ +
+
ondataerror()
+
Fires at least once per sound play instance when Flash encounters a security error when trying to call computeSpectrum() internally. This typically happens when sounds are 'inaccessible' due to another Flash movie (eg. YouTube) in another tab which has loaded, and may (or may not be) playing sound. Flash attempts to read the "combined" output to the sound card, and must have security permissions for all sounds as a result. See areSoundsInaccessible() on Adobe for more info.
+
If the offending resource causing the security error is closed or becomes inactive(?), the data will become available again. Intermittent availability will result in intermittent calls to ondataerror().
+
+ +
+
onbeforefinishcomplete()
+
Fires when a sound has finished, onfinish() has been called, but before the sound play state and other meta data (position, etc.) are reset.
+
+ +
+
onbeforefinish()
+
Fires when a playing, fully-loaded sound has reached onbeforefinishtime (eg. 5000 msec) from its end.
+
+ +
+
onconnect()
+
Fires when a sound using an RTMP serverURL property has attempted to connect, and has either succeeded or failed. Affects connected property. Once connected, a stream can be requested from the RTMP server.
+
Example: +
var s = soundManager.createSound({
+  id: 'rtmpTest',
+  serverURL: 'rtmp://localhost/test/',
+  url: 'song.mp3',
+  onconnect: function(bConnect) {
+    // this.connected can also be used
+    soundManager._writeDebug(this.sID+' connected: '+(bConnect?'true':'false'));
+  }
+}).play(); // will result in connection being made
+
+ +
+
onfinish()
+
Fires when a playing sound has reached its end. By this point, relevant properties like playState will have been reset to non-playing status.
+
+ +
+
onid3()
+
Fires when ID3 data has been received. Relevant property is id3, which is an object literal (JSON)-style object. Only fields with data will be populated.
+
Note that ID3V2 data is located at the beginning (header) of an MP3 file and will load almost immediately, whereas ID3V1 data is at the end and will not be received until the MP3 has fully loaded.
+
+ Example handler code: +
+
soundManager._writeDebug('sound '+this.sID+' ID3 data received');
+var prop = null;
+var data = '';
+for (prop in this.id3) {
+  data += prop+': '+this.id3[prop]+','; // eg. title: Loser, artist: Beck
+}
+
+
+
Refer to the Flash 8 Sound.id3 documentation for a list of ID3 properties.
+
When parsing ID3 data, it is best to check for the existance of ID3V1 data first, and apply ID3V2 if no matching ID3V1 data is defined. (V1 should "inherit" from V2, ideally, if available.)
+
Note that Flash's cross-domain security restrictions may prevent access to ID3 information, even though the MP3 itself can be loaded. (crossdomain.xml files on the remote host can grant Flash permission to access this.)
+
Also note some issues with parsing ID3 from iTunes.
+
+ + +
+
onjustbeforefinish()
+
Fires approximately justbeforefinishtime before the end of a fully-loaded, playing sound.
+
This is based on a polling approach given SM2 must track the sound's position, and is approximated (eg. a 200 msec value may fire at 187 msec before the end of the sound.)
+
+ +
+
onload(boolean:success)
+
Fires on sound load. Boolean reflects successful load (true), or fail/load from cache (false).
+
False value should seemingly only be for failure, but appears to be returned for load from cache as well. This strange behaviour comes from Flash. More detail may be available from the Flash 8 sound object documentation.
+
Failure can occur if the Flash sandbox (security) model is preventing access, for example loading SoundManager 2 on the local file system and trying to access an MP3 on a network (or internet) URL. (Security can be configured in the Flash security panel, [see here].)
+ +
+ +
+
onpause()
+
Fires when a sound pauses, eg. via sound.pause().
+
Example: soundManager.pause('mySound');
+
+ +
+
onplay()
+
Fires when sound.play() is called.
+
+ +
+
onresume()
+
Fires when a sound resumes playing, eg. via sound.resume().
+
Example: soundManager.resume('mySound');
+
+ +
+
onstop()
+
Fires when sound.stop() is explicitly called. For natural "sound finished" onfinish() case, see below.
+
+ +
+
whileloading()
+
Fires at a regular interval when a sound is loading and new data has been received. The relevant, updated property is bytesLoaded.
+
Example handler code: soundManager._writeDebug('sound '+this.sID+' loading, '+this.bytesLoaded+' of '+this.bytesTotal);
+
Note that the duration property starts from 0 and is updated during whileloading() to reflect the duration of currently-loaded sound data (ie. when a 4:00 MP3 has loaded 50%, the duration will be reported as 2:00 in milliseconds.) However, an estimate of final duration can be calculated using bytesLoaded, bytesTotal and duration while loading. Once fully-loaded, duration will reflect the true and accurate value.
+
+ +
+
whileplaying()
+
Fires at a regular interval when a sound is playing, and a position (time) change is detected. The relevant, updated property is position.
+
Example handler code: soundManager._writeDebug('sound '+this.sID+' playing, '+this.position+' of '+this.duration);
+
+ + +
+ +
+ +
+ + +
+ +
+

SMSound Properties

+

Instance Option properties (parameters) can be used with createSound() and play().

+

Example:

+
soundManager.createSound({
+ id: 'foo',
+ url: '/path/to/an.mp3'
+});
+

Dynamic Properties can be read to monitor the state of a sound object.

+

Example:

+
alert(mySound.playState);
+ + +
+ +
+ +
+ +

Sound Object Properties

+

Each sound object inherits these properties from soundManager.defaultOptions. They can be set individually or at once when enclosed in object literal form to either createSound() or play().

+ +
+ +
+ +
+
sID
+
Sound ID string as provided from the id parameter via createSound() or play(). Can be referenced as this.sID from within sound object event handlers such as onload(), whileloading() or whileplaying(), etc.
+
If an ID is known, the related SMSound object can be retrieved via getSoundById or directly referencing sounds[sID] on the SoundManager global object.
+
+ +
+
url
+
The specified URL from which the sound is loaded, typically over HTTP. Can be referenced as this.url from within sound object event handlers such as onload() or whileplaying(), etc.
+
+ +
+
serverURL
+
Note: Experimental feature. Only for use with RTMP streaming, ie., Flash Media Server and similar servers.
+
The RTMP server address which Flash will connect to using a NetStream object. Only the server address is specified here, when RTMP is in use; the url property is used to point to a specific resource on the server.
+
Example: +
soundManager.createSound({
+  id: 'mySound',
+  serverURL: 'rtmp://localhost/rtmpDemo/', // RTMP server
+  url: 'mysong.mp3' // path to stream
+}).play();
+
+ +
+
usePolicyFile
+
Boolean value (default: false) which instructs Flash, when loading MP3/MP4 content from remote/third party domains, to request example.com/crossdomain.xml first in order to determine permissions for access to metadata such as ID3 info, waveform, peak and/or spectrum data.
+
usePolicyFile will be automagically set to true if your sound options have an onid3() event handler, or uses sound data (peak/wave/spectrum) features. By default, Flash will not have access to this metadata on remote domains unless granted cross-domain security permissions via the crossdomain.xml file.
+
Consider additional HTTP traffic (albeit, perhaps with caching-like behaviour for subsequent checks?) and silent 404s in most cases given few hosts use crossdomain.xml files.
+
See Adobe's knowledge base for related ID3 + crossdomain.xml documentation.
+
+ +
+ +
+ +
+ +

Sound Object Dynamic Properties

+

Each sound includes a number of properties that are updated throughout the life of a sound - while loading or playing, for example. Many of these properties have related events that fire when they are updated, and should be treated as read-only.

+ +
+ + +
+
bytesLoaded
+
The number of bytes currently received while loading a sound.
+
+ +
+
bytesTotal
+
The total number of bytes to be downloaded, while loading a sound.
+
+ +
+
didBeforeFinish
+
Boolean indicating whether beforeFinish() condition was reached.
+
+ +
+
didJustBeforeFinish
+
Boolean indicating whether justBeforeFinish() condition was reached.
+
+ +
+
duration
+
The current length of the sound, specified in milliseconds.
+
Note that during loading, this property reflects the length of downloaded data, not the full length, until completely loaded (see whileloading().) For an approximate "full duration" value while loading, see durationEstimate.
+
+ +
+
durationEstimate
+
The estimated duration of the sound, specified in milliseconds.
+
Due to the dynamic nature of duration while loading, this attempts to provide the full duration by calculating parseInt((self.bytesTotal/self.bytesLoaded)*self.duration) and is updated with each whileloading() interval.
+
Once the sound has fully loaded, duration should be referenced as it will contain the final and accurate value.
+
Note that this method works only with Constant Bitrate (CBR)-encoded MP3s due to the consistent data/time assumption. VBR-encoded MP3s will give inaccurate results.
+
+ +
+
eqData = {left:[], right: []}
+
Object containing two arrays of 256 floating-point (three decimal place) values from 0 to 1, the result of an FFT on the waveform data. Can be used to draw a spectrum (frequency range) graph while playing a sound. See Page-as-playlist demo for example implementation. Requires Flash 9+.
+
A spectrum frequency graph reflects the level of frequencies being played, from left to right, low to high (i.e., 0 to 20,000 Hz.)
+
eqData is set and updated during whileplaying(). A simple graph could be drawn by looping through the values and multiplying by a vertical scale value (eg. 32, thus a graph with peaks of 32 pixels.)
+
Example code: +
someSoundObject.whileplaying = function() {
+  // Move 256 absolutely-positioned 1x1-pixel DIVs, for example (ugly, but works)
+  var gPixels = document.getElementById('graphPixels').getElementsByTagName('div');
+  var gScale = 32; // draw 0 to 32px from bottom
+  for (var i=0; i<256; i++) {
+    graphPixels[i].style.top = (32-(gScale+Math.ceil(this.waveformData.left[i]*gScale)))+'px';
+  }
+}
+
+
Related Adobe technical documentation (Flash 9/AS3 Sound() object): computeSpectrum()
+
Note: Flash security measures may deny access to waveformData when loading MP3s from remote domains.
+
Warning: This feature can eat up a lot of CPU in some cases. The amount of data passed from Flash to JS is not terribly large, but the JS-DOM updates and browser reflow can be expensive. Use with caution.
+
Backward compatibility note: Up to SoundManager 2.95a.20090717, eqData was a single array containing one channel of data. In newer versions this is unchanged, except the array now has .left[] and .right[] objects attached to it. To ensure future compatibility, use eqData.left[0] instead of eqData[0] and so on.
+
+ +
+
id3
+
An object literal populated, if applicable, when ID3 data is received (related handler: onid3())
+
For property details, see onid3().
+
+ +
+
isBuffering
+
Boolean value reflecting the buffering state of a playing or loading object. To be notified when this property changes, see onbufferchange().
+
Flash 9+ only. Related information on Adobe, Sound.isBuffering.
+
+ +
+
connected
+
Boolean value reflecting the state of an RTMP server connection (when serverURL is used to connect to a Flash Media Server or similar RTMP service.) Calls to load or play will result in a connection attempt being made, and onconnect() ultimately being called.
+
For example code using connected, see onconnect().
+
+ +
+
loaded
+
Boolean value indicating load success as returned from Flash. True indicates success, False is a failure.
+
Because of the potential for false positives, duration and other properties could be checked as a test of whether sound data actually loaded. For more granular state information, see readyState.
+
+ +
+
muted
+
Boolean indicating muted status. True/False.
+
Treat as read-only; use mute(), unmute() and toggleMute() methods to affect state.
+
+ +
+
paused
+
Boolean indicating pause status. True/False.
+
Treat as read-only; use pause(), resume() and togglePause() methods to affect state.
+
+ +
+
peakData = {left:0.0, right:0.0}
+
Object literal format including left and right properties with floating-point values ranging from 0 to 1, indicating "peak" (volume) level. Updated during whileplaying(). See Page-as-playlist demo as one example. Requires Flash 9+.
+
Example (within relevant sound object handler): +
someSoundObject.whileplaying = function() {
+  soundManager._writeDebug('Peaks, L/R: '+this.peakData.left+'/'+this.peakData.right);
+}
+
+ +
+
playState
+
Numeric value indicating the current playing state of the sound.
+
0 = stopped/uninitialised
+
1 = playing or buffering sound (play has been called, waiting for data etc.)
+
Note that a 1 may not always guarantee that sound is being heard, given buffering and autoPlay status.
+
+ + +
+
position
+
The current location of the "play head" within the sound, specified in milliseconds (1 sec = 1000 msec).
+
+ +
+
readyState
+
Numeric value indicating a sound's current load status
+
0 = uninitialised
+
1 = loading
+
2 = failed/error
+
3 = loaded/success
+
+ +
+
type
+
A MIME type-like string eg. audio/mp3, used as a hint for SM2 to determine playability of a link with methods like canPlayURL().
+
This can be helpful when you have a sound URL that does not have an .mp3 extension, but serves MP3 data (eg., a PHP or other CGI script.)
+
Example: +
var s = soundManager.createSound({
+  id: 'aSound',
+  url: '/path/to/some.php?songID=123',
+  type: 'audio/mp3' // indicates an MP3 link, so SM2 can handle it appropriately
+});
+
+ + +
+
waveformData = {left:[], right:[]}
+
Array of 256 floating-point (three decimal place) values from -1 to 1, can be used to draw a waveform while playing a sound. See Page-as-playlist demo for example implementation. Requires Flash 9+.
+
waveformData is set and updated during whileplaying(). A simple graph could be drawn by looping through the values and multiplying by a vertical scale value (eg. 32, which would make a graph with peaks of -32 and +32 pixels.)
+
Example code: +
someSoundObject.whileplaying = function() {
+  // Move 256 absolutely-positioned 1x1-pixel DIVs, for example (ugly, but works)
+  var gPixels = document.getElementById('graphPixels').getElementsByTagName('div');
+  var gScale = 32; // draw -32 to +32px from "zero" (i.e., center Y-axis point)
+  for (var i=0; i<256; i++) {
+    graphPixels[i].style.top = (gScale+Math.ceil(this.waveformData.left[i]*-gScale))+'px';
+  }
+}
+
+
SM2 implementation note: waveformData contains both left and right channels, and the data represents a raw sound wave rather than a frequency spectrum.
+
Related Adobe technical documentation (Flash 9/AS3 Sound() object): computeSpectrum()
+
Note: Flash security measures may deny access to waveformData when loading MP3s from remote domains.
+
Warning: This feature can eat up a lot of CPU in some cases. The amount of data passed from Flash to JS is not terribly large, but the JS-DOM updates and browser reflow can be expensive. Use with caution.
+
+ +
+ +
+ +
+ +
+
+

SMSound Methods

+

Functions which may be called directly on sound objects.

+
+
+ +
+

SMSound Object Methods

+

SoundManager provides wrappers for most SMSound methods - eg. soundManager.play('mySound') checks for a valid sound object, and then calls soundManager.sounds['mySound'].play() on that particular object; thus, it is the same as var sound = soundManager.getSoundById('mySound'); mySound.play();

+

The following methods can be called directly on a SMSound instance. The method calls are the same as the SoundManager global methods documented above for existing sound objects, minus the sound ID parameter.

+
+ + + +
+
+ + + +
+ +
+

SoundManager Default Options

+

An optional object specifying event handlers etc., passed to createSound() and play().

+
+ +
+ +
+ +

SoundManager Global Sound Object Defaults

+ +

The soundManager.defaultOptions object contains default parameters inherited by sound objects made via createSound(). They can be overridden on a per-sound basis at create time, or changed dynamically in some cases. Note that none of these options are required when calling createSound() except for id and url; the others will inherit the default values if unspecified.

+

soundManager.defaultOptions apply the properties and event handlers as specified above. Defaults are shown below as an example.

+ +
soundManager.defaultOptions = {
+  autoLoad: false,       // enable automatic loading (otherwise .load() will call with .play())
+  autoPlay: false,       // enable playing of file ASAP (much faster if "stream" is true)
+  loops: 1,              // number of times to play the sound. Related: looping (API demo)
+  multiShot: true,       // let sounds "restart" or "chorus" when played multiple times..
+  multiShotEvents: false,// allow events (onfinish()) to fire for each shot, if supported.
+  onid3: null,           // callback function for "ID3 data is added/available"
+  onload: null,          // callback function for "load finished"
+  onstop: null,          // callback for "user stop"
+  onfinish: null,        // callback function for "sound finished playing"
+  onbeforefinish: null,  // callback for "before sound finished playing (at [time])"
+  onbeforefinishtime: 5000,    // offset (milliseconds) from sound end, call beforefinish..
+  onbeforefinishcomplete: null,// function to call when said sound finishes playing
+  onjustbeforefinish: null,    // callback for [n] msec before end of current sound
+  onjustbeforefinishtime: 200, // if unused, set to 0 (or null handler), event will not fire.
+  onpause: null,        // callback for "pause"
+  onplay: null,         // callback for "play" start
+  onresume: null,       // callback for "resume" (pause toggle)
+  position: null,       // offset (milliseconds) to seek to within downloaded sound.
+  pan: 0,               // "pan" settings, left-to-right, -100 to 100
+  stream: true,         // allows playing before entire file has loaded (recommended)
+  type: null,           // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3
+  usePolicyFile: false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access)
+  volume: 100,          // self-explanatory. 0-100, the latter being the max.
+  whileloading: null,   // callback function for updating progress (X of Y bytes received)
+  whileplaying: null,   // callback during play (position update)
+
+  // *** merged soundManager.flash9Options, as applicable ***
+  isMovieStar: null,    // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL
+  usePeakData: false,   // enable left/right channel peak (level) data
+  useWaveformData:false,// enable sound spectrum (raw waveform data) - Note: May be CPU-intensive, UI redraw/layout etc.
+  useEQData: false,     // enable sound EQ (frequency spectrum data) - Note: CPU potential also.
+  onbufferchange: null, // callback for "isBuffering" property change
+  ondataerror: null     // callback for waveform/eq data access error (flash playing audio in other tabs/domains)
+
+  // *** merged soundManager.movieStarOptions, as applicable ***
+  bufferTime: null,     // seconds of data to buffer (null = flash default of 0.1 - if AAC gappy, try up to 3 seconds)
+  serverURL: null,      // rtmp: flash media server to connect to, required for RTMP
+  onconnect: null       // rtmp: callback for connection to flash media server
+
+}
+
+ +

As a simple example, the following code would override the default autoPlay, pan and volume options for a given sound:

+ +
soundManager.createSound({
+  id: 'mySound',
+  url: '/path/to/some.mp3',
+  autoPlay: true,
+  pan: -75,
+  volume: 50
+});
+ +

Note: For live examples, see the code behind the "page as playlist" demo which uses much of this functionality.

+ +
+ +
+ +

Sound Properties Object: Version-specific Options (Merging)

+ +

Some sound properties object items (eg. usePeakData) are flash version-specific, non-default and are intentionally separated from soundManager.defaultOptions. Flash 9-specific options fall under this category.

+ +

soundManager.flash9Options and soundManager.movieStarOptions are both defined as separate objects, and if supported according to flashVersion and defaultOptions parameters, are merged "without nesting" into soundManager.defaultOptions.

+ +
soundManager.flash9Options = {
+  isMovieStar: null,      // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL
+  usePeakData: false,     // enable left/right channel peak (level) data
+  useWaveformData: false, // enable sound spectrum (raw waveform data) - WARNING: May set CPUs on fire.
+  useEQData: false,       // enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.
+  onbufferchange: null,	  // callback for "isBuffering" property change
+  ondataerror: null	  // callback for waveform/eq data access error (flash playing audio in other tabs/domains)
+}
+soundManager.movieStarOptions = {
+  bufferTime: null  // seconds of data to buffer (null = flash default of 0.1 - if AAC gappy, try up to 3 seconds)
+}
+// if applicable, these options are merged into soundManager.defaultOptions at SM2 init.
+// soundManager.flash9Options.isMovieStar -> soundManager.defaultOptions.isMovieStar, etc.
+
+ +

defaultOptions.peakData vs. flash9Options.usePeakData

+ +

Note that soundManager.defaultOptions.peakData will be undefined until SoundManager 2 has self-initialized, at which point it determines the flash version to use and creates the .SWF, etc. Only then will defaultOptions be populated with optional option parameters, if applicable.

+ +

Once SM2 has written out the .SWF, it is safe to modify soundManager.defaultOptions.usePeakData directly, for example - but if making changes before initialization, eg., at the time when you are setting soundManager.flashVersion, it is best to modify the source objects as they haven't yet been merged. ie., soundManager.flash9Options.usePeakData = true;

+ + +
+ +
+ +
+ +
+
+

SoundManager Runtime Properties

+

Elements of SoundManager which are set at runtime, intended as read-only.

+
+ +
+ +
+ +

SoundManager Dynamic (Runtime) Properties

+ +

Some properties are dynamic, determined at initialisation or later during runtime, and should be treated as read-only. Currently, supported() and features are the only properties that fall in this category.

+ +

soundManager.features Object

+ +

As certain sound functionality is only available beginning with Flash 9, soundManager.features can provide a consistent way of checking for feature support.

+ +

The structure (intended as read-only) is currently as follows:

+ +
soundManager.features = {
+  buffering: [boolean],
+  peakData: [boolean],
+  waveformData: [boolean],
+  eqData: [boolean],
+  movieStar: [boolean]
+}
+ +

Example (checking for peakData support):

+
if (soundManager.features.peakData) {
+  // do peak data-related things here
+}
+ +

The features object is populated at initialisation time; the current feature support tests simply check the value of soundManager.flashVersion being >= 9. This object has been added in anticipation of additional features with future versions of Flash.

+ +
+ +
+
+ +
+
+

SoundManager Core Events

+

Events fired by SoundManager at start-up

+
+
+ +
+ +

The following events are attached to the soundManager global object and are useful for detecting the success/failure of the API's initialisation.

+

Keep in mind that these core events are effectively asynchronous (ie., they may fire long before or after window.onload()) and therefore should not be relied on as the "ready" event for starting your application. Use the standard "DOM content loaded" or window load events for your own initialization routines.

+

For a more flexible queue-based, addListener-style approach to the onload event, see soundManager.onready().

+ +
+ + +
onerror()
+
Function called when SoundManager fails to successfully initialise after Flash attempts an init call via ExternalInterface.
+
Example: soundManager.onerror = function() { alert('SoundManager failed to load'); }
+
This handler should be called if there is an ExternalInterface problem or other exceptions that fire when the initialisation function is called.
+
If you want multiple listeners for this event, see soundManager.onready().
+ +
oninitmovie()
+
Function called immediately after the SWF is either written to (or retrieved from) the DOM as part of the start-up process. This event can be useful if you wish to implement your own start-up time-out, eg. for handling flash blockers, start-up failures or other custom messaging.
+
Example: soundManager.oninitmovie = function(){ alert('SWF init.'); }
+ +
onload()
+
Function called when SoundManager has successfully loaded.
+
Example: soundManager.onload = function() { alert('SoundManager ready to use'); }
+
Once this function has been called, all core methods will be available to use.
+
Note that onload() is not called when SoundManager fails to load; instead, onerror() is called.
+
If you want multiple listeners for this event, see soundManager.onready().
+ +
onready(callback:function(status),[scope])
+
Queue onload()-style event listener(s), triggered when soundManager has either started or failed.
+
Example: soundManager.onready(myOnReadyHandler); soundManager.onready(myOtherHandler);
+
For more detail and examples, see soundManager.onready().
+ +
+ +
+ + +
+
+ +
+
+

SoundManager Collections

+

Object collections which SoundManager maintains during runtime.

+
+
+ +
+ +

SoundManager Object Collections

+ +
+
soundIDs[]
+
An array of sound ID strings, ordered by creation. Can be used to iterate through sounds{} by ID.
+
sounds{}
+
An object literal/JSON-style instance of SMSound objects indexed by sound ID (as in sounds['mySound'] or sounds.mySound), used internally by SoundManager. soundManager.getSoundById() may be used as an alternate to directly accessing this object.
+
+ +
+ +
+
+ +
+ +
+

Sound Options Object Format

+

Object Literal, JSON-style form passed to createSound() and play()

+
+ +
+ +
+ +

Object Literal Format

+ +

Sounds can be created with instance-specific parameters in an object literal (JSON) format, where omitted parameters inherit default values as defined in soundManager.

+ +
soundManager.createSound({
+  id: 'mySound',
+  url: '/path/to/some.mp3',
+  autoLoad: true,
+  autoPlay: false,
+  onload: function() {
+    alert('The sound '+this.sID+' loaded!');
+  },
+  volume: 50
+});
+ +

This object can also be passed as an optional argument to the play method, overriding options set at creation time.

+ +

For a full list of available options, see Sound Properties Object

+ +
+ + +
+ +
+ +
+ + + + +
+ + + +
+ +

API Elements

+ +

SoundManager and SMSound API

+ + + + +
+ +
+ +
+ +
+ + +
+ + +
+ + + + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/doc/resources/index.html b/docs/dymaxion/soundmanagerv297a-20101010/doc/resources/index.html new file mode 100755 index 0000000..a5b2c73 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/doc/resources/index.html @@ -0,0 +1,239 @@ + + + +SoundManager 2: Resources + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+

Licensing

+

BSD licensed.

+
+ +
+

SoundManager 2 License

+

SoundManager 2 is provided under a BSD license.

+
+ +
+ + + + + +
+ + + + +
+ + + +
+ + + +
+ +
+ + +
+ + +
+ + + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/doc/technotes/index.html b/docs/dymaxion/soundmanagerv297a-20101010/doc/technotes/index.html new file mode 100755 index 0000000..baec8e2 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/doc/technotes/index.html @@ -0,0 +1,305 @@ + + + +SoundManager 2: Technical Notes + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+
+
+ +
+
+
+ +
+ +
+ +
+

Requirements + Specifications

+

What SM2 needs, and how it works.

+
+ +
+ +
+ +

Requirements + Specifications

+ +

Prerequisites (client)

+ +
    +
  • Flash plugin, version 8 or higher
  • +
  • Supported Browser
  • +
+ +

Supported Browsers/Platforms

+ +

Javascript-to-flash communication is possible through Flash 8's ExternalInterface feature, which uses a standard browser plugin architecture implemented by each browser manufacturer (see NPAPI.) As a result, the following browsers should be supported:

+ +
    +
  • IE 5.0+, Windows
  • +
  • Netscape 8.0+, Windows/Mac
  • +
  • Mozilla 1.7.5+, Windows/Mac
  • +
  • Firefox 1.0+, Windows/Mac
  • +
  • Firefox 1.5+, Linux (Flash 9 beta)
  • +
  • Safari 1.3+, Mac / All Windows versions
  • +
  • Google Chrome (All versions/OSes)
  • +
  • Opera 9.10 (slightly buggy, 9.5+ ideal), Windows/Mac
  • +
+ +

For reference, see Adobe's Flash 8 documentation, under the "ExternalInterface support" page which details supported browsers.

+ +

At this time, not all combinations of browser/OS have been tested. Some unlisted configurations may be supported, but have not been explicitly verified to work.

+ +
+ +
+ +

Caveats + Limitations / FAQ

+ +
+ +
+ +

Supported sound formats (MP3 via Flash 8 and MP4/M4A/AAC via Flash 9 "MovieStar", with caveats)

+

SM2 uses Flash's native Sound object for loading and managing sound, so it is subject to the same limitations that Flash 8 is. Perhaps a design decision, the Flash 8 sound object only supports MP3 files through the loadSound() ActionScript method. SM2 is not able to load other sound formats, including audio-only SWF files, due to this limitation. Refer to the Flash 8 documentation for details.

+ +

MP3 Format Caveats

+

Additionally, some very low and very high bitrate MP3s, and Variable Bitrate (VBR) MP3s may play either too quickly or too slowly (see "the chipmunk problem"); if you are encountering this issue, try re-encoding at a different bitrate (between 64 kbps and 192 kbps, for example.) Using Constant Bitrate (CBR) encoding may also alleviate this problem.

+

It has been suggested that sample rates that are neither 22/44 KHz can also contribute to this issue. 44 KHz is the standard CD-spec sample rate, and is recommended for "hi-fi" recordings.

+ +

Looping

+

Perhaps due to the way Flash dynamically loads and decodes MP3 data, seamless looping doesn't seem to be fully implemented. Loops have a noticeable gap between the finish and start. This has been an issue since the original version of SoundManager. Rather than have a broken feature, the funcionality has been omitted until a solid workaround is found.

+ +

Flash 8 limitations with multiShot (overlaying/"chorus") effects

+

Regarding "layering" sounds (calling play() on a sound multiple times): Even though a multi-shot option can be specified, it does not work with Flash 8; a single instance of a sound can only have one timeline. The current behaviour is that when multiShot is specified and play() is called on a currently-playing sound, it will restart from the beginning without an overlay.

+

However, the API does provide some creative ways (onbeforefinish for looping, multiple sound objects for multi-shot layering) of working around these Flash limitations.

+

It should be noted that sounds can loop seamlessly and be layered when linked and exported to SWF from within the Flash IDE, but SoundManager does not support SWF-based audio.

+ +

Flash 9 multiShot capabilities

+

The Flash 9-based version of SoundManager2 can successfully layer sounds via "multiShot", truly playing a single sound multiple times on top of itself. However the API will only call certain timing-related methods such as whileplaying() for the first play() "instance" of the sound, to avoid confusion. By contrast, simpler methods such as onfinish() will be called multiple times, one for each instance of play().

+ +

ID3 Parsing

+

ID3 data can differ in formatting, version and subsequently be oddly-parsed by Flash. Values may sometimes be repeated across different fields.

+

ID3 info seems to fail to load for iTunes 7-edited files, perhaps due to the format or inclusion of album artwork (image data.)

+ +

Performance Notes: Caching + RAM Obeservations

+

Flash appears to use the browser cache (presumably the OS' native, or closest browser,) so the browser's cache size and other settings may affect Flash's cache behaviour. It is safe to assume a 100 MB MP3 will probably not be cached, for example, but a 16 MB one most likely will be.

+

MP3s appear to be loaded and stored in RAM while loading over HTTP, so memory use needs to be considered for both large MP3s and streaming radio-type applications.

+ +

Timing/Latency (JS + Flash, ExternalInterface-related)

+

Javascript-to-Flash communication is not instantaneous on slower systems, but can be much better on more modern systems. Latency (timing lag/delays) can be noted in some cases from function call to sound execution. It is possible some performance analysis can help to speed up this area for timing-critical applications involving animation etc., but this area has not been thoroughly investigated yet. Brad Neuberg has some notes on speeding up ExternalInterface which may be relevant.

+

Flash-to-OS/hardware latency (where flash reports progress, but no sound is heard for a number of milliseconds) may also be an unfortunate reality of Flash-based audio, varying between platform and OS version etc.

+

Additionally, MP3 files may contain audible gaps at the beginning or end by default when encoded, even if the source (eg. WAVE) file did not. Using optional "nogap" encoding options with programs such as LAME may help to remedy this.

+

Finally, the useHighPerformance option may help with JS/flash lag. Using this option causes the flash movie to be placed with position:fixed on-screen at all times (though in a small, hidden box) and has been shown to notably improve performance on Mac OS X. As well, useFastPolling will use a lower timer interval within Flash, making polling calls run as quickly as reasonably possible and increasing the frequency of calls to whileplaying(), whileloading() and other time-related events.

+ +
+ +
+ +
+ +
+
+

Debug + Console Output

+

Console-style messaging, useful for troubleshooting start-up and runtime issues.

+
+ +
+

Live Debug Output

+

With debug mode enabled via soundManager.debugMode = true, SM2 can write helpful troubleshooting information to javascript console.log()-style interfaces. Additionally, output can be written to an optional DIV element with the ID of "soundmanager-debug".

+

soundManager.consoleOnly can be set to true to disable HTML output (using console.log()-only methods) as well.

+

Additionally, debugging within the Flash portion of SM2 is also available and set using soundManager.debugFlash = true. Debug messages are written to the flash movie itself.

+

For info on SoundManager 2 loading/initialization failures and how to fix them, see troubleshooting.

+ +

Below is a live example of debug output from SM2:

+ +
+
+ +
+
+ +

And, Flash debug output:

+ +
+ +
+ +
+ +
+ + +
+ + + + +
+ + + +
+ + + +
+ +
+ + +
+ + +
+ + + + + + -- cgit v1.2.3-70-g09d2