SoundManager 2: Flashblock / "click to flash" handling demos

Show SWF inline, wait indefinitely for load

You can run this demo with Flash 8 (default), Flash 9 (normal mode) or Flash 9 + highPerformance mode (higher JS callback frequency).

Typically SM2 appends a DIV and hides the SWF off-screen. To handle the flash block case and keep the movie in a visible place, a DIV with the ID of "sm2-container" which SoundManager 2 first looks for when starting up is placed in the HTML. The movie is then appended to that element, and is not moved off-screen as it normally would be.

Additionally, soundManager.flashLoadTimeout is set to 0 in this case instead of the default of 1000 or so. Because of this, SM2 will never time out and will not fire an error (eg. soundManager.onerror()) where it previously would via time-out if the user doesn't have flash, or the SWF was missing, or other normal error cases. Instead, soundManager.oninitmovie is used to set a timeout which can then make the movie visible.

Note that flash blockers may not run when viewing offline (via file://) content, so try viewing this demo online.

CSS applied to #sm2-container, depending on state:

#sm2-container.swf-default {/* Initial state: Hide off screen, or show somewhere obvious */}
#sm2-container.swf-timedout {/* Didn't load before time-out, show to user: On-screen, red border, etc..? */}
#sm2-container.swf-loaded {/* All good: things loaded (no blocker), or after unblock. Move off-screen. */}

SoundManager 2 load status: Loading...

View the source of this page for the details.