From 753f60c7d4769fa72d3b910e491f37db6f130898 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:19:21 -0500 Subject: dymaxion --- docs/dymaxion/dymaxion.js | 777 ++++++ docs/dymaxion/index.html | 200 ++ docs/dymaxion/jquery-1.4.4.min.js | 167 ++ docs/dymaxion/paradis.jpg | Bin 0 -> 29451 bytes docs/dymaxion/soundmanager2.js | 2838 ++++++++++++++++++++ docs/dymaxion/soundmanager2.swf | Bin 0 -> 3090 bytes docs/dymaxion/soundmanager2_debug.swf | Bin 0 -> 3582 bytes docs/dymaxion/soundmanager2_flash9.swf | Bin 0 -> 9527 bytes docs/dymaxion/soundmanager2_flash9_debug.swf | Bin 0 -> 18241 bytes docs/dymaxion/soundmanagerv297a-20101010.zip | Bin 0 -> 3217117 bytes .../soundmanagerv297a-20101010/README.rdoc | 98 + .../demo/360-player/360 button.psd | Bin 0 -> 38695 bytes .../demo/360-player/360-button-pause-light.gif | Bin 0 -> 333 bytes .../demo/360-player/360-button-pause-light.png | Bin 0 -> 445 bytes .../demo/360-player/360-button-pause.gif | Bin 0 -> 333 bytes .../demo/360-player/360-button-pause.png | Bin 0 -> 440 bytes .../demo/360-player/360-button-play-light.gif | Bin 0 -> 442 bytes .../demo/360-player/360-button-play-light.png | Bin 0 -> 501 bytes .../demo/360-player/360-button-play.gif | Bin 0 -> 442 bytes .../demo/360-player/360-button-play.png | Bin 0 -> 487 bytes .../demo/360-player/360player-visualization.css | 88 + .../demo/360-player/360player.css | 258 ++ .../360-player/canvas-visualization-basic.html | 125 + .../demo/360-player/canvas-visualization.html | 328 +++ .../demo/360-player/demo-slider-controls.css | 179 ++ .../demo/360-player/demo-slider-controls.js | 711 +++++ .../demo/360-player/demo.css | 75 + .../demo/360-player/empty.gif | Bin 0 -> 43 bytes .../demo/360-player/icon_loading_dots.gif | Bin 0 -> 1456 bytes .../demo/360-player/icon_loading_spinner.gif | Bin 0 -> 530 bytes .../360-player/icon_loading_spinner_bigger.gif | Bin 0 -> 2545 bytes .../demo/360-player/index.html | 166 ++ .../demo/360-player/script/360player.js | 1270 +++++++++ .../demo/360-player/script/berniecode-animator.js | 674 +++++ .../demo/360-player/script/excanvas.js | 17 + .../demo/_image/360ui-screenshot1.png | Bin 0 -> 11720 bytes .../demo/_image/360ui-screenshot2.png | Bin 0 -> 13149 bytes .../demo/_image/360ui-screenshot3.png | Bin 0 -> 9913 bytes .../demo/_image/360ui-screenshot4.png | Bin 0 -> 20893 bytes .../demo/_image/8tracks-logo.png | Bin 0 -> 1217 bytes .../demo/_image/discogs.gif | Bin 0 -> 544 bytes .../demo/_image/flash9-dark.png | Bin 0 -> 240 bytes .../demo/_image/flash9.png | Bin 0 -> 285 bytes .../demo/_image/getsatisfaction-icon.gif | Bin 0 -> 89 bytes .../demo/_image/hue_thumb.png | Bin 0 -> 140 bytes .../demo/_image/lastfm.png | Bin 0 -> 2242 bytes .../demo/_image/mixcrate.png | Bin 0 -> 1685 bytes .../demo/_image/muxtape-logo.png | Bin 0 -> 3313 bytes .../demo/_image/new-bw.png | Bin 0 -> 201 bytes .../demo/_image/new-dark.png | Bin 0 -> 205 bytes .../soundmanagerv297a-20101010/demo/_image/new.png | Bin 0 -> 228 bytes .../demo/_image/opera.png | Bin 0 -> 2186 bytes .../demo/_image/picker_thumb.png | Bin 0 -> 136 bytes .../demo/_image/slider-1.png | Bin 0 -> 887 bytes .../demo/_image/slider-bar.gif | Bin 0 -> 101 bytes .../demo/_image/slider.png | Bin 0 -> 570 bytes .../demo/_image/soundcloud-thecloudplayer-logo.png | Bin 0 -> 5950 bytes .../demo/_image/speaker.png | Bin 0 -> 6410 bytes .../demo/_image/wedge.png | Bin 0 -> 1799 bytes .../demo/_mp3/1hz-10khz-sweep.mp3 | Bin 0 -> 157987 bytes .../soundmanagerv297a-20101010/demo/_mp3/440hz.mp3 | Bin 0 -> 40541 bytes .../soundmanagerv297a-20101010/demo/_mp3/880hz.mp3 | Bin 0 -> 40541 bytes .../demo/_mp3/background0.mp3 | Bin 0 -> 2160 bytes .../demo/_mp3/background1.mp3 | Bin 0 -> 2592 bytes .../demo/_mp3/background2.mp3 | Bin 0 -> 2592 bytes .../soundmanagerv297a-20101010/demo/_mp3/bass.mp3 | Bin 0 -> 106161 bytes .../demo/_mp3/button-0.mp3 | Bin 0 -> 10240 bytes .../demo/_mp3/button-1.mp3 | Bin 0 -> 10240 bytes .../demo/_mp3/click-high.mp3 | Bin 0 -> 4224 bytes .../demo/_mp3/click-low.mp3 | Bin 0 -> 4224 bytes .../soundmanagerv297a-20101010/demo/_mp3/coins.mp3 | Bin 0 -> 59349 bytes .../demo/_mp3/fancy-beer-bottle-pop.mp3 | Bin 0 -> 113266 bytes .../soundmanagerv297a-20101010/demo/_mp3/mak.mp3 | Bin 0 -> 34271 bytes .../demo/_mp3/mouseover.mp3 | Bin 0 -> 1353 bytes .../demo/_mp3/mouseover2.mp3 | Bin 0 -> 2991 bytes .../demo/_mp3/mouseover3.mp3 | Bin 0 -> 1274 bytes .../demo/_mp3/select.mp3 | Bin 0 -> 10557 bytes .../demo/_mp3/sine, square, sawtooth, rando.mp3 | Bin 0 -> 105742 bytes .../demo/animation-1/css/animation.css | 74 + .../demo/animation-1/image/ball.gif | Bin 0 -> 549 bytes .../demo/animation-1/index.html | 46 + .../demo/animation-1/script/animation.js | 189 ++ .../demo/animation-2a/bg-land.png | Bin 0 -> 1990 bytes .../demo/animation-2a/bg-sky.png | Bin 0 -> 1971 bytes .../demo/animation-2a/cursor-10.cur | Bin 0 -> 2238 bytes .../demo/animation-2a/cursor-11.cur | Bin 0 -> 2998 bytes .../demo/animation-2a/cursor-3.cur | Bin 0 -> 4286 bytes .../demo/animation-2a/cursor-4.cur | Bin 0 -> 4286 bytes .../demo/animation-2a/cursor-5.cur | Bin 0 -> 4286 bytes .../demo/animation-2a/cursor-6.cur | Bin 0 -> 4286 bytes .../demo/animation-2a/cursor-7.cur | Bin 0 -> 4286 bytes .../demo/animation-2a/cursor-8.cur | Bin 0 -> 4286 bytes .../demo/animation-2a/cursor-9.cur | Bin 0 -> 2238 bytes .../demo/animation-2a/cursor-shadow.png | Bin 0 -> 706 bytes .../demo/animation-2a/dot.png | Bin 0 -> 883 bytes .../demo/animation-2a/index.html | 360 +++ .../demo/animation-2b/audio/bonk.mp3 | Bin 0 -> 3342 bytes .../demo/animation-2b/audio/fingerplop.mp3 | Bin 0 -> 3760 bytes .../demo/animation-2b/audio/fingerplop2.mp3 | Bin 0 -> 2088 bytes .../demo/animation-2b/css/animation.css | 36 + .../demo/animation-2b/image/ball.gif | Bin 0 -> 549 bytes .../demo/animation-2b/image/point.png | Bin 0 -> 1938 bytes .../demo/animation-2b/index.html | 21 + .../demo/animation-2b/script/animation.js | 94 + .../demo/animation/audio/bonk.mp3 | Bin 0 -> 3342 bytes .../demo/animation/audio/fingerplop.mp3 | Bin 0 -> 2507 bytes .../demo/animation/audio/fingerplop2.mp3 | Bin 0 -> 1253 bytes .../demo/animation/index.html | 55 + .../soundmanagerv297a-20101010/demo/api/index.html | 676 +++++ .../demo/christmas-lights/christmaslights-home.js | 510 ++++ .../demo/christmas-lights/christmaslights.css | 111 + .../demo/christmas-lights/christmaslights.js | 519 ++++ .../demo/christmas-lights/image/bg-strip-dark.png | Bin 0 -> 237 bytes .../demo/christmas-lights/image/blank.png | Bin 0 -> 205 bytes .../christmas-lights/image/bulbs-32x32-bottom.png | Bin 0 -> 11323 bytes .../christmas-lights/image/bulbs-32x32-left.png | Bin 0 -> 12001 bytes .../christmas-lights/image/bulbs-32x32-right.png | Bin 0 -> 11509 bytes .../christmas-lights/image/bulbs-32x32-top.png | Bin 0 -> 12028 bytes .../christmas-lights/image/bulbs-50x50-bottom.png | Bin 0 -> 24562 bytes .../image/bulbs-50x50-fragments.png | Bin 0 -> 10529 bytes .../christmas-lights/image/bulbs-50x50-left.png | Bin 0 -> 27723 bytes .../christmas-lights/image/bulbs-50x50-right.png | Bin 0 -> 27329 bytes .../christmas-lights/image/bulbs-50x50-top.png | Bin 0 -> 24885 bytes .../demo/christmas-lights/image/bulbs-50x50.png | Bin 0 -> 6547 bytes .../christmas-lights/image/bulbs-64x64-bottom.png | Bin 0 -> 29776 bytes .../christmas-lights/image/bulbs-64x64-left.png | Bin 0 -> 28547 bytes .../christmas-lights/image/bulbs-64x64-right.png | Bin 0 -> 28209 bytes .../christmas-lights/image/bulbs-64x64-top.png | Bin 0 -> 31729 bytes .../christmas-lights/image/bulbs-72x72-bottom.png | Bin 0 -> 35104 bytes .../christmas-lights/image/bulbs-72x72-left.png | Bin 0 -> 33879 bytes .../christmas-lights/image/bulbs-72x72-right.png | Bin 0 -> 33442 bytes .../christmas-lights/image/bulbs-72x72-top.png | Bin 0 -> 37430 bytes .../christmas-lights/image/bulbs-96x96-bottom.png | Bin 0 -> 42948 bytes .../christmas-lights/image/bulbs-96x96-left.png | Bin 0 -> 37495 bytes .../christmas-lights/image/bulbs-96x96-right.png | Bin 0 -> 37860 bytes .../christmas-lights/image/bulbs-96x96-top.png | Bin 0 -> 44103 bytes .../demo/christmas-lights/index.html | 33 + .../demo/christmas-lights/sound/glass0.mp3 | Bin 0 -> 8149 bytes .../demo/christmas-lights/sound/glass1.mp3 | Bin 0 -> 8985 bytes .../demo/christmas-lights/sound/glass2.mp3 | Bin 0 -> 16416 bytes .../demo/christmas-lights/sound/glass3.mp3 | Bin 0 -> 23730 bytes .../demo/christmas-lights/sound/glass4.mp3 | Bin 0 -> 46111 bytes .../demo/christmas-lights/sound/glass5.mp3 | Bin 0 -> 19008 bytes .../yahoo-dom-event-animation-260.js | 35 + .../soundmanagerv297a-20101010/demo/debug.css | 25 + .../demo/flashblock/basic.html | 36 + .../demo/flashblock/flashblock.css | 99 + .../demo/flashblock/index.html | 125 + .../demo/flashblock/method1/flashblock.css | 61 + .../demo/flashblock/method1/flashblock.js | 90 + .../demo/flashblock/method1/index.html | 79 + .../soundmanagerv297a-20101010/demo/index.css | 1715 ++++++++++++ .../soundmanagerv297a-20101010/demo/index.html | 28 + .../soundmanagerv297a-20101010/demo/index.js | 368 +++ .../demo/jsAMP-preview/audio/going_outside.mp3 | Bin 0 -> 225416 bytes .../demo/jsAMP-preview/audio/office_lobby.mp3 | Bin 0 -> 158958 bytes .../demo/jsAMP-preview/audio/rain.mp3 | Bin 0 -> 131357 bytes .../demo/jsAMP-preview/audio/walking.mp3 | Bin 0 -> 64072 bytes .../demo/jsAMP-preview/backgrounds/bg1.jpg | Bin 0 -> 78753 bytes .../demo/jsAMP-preview/backgrounds/bg2.jpg | Bin 0 -> 21982 bytes .../demo/jsAMP-preview/backgrounds/bg3.jpg | Bin 0 -> 39413 bytes .../demo/jsAMP-preview/css/player-light.css | 543 ++++ .../demo/jsAMP-preview/css/player.css | 525 ++++ .../demo/jsAMP-preview/image/btn-next-1.gif | Bin 0 -> 54 bytes .../demo/jsAMP-preview/image/btn-next-1.png | Bin 0 -> 231 bytes .../demo/jsAMP-preview/image/btn-next.gif | Bin 0 -> 106 bytes .../demo/jsAMP-preview/image/btn-next.png | Bin 0 -> 218 bytes .../demo/jsAMP-preview/image/btn-prev-1.gif | Bin 0 -> 53 bytes .../demo/jsAMP-preview/image/btn-prev-1.png | Bin 0 -> 217 bytes .../demo/jsAMP-preview/image/btn-prev.gif | Bin 0 -> 107 bytes .../demo/jsAMP-preview/image/btn-prev.png | Bin 0 -> 212 bytes .../demo/jsAMP-preview/image/loop-light.png | Bin 0 -> 278 bytes .../demo/jsAMP-preview/image/loop.png | Bin 0 -> 270 bytes .../image/notreallyajaxandyouknowit-dark.gif | Bin 0 -> 557 bytes .../image/notreallyajaxandyouknowit-light.gif | Bin 0 -> 557 bytes .../demo/jsAMP-preview/image/sec-left-arr0.gif | Bin 0 -> 168 bytes .../demo/jsAMP-preview/image/sec-left-arr0.png | Bin 0 -> 214 bytes .../demo/jsAMP-preview/image/sec-left-arr1.gif | Bin 0 -> 108 bytes .../demo/jsAMP-preview/image/sec-left-arr1.png | Bin 0 -> 222 bytes .../demo/jsAMP-preview/image/sec-left-arr2.gif | Bin 0 -> 75 bytes .../demo/jsAMP-preview/image/sec-left-pause-1.gif | Bin 0 -> 48 bytes .../demo/jsAMP-preview/image/sec-left-pause.gif | Bin 0 -> 48 bytes .../jsAMP-preview/image/sec-mid-loaded-dark.png | Bin 0 -> 603 bytes .../jsAMP-preview/image/sec-mid-loaded-light.gif | Bin 0 -> 334 bytes .../jsAMP-preview/image/sec-mid-loaded-light.png | Bin 0 -> 509 bytes .../demo/jsAMP-preview/image/sec-mid-loaded.gif | Bin 0 -> 356 bytes .../demo/jsAMP-preview/image/sec-mid-loaded.png | Bin 0 -> 575 bytes .../demo/jsAMP-preview/image/sec-right-arr0.gif | Bin 0 -> 111 bytes .../demo/jsAMP-preview/image/sec-right-arr0.png | Bin 0 -> 174 bytes .../demo/jsAMP-preview/image/sec-right-arr1.png | Bin 0 -> 194 bytes .../demo/jsAMP-preview/image/shade-left.png | Bin 0 -> 260 bytes .../demo/jsAMP-preview/image/shade-right.png | Bin 0 -> 260 bytes .../demo/jsAMP-preview/image/shuffle-0-light.png | Bin 0 -> 192 bytes .../demo/jsAMP-preview/image/shuffle-0.png | Bin 0 -> 189 bytes .../demo/jsAMP-preview/image/shuffle-1-light.png | Bin 0 -> 287 bytes .../demo/jsAMP-preview/image/shuffle-1.png | Bin 0 -> 229 bytes .../demo/jsAMP-preview/image/skin-0-ui.gif | Bin 0 -> 819 bytes .../demo/jsAMP-preview/image/skin-0-ui.png | Bin 0 -> 901 bytes .../demo/jsAMP-preview/image/skin-0-ui__.gif | Bin 0 -> 649 bytes .../demo/jsAMP-preview/image/skin-1-ui.png | Bin 0 -> 827 bytes .../demo/jsAMP-preview/image/skin-2-ui.png | Bin 0 -> 460 bytes .../demo/jsAMP-preview/image/skin-3-ui.gif | Bin 0 -> 1132 bytes .../demo/jsAMP-preview/image/skin-3-ui.png | Bin 0 -> 987 bytes .../demo/jsAMP-preview/image/skin-4-ui.png | Bin 0 -> 998 bytes .../demo/jsAMP-preview/image/slider-1.png | Bin 0 -> 423 bytes .../demo/jsAMP-preview/image/slider-light.gif | Bin 0 -> 540 bytes .../demo/jsAMP-preview/image/slider-light.png | Bin 0 -> 454 bytes .../demo/jsAMP-preview/image/slider.gif | Bin 0 -> 324 bytes .../demo/jsAMP-preview/image/slider.png | Bin 0 -> 428 bytes .../demo/jsAMP-preview/image/speaker-light.png | Bin 0 -> 223 bytes .../demo/jsAMP-preview/image/speaker.png | Bin 0 -> 214 bytes .../demo/jsAMP-preview/image/ui-highlight-0.gif | Bin 0 -> 239 bytes .../demo/jsAMP-preview/image/ui-highlight-0.png | Bin 0 -> 279 bytes .../demo/jsAMP-preview/image/ui-highlight-1.gif | Bin 0 -> 265 bytes .../demo/jsAMP-preview/image/ui-highlight-1.png | Bin 0 -> 285 bytes .../demo/jsAMP-preview/image/ui-highlight-2.gif | Bin 0 -> 320 bytes .../demo/jsAMP-preview/image/ui-highlight-2.png | Bin 0 -> 284 bytes .../demo/jsAMP-preview/image/volume-light.png | Bin 0 -> 210 bytes .../demo/jsAMP-preview/image/volume.png | Bin 0 -> 213 bytes .../demo/jsAMP-preview/image/whiteout.png | Bin 0 -> 484 bytes .../demo/jsAMP-preview/index.html | 241 ++ .../demo/jsAMP-preview/php notes.txt | 25 + .../demo/jsAMP-preview/script/jsamp-preview.js | 1605 +++++++++++ .../demo/mp3-player-button/basic.html | 48 + .../mp3-player-button/css/mp3-player-button.css | 114 + .../mp3-player-button/image/arrow-right-black.gif | Bin 0 -> 67 bytes .../mp3-player-button/image/arrow-right-black.png | Bin 0 -> 167 bytes .../mp3-player-button/image/arrow-right-white.gif | Bin 0 -> 67 bytes .../mp3-player-button/image/arrow-right-white.png | Bin 0 -> 167 bytes .../demo/mp3-player-button/index.html | 188 ++ .../mp3-player-button/script/mp3-player-button.js | 247 ++ .../demo/mpc/acoustic-drumkit.xml | 33 + .../demo/mpc/audio/AMB_BD_1.mp3 | Bin 0 -> 12416 bytes .../demo/mpc/audio/AMB_FTM2.mp3 | Bin 0 -> 15174 bytes .../demo/mpc/audio/AMB_HHCL.mp3 | Bin 0 -> 5642 bytes .../demo/mpc/audio/AMB_HHOP.mp3 | Bin 0 -> 45139 bytes .../demo/mpc/audio/AMB_HHPD.mp3 | Bin 0 -> 7523 bytes .../demo/mpc/audio/AMB_HTM.mp3 | Bin 0 -> 15986 bytes .../demo/mpc/audio/AMB_LTM2.mp3 | Bin 0 -> 20062 bytes .../demo/mpc/audio/AMB_MTM.mp3 | Bin 0 -> 18808 bytes .../demo/mpc/audio/AMB_RIM1.mp3 | Bin 0 -> 5955 bytes .../demo/mpc/audio/AMB_SN13.mp3 | Bin 0 -> 17554 bytes .../demo/mpc/audio/AMB_SN_5.mp3 | Bin 0 -> 15046 bytes .../demo/mpc/audio/CHINA_1.mp3 | Bin 0 -> 46393 bytes .../demo/mpc/audio/CRASH_1.mp3 | Bin 0 -> 61440 bytes .../demo/mpc/audio/CRASH_5.mp3 | Bin 0 -> 53603 bytes .../demo/mpc/audio/CRASH_6.mp3 | Bin 0 -> 44512 bytes .../demo/mpc/audio/RIDE_1.mp3 | Bin 0 -> 49841 bytes .../demo/mpc/audio/RIDE_3.mp3 | Bin 0 -> 38243 bytes .../demo/mpc/audio/SPLASH_1.mp3 | Bin 0 -> 24764 bytes .../demo/mpc/css/mpc.css | 164 ++ .../demo/mpc/image/progress.png | Bin 0 -> 1925 bytes .../soundmanagerv297a-20101010/demo/mpc/index.html | 72 + .../demo/mpc/script/mpc.js | 144 + .../demo/page-player/basic.html | 103 + .../demo/page-player/css/demo.css | 124 + .../demo/page-player/css/optional-annotations.css | 168 ++ .../demo/page-player/css/optional-themes.css | 206 ++ .../demo/page-player/css/page-player.css | 320 +++ .../demo/page-player/image/divot-bottom.png | Bin 0 -> 202 bytes .../demo/page-player/image/divot.png | Bin 0 -> 233 bytes .../demo/page-player/image/top-highlight.png | Bin 0 -> 165 bytes .../demo/page-player/index.html | 367 +++ .../demo/page-player/script/page-player.js | 936 +++++++ .../demo/play-mp3-links/basic.html | 60 + .../demo/play-mp3-links/css/inlineplayer.css | 212 ++ .../demo/play-mp3-links/image/icon_pause.gif | Bin 0 -> 189 bytes .../demo/play-mp3-links/image/icon_pause.png | Bin 0 -> 222 bytes .../demo/play-mp3-links/image/icon_play.gif | Bin 0 -> 193 bytes .../demo/play-mp3-links/image/icon_play.png | Bin 0 -> 291 bytes .../demo/play-mp3-links/image/test.gif | Bin 0 -> 215 bytes .../demo/play-mp3-links/index.html | 228 ++ .../demo/play-mp3-links/script/inlineplayer.js | 246 ++ .../demo/template/deferred-example.html | 127 + .../demo/template/html5-dtd-test.html | 77 + .../demo/template/index.html | 131 + .../demo/template/template.css | 67 + .../demo/template/xhtml-test.xhtml | 86 + .../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 +++ .../dymaxion/soundmanagerv297a-20101010/index.html | 513 ++++ .../soundmanagerv297a-20101010/license.txt | 29 + .../script/soundmanager2-jsmin.js | 96 + .../script/soundmanager2-nodebug-jsmin.js | 71 + .../script/soundmanager2-nodebug.js | 2838 ++++++++++++++++++++ .../script/soundmanager2.js | 2838 ++++++++++++++++++++ .../src/SoundManager2.as | 452 ++++ .../src/SoundManager2_AS3.as | 970 +++++++ .../src/SoundManager2_SMSound_AS3.as | 597 ++++ .../soundmanagerv297a-20101010/src/make-flash8.bat | 5 + .../soundmanagerv297a-20101010/src/make-flash8.sh | 2 + .../soundmanagerv297a-20101010/src/make-flash9.bat | 4 + .../soundmanagerv297a-20101010/src/make-flash9.sh | 2 + .../swf/soundmanager2.swf | Bin 0 -> 3090 bytes .../swf/soundmanager2_debug.swf | Bin 0 -> 3582 bytes .../swf/soundmanager2_flash9.swf | Bin 0 -> 9527 bytes .../swf/soundmanager2_flash9_debug.swf | Bin 0 -> 18241 bytes .../swf/soundmanager2_flash_xdomain.zip | Bin 0 -> 35388 bytes .../troubleshoot/debug.css | 120 + .../troubleshoot/debug.js | 173 ++ .../troubleshoot/fpgss-add-location.png | Bin 0 -> 25513 bytes .../troubleshoot/fpgss-added-location.png | Bin 0 -> 24125 bytes .../troubleshoot/index.html | 154 ++ 306 files changed, 33428 insertions(+) create mode 100644 docs/dymaxion/dymaxion.js create mode 100644 docs/dymaxion/index.html create mode 100644 docs/dymaxion/jquery-1.4.4.min.js create mode 100644 docs/dymaxion/paradis.jpg create mode 100755 docs/dymaxion/soundmanager2.js create mode 100755 docs/dymaxion/soundmanager2.swf create mode 100755 docs/dymaxion/soundmanager2_debug.swf create mode 100755 docs/dymaxion/soundmanager2_flash9.swf create mode 100755 docs/dymaxion/soundmanager2_flash9_debug.swf create mode 100644 docs/dymaxion/soundmanagerv297a-20101010.zip create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/README.rdoc create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360 button.psd create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player-visualization.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization-basic.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/empty.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/icon_loading_dots.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/icon_loading_spinner.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/icon_loading_spinner_bigger.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/360player.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/berniecode-animator.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/excanvas.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot2.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot3.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot4.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/8tracks-logo.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/discogs.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9-dark.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/getsatisfaction-icon.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/hue_thumb.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/lastfm.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/mixcrate.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/muxtape-logo.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-bw.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-dark.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/opera.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/picker_thumb.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-bar.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/soundcloud-thecloudplayer-logo.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/speaker.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_image/wedge.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/1hz-10khz-sweep.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/440hz.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/880hz.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background0.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/bass.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-0.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-high.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-low.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/coins.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/fancy-beer-bottle-pop.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mak.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover3.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/select.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/sine, square, sawtooth, rando.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/css/animation.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/image/ball.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/script/animation.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-land.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-sky.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-10.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-11.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-3.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-4.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-5.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-6.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-7.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-8.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-9.cur create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-shadow.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/dot.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/bonk.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/css/animation.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/ball.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/point.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/script/animation.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation/audio/bonk.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation/audio/fingerplop.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation/audio/fingerplop2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/animation/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/api/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/christmaslights-home.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/christmaslights.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/christmaslights.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bg-strip-dark.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/blank.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-bottom.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-left.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-right.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-top.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-bottom.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-fragments.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-left.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-right.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-top.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-bottom.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-left.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-right.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-top.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-bottom.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-left.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-right.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-top.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-bottom.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-left.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-right.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-top.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass0.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass3.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass4.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass5.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/yahoo-dom-event-animation-260.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/debug.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/basic.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/flashblock.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/index.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/index.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/audio/going_outside.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/audio/office_lobby.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/audio/rain.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/audio/walking.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/backgrounds/bg1.jpg create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/backgrounds/bg2.jpg create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/backgrounds/bg3.jpg create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/css/player-light.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/css/player.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-next-1.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-next-1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-next.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-next.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-prev-1.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-prev-1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-prev.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/btn-prev.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/loop-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/loop.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/notreallyajaxandyouknowit-dark.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/notreallyajaxandyouknowit-light.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-arr0.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-arr0.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-arr1.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-arr1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-arr2.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-pause-1.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-left-pause.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-mid-loaded-dark.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-mid-loaded-light.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-mid-loaded-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-mid-loaded.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-mid-loaded.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-right-arr0.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-right-arr0.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/sec-right-arr1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/shade-left.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/shade-right.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/shuffle-0-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/shuffle-0.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/shuffle-1-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/shuffle-1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-0-ui.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-0-ui.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-0-ui__.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-1-ui.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-2-ui.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-3-ui.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-3-ui.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/skin-4-ui.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/slider-1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/slider-light.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/slider-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/slider.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/slider.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/speaker-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/speaker.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/ui-highlight-0.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/ui-highlight-0.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/ui-highlight-1.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/ui-highlight-1.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/ui-highlight-2.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/ui-highlight-2.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/volume-light.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/volume.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/image/whiteout.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/php notes.txt create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/jsAMP-preview/script/jsamp-preview.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/basic.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/css/mp3-player-button.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/image/arrow-right-black.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/image/arrow-right-black.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/image/arrow-right-white.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/image/arrow-right-white.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mp3-player-button/script/mp3-player-button.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/acoustic-drumkit.xml create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_BD_1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_FTM2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_HHCL.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_HHOP.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_HHPD.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_HTM.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_LTM2.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_MTM.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_RIM1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_SN13.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/AMB_SN_5.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/CHINA_1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/CRASH_1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/CRASH_5.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/CRASH_6.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/RIDE_1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/RIDE_3.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/audio/SPLASH_1.mp3 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/css/mpc.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/image/progress.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/mpc/script/mpc.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/basic.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/css/demo.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/css/optional-annotations.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/css/optional-themes.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/css/page-player.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/image/divot-bottom.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/image/divot.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/image/top-highlight.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/page-player/script/page-player.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/basic.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/css/inlineplayer.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/image/icon_pause.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/image/icon_pause.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/image/icon_play.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/image/icon_play.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/image/test.gif create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/play-mp3-links/script/inlineplayer.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/template/deferred-example.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/template/html5-dtd-test.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/template/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/template/template.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/demo/template/xhtml-test.xhtml 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 create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/index.html create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/license.txt create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2-jsmin.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2-nodebug-jsmin.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2-nodebug.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2.as create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_AS3.as create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_SMSound_AS3.as create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.bat create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.sh create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.bat create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.sh create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2.swf create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_debug.swf create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9.swf create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9_debug.swf create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash_xdomain.zip create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.css create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.js create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-add-location.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-added-location.png create mode 100755 docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/index.html (limited to 'docs/dymaxion') diff --git a/docs/dymaxion/dymaxion.js b/docs/dymaxion/dymaxion.js new file mode 100644 index 0000000..d66d2ed --- /dev/null +++ b/docs/dymaxion/dymaxion.js @@ -0,0 +1,777 @@ +var currentSearch = '' +var currentThread = '' +var keyboard_mode = "navigate" +var idleTimeout = undefined +var fadeInterval = undefined +var faded = false +var qLeftPadding = 20 +/* *************************************************** + 1. page loads + 2. user seraches "dodpop" + << thread list received + 2a user picks thread + << file list received + 3. user picks song 1 + << player enqueues thread + << song 1 starts playing + << if no action is taken, song 2 will be next.. +*************************************************** */ + +var Dymaxion = + { + count: 0, + pos: 0, + nowPlaying: {thread:0,file:0}, + index: {count:0,rows:[],pos:0}, + search: {count:0,rows:[],pos:0}, + thread: {count:0,rows:[],pos:0}, + comment: [], + files: [], + } +var Player = + { + currentSound: false, + nextSound: false, + count: 0, + rows: [], + pos: 0, + threadid: 0, + file: 0, + justbeforefinishMutex: false, + playing: false, + play: function (pos) + { + Player.threadid = Thread.threadid + Player.rows = Dymaxion.thread.rows + Player.count = Dymaxion.thread.rows.length -1 + Player.pos = pos + // 0 thread 1 filename 2 title 3 subtitle + if (Player.pos < Player.count) + Player.playFile(Thread.threadid, Player.rows[Player.pos][1]) + }, + playPrev: function () + { + Player.pos = Player.prev() + if (Thread.threadid === Player.threadid) + Cursor.select(Player.pos) + if (Player.pos < Player.count) + Player.playFile(Thread.threadid, Player.rows[Player.pos][1]) + }, + playNext: function () + { + Player.pos = Player.next() + if (Thread.threadid === Player.threadid) + Cursor.select(Player.pos) + if (Player.pos < Player.count) + Player.playFile(Thread.threadid, Player.rows[Player.pos][1]) + }, + playFile: function (thread, filename) + { + warn('playing '+Player.pos) + if (soundManager.supported()) + { + if (Player.currentSound) + { + Player.currentSound.stop() + Player.currentSound.destruct() + Player.currentSound = false + Player.onjustbeforefinishMutex = '' + } + Player.currentSound = soundManager.createSound + ({ + id: filename, + url: '/bucky/data/'+thread+'/'+filename, + // onload: [ event handler function object ], + }); + Player.currentSound.play(); + } + }, + onbeforefinish: function () + { + var pos = Player.next() + var thread = Thread.threadid + var filename = Player.rows[pos][1] + Player.onjustbeforefinishMutex = filename + warn('loading '+filename) + Player.nextSound = soundManager.createSound + ({ + id: filename, + url: '/bucky/data/'+thread+'/'+filename, + }); + }, + onjustbeforefinish: function () + { + Player.pos = Player.next() + var filename = Player.rows[Player.pos][1] + if (filename === Player.onjustbeforefinishMutex) + { + Player.nextSound.play(); + warn('playing '+Player.pos) + } + else + { + warn('MUTEX: new sound!') + } + }, + cursorPush: function () + { + warn("pushing cursor") + if (Thread.threadid === Player.threadid) + Cursor.select(Player.pos) + }, + onfinish: function () + { + //setTimeout(Player.cursorPush, 2500) + Player.cursorPush() + Player.currentSound.destruct() + Player.currentSound = Player.nextSound + }, + prev: function () + { + var pos = this.pos - 1 + if (pos < 0) + pos = this.count - 1 + return pos + }, + next: function () + { + var pos = this.pos + 1 + if (pos == this.count) + pos = 0 + return pos + }, + loadSoundManager: function () + { + soundManager.debugMode = false + soundManager.url = '/dymaxion/' + soundManager.useFlashBlock = false + soundManager.onready(function() + { + if (soundManager.supported()) + warn('soundmanager loaded') + else + warn('soundmanager did not load!') + }); + soundManager.defaultOptions.onjustbeforefinish = Player.onjustbeforefinish + soundManager.defaultOptions.onbeforefinish = Player.onbeforefinish + soundManager.defaultOptions.onfinish = Player.onfinish + }, + } +var Cursor = + { + mode: "search", + count: 0, + rows: [], + pos: 0, + perpage: 8, + playing: -1, + redrawPage: function () + { + var list = '' + var page = Math.floor(this.pos/this.perpage) + var pos = this.perpage * page + warn('page# ' + page) + for (var i = 0; i < this.perpage && pos < this.count; i++) + { + // 0 thread 1 filename 2 title 3 subtitle + var row = this.rows[pos] + if (row[3]) + { + list += "
  • "+row[2]+"

    " + list += "

    "+row[3]+"

    " + list += "
  • " + } + else + { + list += "
  • "+row[2]+"

    " + list += "
  • " + } + pos += 1 + } + $('#list').html(list) + if (this.pos < this.perpage) + $('#pageup').hide() + else + $('#pageup').show() + if (Math.floor((this.count-1)/this.perpage) === page) + $('#pagedown').hide() + else + $('#pagedown').show() + if (this.playing !== -1) + $('#cursor-'+this.playing).addClass("playing") + $('#list').show() + }, + selectFirst: function () + { + this.select(0) + }, + selectPageUp: function () + { + this.pos -= this.perpage + if (this.pos < 0) + this.pos = this.count - 1 + this.redrawPage() + this.selectOn(this.pos) + }, + selectPageDown: function () + { + this.pos += this.perpage + if (this.pos >= this.count) + this.pos = 0 + this.redrawPage() + this.selectOn(this.pos) + }, + selectPrev: function () + { + this.selectOff(this.pos) + this.pos = this.prev() + if (this.pos % this.perpage === this.perpage - 1 || this.pos === this.count - 1) + this.redrawPage() + this.selectOn(this.pos) + }, + selectNext: function () + { + this.selectOff(this.pos) + this.pos = this.next() + if (this.pos % this.perpage === 0) + this.redrawPage() + this.selectOn(this.pos) + }, + selectOff: function (n) + { + $('#cursor-'+n).removeClass("selected") + }, + selectOn: function (n) + { + $('#cursor-'+n).addClass("selected") + }, + select: function (n) + { + this.selectOff(this.pos) + this.pos = n + this.redrawPage() + warn("AT "+n) + this.selectOn(n) + }, + prev: function () + { + var pos = this.pos - 1 + if (pos < 0) + pos = this.count - 1 + return pos + }, + next: function () + { + var pos = this.pos + 1 + if (pos == this.count) + pos = 0 + return pos + }, + chooseThis: function () + { + return this.choose(this.pos) + }, + choose: function (pos) + { + warn("choose "+pos+" in "+this.mode) + switch (this.mode) + { + case "index": + Dymaxion.search.count = 0 + Dymaxion.index.pos = pos + var thread = $('#cursor-'+pos).attr('data-thread') + var filename = $('#cursor-'+pos).attr('data-filename') + Thread.load(thread, filename) + break + case "search": + Dymaxion.search.pos = pos + var thread = $('#cursor-'+pos).attr('data-thread') + var filename = $('#cursor-'+pos).attr('data-filename') + Thread.load(thread, filename) + break + case "thread": + var thread = $('#cursor-'+pos).attr('data-thread') + var filename = $('#cursor-'+pos).attr('data-filename') + if (this.playing != -1) + $('#cursor-'+this.playing).removeClass("playing") + this.playing = pos + $('#cursor-'+pos).addClass("playing") + Player.play(pos) + break + } + }, + report: function (cmd) + { + warn("> "+cmd+" "+this.pos+" "+this.count) + }, + } +function kp (e) + { + var evt = window.event ? window.event : e + var key = evt.keyCode ? evt.keyCode : e.which + if (faded) + unFade() + else + clearTimeout(idleTimeout) +// warn("keypress " + evt.type + " on " + key) + return keypress(key) + } +function keypress (key) + { + if (keyboard_mode == 'textentry') + return keypress_textentry(key) + document.getElementById('username').innerHTML = '"'+ key +'"' + switch (key) + { + case 27: // escape + Search.lastAutocomplete = ''; + $('#q').blur() + $('#searchbox').hide() + $('header').show() + break + case 33: // pageup + Cursor.selectPageUp(); + break + case 34: // pagedown + Cursor.selectPageDown(); + break + case 38: // up + Cursor.selectPrev(); + break + case 40: // down + Cursor.selectNext(); + break + case 37: // left + if (Cursor.mode === "thread" && Dymaxion.search.count !== 0) + { + Search.display() + } + else + { + Index.display() + } + break + case 39: // right + case 13: // enter + Cursor.chooseThis(); + break + case 177: // prev + case 90: // z + ///////////////// prev + if (Player.count) + Player.playPrev() + break + case 179: // play/pause + case 88: // x + if (Player.currentSound) + Player.currentSound.play() + break + case 67: // c + if (Player.currentSound) + Player.currentSound.togglePause() + break + case 178: // stop + case 86: // v + if (Player.currentSound) + Player.currentSound.stop() + break + case 176: // next + case 66: // b + ///////////////// advance + if (Player.count) + Player.playNext() + break + case 82: // r + window.location.reload() + break + case 71: // g + case 70: // f + show_searchbox() + break + case 72: // h + warn("> HALP!") + Thread.load(1716) + break + case 73: // i + Index.display() + break + } + idleTimeout = setTimeout("startFader()", 1000) + return false + } +function startFader() + { + faded = true + fadeamt = 0.5 + fadeInterval = setInterval("fade()", 420); + } +function fade() + { + if (fadeamt > 0.02) + fadeamt -= 0.0007 + else + { + clearInterval(fadeInterval) + fadeamt = 0.03 + } + $('#listbox').css('opacity', fadeamt) + $('#msg').css('opacity', fadeamt) + $('#pageup').css('opacity', fadeamt) + $('#pagedown').css('opacity', fadeamt) + $('#hello').css('opacity', fadeamt) + $('header').css('opacity', fadeamt) + } +function unFade() + { + clearInterval(fadeInterval) + $('#listbox').css('opacity', 0.5) + $('#msg').css('opacity', 0.5) + $('#pageup').css('opacity', 0.5) + $('#pagedown').css('opacity', 0.5) + $('#hello').css('opacity', 0.5) + $('header').css('opacity', 0.5) + faded = false + } +function show_searchbox() + { + keyboard_mode = "textentry" + $('#q').val('') + $('#frag').hide() + $('header').hide() + $('#searchbox').show() + $('#q').focus() + } +function hide_searchbox() + { + keyboard_mode = 'navigate' + $('#q').blur() + $('#frag').hide() + $('#searchbox').hide() + $('header').show() + Search.lastAutocomplete = ''; + } +function keypress_textentry (key) + { + document.getElementById('username').innerHTML = '"'+ key +'"' + switch (key) + { + case 8: // backspace + $('#frag').hide() + break + case 38: // up + break + case 40: // down + hide_searchbox() + Cursor.select(0) + return + case 27: // esc + hide_searchbox() + Index.display() + break + case 13: // enter + hide_searchbox() + Cursor.select(0) + // search($('#q').val()) + return false + case 32: // space + return true + case 178: // stop + if (Player.currentSound) + Player.currentSound.stop() + return false + } + // for letters in range: 0-z + if (key >= 48 && key <= 90) + { + var q = $('#q').val() + q += String.fromCharCode(key).toLowerCase() + $('#frag').hide() + autocomplete(q) + } + return true + } + +// - /api/login +// + /api/index +// + /api/thread +// + /api/search +// + /api/autocomplete +// - /api/post +// - /api/tag + +var Index = + { + go: function () + { + $('#list').fadeOut(200, function(){ }); + if (! Dymaxion.index.count) + $.get("/cgi-bin/bucky/2/api/index",{},Index.parse) + else + Index.display() + }, + parse: function (raw) + { + if (raw) + warn("got it") + else + warn("index empty") + var lines = raw.split("\n") + var rows = [] + var count = 0 + for (i in lines) + { + if (! lines[i]) + continue + var fields = lines[i].split('\t') + // 0 thread 1 title 2 subtitle 3 filename + rows.push([fields[0],fields[3],fields[1],fields[2]]) + count += 1 + } + Dymaxion.index.rows = rows + Dymaxion.index.count = count + Index.display() + }, + display: function () + { + $('header').html('Bucky Dymaxion') + $('header').fadeIn(500, function(){}) + Cursor.mode = "index" + Cursor.rows = Dymaxion.index.rows + Cursor.count = Dymaxion.index.count + Cursor.select(Dymaxion.index.pos) + $('#list').fadeIn(500, function(){}) + }, + }; +var Search = + { + q: '', + lastAutocomplete: '', + oldSequence: '', + autocompleteTimeout: '', + go: function (q) + { + $('#list').fadeOut(200, function(){}) + $('header').html('Results for ' +q+ '') + $('#frag').html('') + this.q = q + warn ("> " +q); + $.get("/cgi-bin/bucky/2/api/search",{'q':q},Search.parse) + }, + parse: function (raw) + { + warn("got it") + var lines = raw.split("\n") + var rows = [] + var count = 0 + for (i in lines) + { + if (! lines[i]) + continue + var fields = lines[i].split('\t') + // 0 thread 1 title 2 subtitle 3 filename + rows.push([fields[0],fields[3],fields[1],fields[2]]) + count += 1 + } + // if only 1 search result, jump to that page + if (count == 1) + { + Thread.load(rows[0][0],rows[0][3]) + return + } + Dymaxion.search.count = count + Dymaxion.search.rows = rows + Search.display() + }, + display: function () + { + $('header').html("Results for " + this.q + "") + $('header').fadeIn(500, function(){ }) + Cursor.mode = "search"; + Cursor.count = Dymaxion.search.count + Cursor.rows = Dymaxion.search.rows + Cursor.select(Dymaxion.search.pos) + $('#list').fadeIn(500, function(){ }); + }, + autocomplete: function (q) + { + if (q === Search.lastAutocomplete) + { + $('#frag').hide() + $('#frag').html('') + return + } + warn("autocomplete "+q) + Search.oldSequence = q + clearTimeout(Search.autocompleteTimeout) + Search.autocompleteTimeout = setTimeout(Search.autocompleteGo, 200) + }, + autocompleteGo: function (q) + { + $.get("/cgi-bin/bucky/2/api/autocomplete",{'q':q}, Search.autocompleteRaw); + }, + autocompleteRaw: function(raw) + { + if (Search.oldSequence !== q) + { + warn('bailing: '+q) + return; + } + warn('not bailing: '+q) + var lines = raw.split("\n") + var rows = [] + var count = 0 + var frag = '' + for (i in lines) + { + if (! frag) + { + var frag = lines[0] + if (frag === "_") + { + warn("matched full word "+q) + $('#frag').hide() + $('#frag').html('') + Search.q = q + } + else + { + Search.lastAutocomplete = q+frag + var qt = document.getElementById('qtmp') + qt.innerHTML = q + // var qwidth = document.defaultView.getComputedStyle(qt,null).getPropertyValue('offsetWidth'); + var qwidth = qt.offsetWidth + qt.innerHTML = '' + warn("qwidth: "+qwidth) + warn("matched "+q+"_"+frag) + document.getElementById('frag').innerHTML = frag + document.getElementById('frag').style.left = qwidth + qLeftPadding + Search.q = Search.lastAutocomplete + $('#frag').fadeIn(500) + } + continue + } + if (! lines[i]) + continue + var fields = lines[i].split('\t') + // 0 thread 1 title 2 subtitle 3 filename + rows.push([fields[0],fields[3],fields[1],fields[2]]) + count += 1 + } + $('header').html('Results for ' +Search.q+ ''); + Cursor.mode = "search"; + Cursor.count = count + Cursor.rows = rows + Dymaxion.search.count = count + Dymaxion.search.rows = rows + Cursor.redrawPage() + $('#list').fadeIn(200, function(){ }); + warn ("> " +q); + }, + }; +var Thread = + { + thread: false, + threadid: 0, + fileid: 0, + matchpos: 0, + load: function (threadid, fileid) + { + if (! threadid) + return + Thread.threadid = threadid + Thread.fileid = fileid + warn ("loading "+threadid) + $.get("/cgi-bin/bucky/2/api/thread",{'id':threadid},Thread.parse) + }, + parse: function (raw) + { + warn("got it") + var lines = raw.split("\n") + var bg = ''; + var count = 0 + var rows = [] + var thread = false + Thread.matchpos = 0 + for (i in lines) + { + if (! lines[i]) + continue + var fields = lines[i].split('\t') + // thread (first line) + // 0 id 1 title 2 flagged 3 createdate 4 username 5 keyword + if (! thread) + thread = fields + + // file: + // 0 id 1 type 2 filename 3 title 4 date 5 size + else if (fields[1] === 'mp3') + { + // 0 id 1 type 2 filename 3 title 4 date 5 size + rows.push([thread[0],fields[2],fields[3],undefined]) + if (fields[0] === Thread.fileid) + Thread.matchpos = count + count += 1 + } + else if ( + ! bg && + ( thread[2] && fields[0] === thread[2] ) || + (! thread[2] && (fields[1] === 'jpg' || fields[1] === 'gif' || fields[1] === 'png')) + ) + { + bg = fields[2] + $('#background').fadeOut(500, function () + { + warn("bg = "+bg) + warn("/bucky/data/"+Thread.threadid+"/"+bg) + document.getElementById('background').src = "/bucky/data/"+Thread.threadid+"/"+bg + document.getElementById('background').onload = function(){ $('#background').fadeIn(500, function (){}) } + }) + } + // comment: + // 0 id 1 type 2 username 3 date 4 comment + else if (fields[1] === 'comment') + { + if (! fields[4]) + continue + rows.push([thread[0],fields[2],'',fields[4],]) + count += 1 + } + } + Thread.thread = thread + Dymaxion.thread.count = count + Dymaxion.thread.rows = rows + Thread.display() + }, + display: function () + { + $('header').html(Thread.thread[1]); + $('header').fadeIn(500, function(){ }) + Cursor.mode = "thread"; + Cursor.count = Dymaxion.thread.count + Cursor.rows = Dymaxion.thread.rows + if (Thread.fileid) + Cursor.select(Thread.matchpos) + else + Cursor.select(0) + }, + } +function warn(s) + { + var h = document.getElementById('msg').innerHTML + h = s + '
    ' + h + document.getElementById('msg').innerHTML = h + } +function init () + { + warn ("yo") + document.onkeydown = kp + Index.go() + Player.loadSoundManager() + $('#background').hide() + document.getElementById('background').src = "/dymaxion/paradis.jpg" + document.getElementById('background').onload = function(){ $('#background').fadeIn(5000, function (){}) } + // Search.go('surgeon') + // Thread.load(666) + } +init() + diff --git a/docs/dymaxion/index.html b/docs/dymaxion/index.html new file mode 100644 index 0000000..8205393 --- /dev/null +++ b/docs/dymaxion/index.html @@ -0,0 +1,200 @@ + + + + Bucky Dymaxion + + + + + + +
    +
    +
    + +
    hello, ghost
    +
    + +
    +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/dymaxion/jquery-1.4.4.min.js b/docs/dymaxion/jquery-1.4.4.min.js new file mode 100644 index 0000000..8f3ca2e --- /dev/null +++ b/docs/dymaxion/jquery-1.4.4.min.js @@ -0,0 +1,167 @@ +/*! + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 + */ +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
    a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
    ";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
    t
    ";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

    ";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
    ").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/docs/dymaxion/paradis.jpg b/docs/dymaxion/paradis.jpg new file mode 100644 index 0000000..389b82b Binary files /dev/null and b/docs/dymaxion/paradis.jpg differ diff --git a/docs/dymaxion/soundmanager2.js b/docs/dymaxion/soundmanager2.js new file mode 100755 index 0000000..46528c9 --- /dev/null +++ b/docs/dymaxion/soundmanager2.js @@ -0,0 +1,2838 @@ +/** @license + * SoundManager 2: Javascript Sound for the Web + * -------------------------------------------- + * http://schillmania.com/projects/soundmanager2/ + * + * Copyright (c) 2007, Scott Schiller. All rights reserved. + * Code provided under the BSD License: + * http://schillmania.com/projects/soundmanager2/license.txt + * + * V2.97a.20101010 + */ + +/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, regexp: true, newcap: true, immed: true, regexp: false */ +/*global window, SM2_DEFER, sm2Debugger, alert, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */ + +(function(window) { + +var soundManager = null; + +function SoundManager(smURL, smID) { + + this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9. + this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured) + this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues + this.useConsole = true; // use firebug/safari console.log()-type debug console if available + this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug + this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload() + this.nullURL = 'about:blank'; // path to "null" (empty) MP3 file, used to unload sounds (Flash 8 only) + this.allowPolling = true; // allow flash to poll for status update (required for whileplaying() events, peak, sound spectrum functions to work.) + this.useFastPolling = false; // uses lower flash timer interval for higher callback frequency, best combined with useHighPerformance + this.useMovieStar = true; // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio formats (AAC, M4V, FLV, MOV etc.) + this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000' + this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag + this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity) + this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top) + this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain' + this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable. + this.useHTML5Audio = false; // Beta feature: Use HTML 5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible. + this.html5Test = /^probably$/i; // HTML5 Audio().canPlayType() test. /^(probably|maybe)$/i if you want to be more liberal/risky. + this.ondebuglog = false; // callback made with each log message, regardless of debugMode + + this.audioFormats = { + // determines HTML5 support, flash requirements + // eg. if MP3 or MP4 required, Flash fallback is used if HTML5 can't play it + // shotgun approach to MIME testing due to browser variance + 'mp3': { + 'type': ['audio/mpeg; codecs="mp3"','audio/mpeg','audio/mp3','audio/MPA','audio/mpa-robust'], + 'required': true + }, + 'mp4': { + 'related': ['aac','m4a'], // additional formats under the MP4 container + 'type': ['audio/mp4; codecs="mp4a.40.2"','audio/aac','audio/x-m4a','audio/MP4A-LATM','audio/mpeg4-generic'], + 'required': true + }, + 'ogg': { + 'type': ['audio/ogg; codecs=vorbis'], + 'required': false + }, + 'wav': { + 'type': ['audio/wav; codecs="1"','audio/wav','audio/wave','audio/x-wav'], + 'required': false + } + }; + + this.defaultOptions = { + 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can) + 'stream': true, // allows playing before entire file has loaded (recommended) + 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true) + 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0) + 'onid3': null, // callback function for "ID3 data is added/available" + 'onload': null, // callback function for "load finished" + 'whileloading': null, // callback function for "download progress update" (X of Y bytes received) + 'onplay': null, // callback for "play" start + 'onpause': null, // callback for "pause" + 'onresume': null, // callback for "resume" (pause toggle) + 'whileplaying': null, // callback during play (position update) + 'onstop': null, // callback for "user stop" + 'onfailure': null, // callback function for when playing fails + 'onfinish': null, // callback function for "sound finished playing" + 'onbeforefinish': null, // callback for "before sound finished playing (at [time])" + 'onbeforefinishtime': 5000, // offset (milliseconds) before end of sound to trigger beforefinish (eg. 1000 msec = 1 second) + 'onbeforefinishcomplete': null,// function to call when said sound finishes playing + 'onjustbeforefinish': null, // callback for [n] msec before end of current sound + 'onjustbeforefinishtime': 200, // [n] - if not using, set to 0 (or null handler) and event will not fire. + 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time + 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled + 'position': null, // offset (milliseconds) to seek to within loaded sound data. + 'pan': 0, // "pan" settings, left-to-right, -100 to 100 + '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. + }; + + this.flash9Options = { // flash 9-only options, merged into defaultOptions if flash 9 is being used + '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: CPU-INTENSIVE: 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) + 'onstats': null // callback for when connection & play times have been measured + }; + + this.movieStarOptions = { // flash 9.0r115+ MPEG4 audio options, merged into defaultOptions if flash 9+movieStar mode is enabled + 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.) + 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants + 'onconnect': null, // rtmp: callback for connection to flash media server + 'bufferTimes': null, // array of buffer sizes to use. Size increases as buffer fills up. + 'duration': null // rtmp: song duration (msec) + }; + + this.version = null; + this.versionNumber = 'V2.97a.20101010'; + this.movieURL = null; + this.url = (smURL || null); + this.altURL = null; + this.swfLoaded = false; + this.enabled = false; + this.o = null; + this.movieID = 'sm2-container'; + this.id = (smID || 'sm2movie'); + this.swfCSS = { + 'swfBox': 'sm2-object-box', + 'swfDefault': 'movieContainer', + 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error) + 'swfTimedout': 'swf_timedout', + 'swfUnblocked': 'swf_unblocked', // or loaded OK + 'sm2Debug': 'sm2_debug', + 'highPerf': 'high_performance', + 'flashDebug': 'flash_debug' + }; + this.oMC = null; + this.sounds = {}; + this.soundIDs = []; + this.muted = false; + this.debugID = 'soundmanager-debug'; + this.debugURLParam = /([#?&])debug=1/i; + this.specialWmodeCase = false; + this.didFlashBlock = false; + + this.filePattern = null; + this.filePatterns = { + 'flash8': /\.mp3(\?.*)?$/i, + 'flash9': /\.mp3(\?.*)?$/i + }; + + this.baseMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3 + this.netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3, mp4, aac etc. + this.netStreamTypes = ['aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2']; // Flash v9.0r115+ "moviestar" formats + this.netStreamPattern = new RegExp('\\.(' + this.netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); + this.mimePattern = this.baseMimeTypes; + + this.features = { + 'buffering': false, + 'peakData': false, + 'waveformData': false, + 'eqData': false, + 'movieStar': false + }; + + this.sandbox = { + // + 'type': null, + 'types': { + 'remote': 'remote (domain-based) rules', + 'localWithFile': 'local with file access (no internet access)', + 'localWithNetwork': 'local with network (internet access only, no local access)', + 'localTrusted': 'local, trusted (local+internet access)' + }, + 'description': null, + 'noRemote': null, + 'noLocal': null + // + }; + + this.hasHTML5 = null; // switch for handling logic + this.html5 = { // stores canPlayType() results, etc. treat as read-only. + // mp3: boolean + // mp4: boolean + 'usingFlash': null // set if/when flash fallback is needed + }; + this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?) + + // --- private SM2 internals --- + + var SMSound, + _s = this, _sm = 'soundManager', _id, _ua = navigator.userAgent, _wl = window.location.href.toString(), _fV = this.flashVersion, _doc = document, _win = window, _doNothing, _init, _onready = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnReady, _processOnReady, _initUserOnload, _go, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _beginInit, _strings, _initMovie, _dcLoaded, _didDCLoaded, _getDocument, _createMovie, _die, _mobileFlash, _setPolling, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5Only = false, _html5CanPlay, _html5Ext, _dcIE, _testHTML5, _addEvt, _removeEvt, _slice = Array.prototype.slice, + _is_pre = _ua.match(/pre\//i), + _iPadOrPhone = _ua.match(/(ipad|iphone)/i), + _isMobile = (_ua.match(/mobile/i) || _is_pre || _iPadOrPhone), + _isIE = (_ua.match(/MSIE/i)), + _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), + _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), + _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), + _tryInitOnFocus = (typeof _doc.hasFocus === 'undefined' && _isSafari), + _okToDisable = !_tryInitOnFocus; + + this._use_maybe = (_wl.match(/sm2\-useHTML5Maybe\=1/i)); // temporary feature: #sm2-useHTML5Maybe=1 forces loose canPlay() check + this._overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null); + this.useAltURL = !this._overHTTP; // use altURL if not "online" + + if (_iPadOrPhone || _is_pre) { + // might as well force it on Apple + Palm, flash support unlikely + _s.useHTML5Audio = true; + _s.ignoreFlash = true; + } + + if (_is_pre || this._use_maybe) { + // less-strict canPlayType() checking option + _s.html5Test = /^(probably|maybe)$/i; + } + + // Temporary feature: allow force of HTML5 via URL: #sm2-usehtml5audio=0 or 1 + // + (function(){ + var a = '#sm2-usehtml5audio=', l = _wl, b = null; + if (l.indexOf(a) !== -1) { + b = (l.substr(l.indexOf(a)+a.length) === '1'); + if (typeof console !== 'undefined' && typeof console.log !== 'undefined') { + console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter'); + } + _s.useHTML5Audio = b; + } + }()); + // + + // --- public API methods --- + + this.supported = function() { + return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5)); + }; + + this.getMovie = function(smID) { + return _isIE?_win[smID]:(_isSafari?_id(smID) || _doc[smID]:_id(smID)); + }; + + this.loadFromXML = function(sXmlUrl) { + try { + _s.o._loadFromXML(sXmlUrl); + } catch(e) { + _failSafely(); + } + return true; + }; + + this.createSound = function(oOptions) { + var _cs = 'soundManager.createSound(): ', + thisOptions = null, oSound = null, _tO = null; + if (!_didInit || !_s.supported()) { + _complain(_cs + _str(!_didInit?'notReady':'notOK')); + return false; + } + if (arguments.length === 2) { + // function overloading in JS! :) ..assume simple createSound(id,url) use case + oOptions = { + 'id': arguments[0], + 'url': arguments[1] + }; + } + thisOptions = _mixin(oOptions); // inherit from defaultOptions + _tO = thisOptions; // alias + // + if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) { + _s._wD(_cs + _str('badID', _tO.id), 2); + } + _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1); + // + if (_idCheck(_tO.id, true)) { + _s._wD(_cs + _tO.id + ' exists', 1); + return _s.sounds[_tO.id]; + } + + function make() { + thisOptions = _loopFix(thisOptions); + _s.sounds[_tO.id] = new SMSound(_tO); + _s.soundIDs.push(_tO.id); + return _s.sounds[_tO.id]; + } + + if (_html5OK(_tO)) { + oSound = make(); + _s._wD('Loading sound '+_tO.id+' from HTML5'); + oSound._setup_html5(_tO); + } else { + if (_fV > 8 && _s.useMovieStar) { + if (_tO.isMovieStar === null) { + _tO.isMovieStar = ((_tO.serverURL || (_tO.type?_tO.type.match(_s.netStreamPattern):false)||_tO.url.match(_s.netStreamPattern))?true:false); + } + if (_tO.isMovieStar) { + _s._wD(_cs + 'using MovieStar handling'); + } + if (_tO.isMovieStar) { + if (_tO.usePeakData) { + _wDS('noPeak'); + _tO.usePeakData = false; + } + if (_tO.loops > 1) { + _wDS('noNSLoop'); + } + } + } + _tO = _policyFix(_tO, _cs); + oSound = make(); + if (_fV === 8) { + _s.o._createSound(_tO.id, _tO.onjustbeforefinishtime, _tO.loops||1, _tO.usePolicyFile); + } else { + _s.o._createSound(_tO.id, _tO.url, _tO.onjustbeforefinishtime, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.bufferTimes, _tO.onstats ? true : false, _tO.autoLoad, _tO.usePolicyFile); + if (!_tO.serverURL) { + // We are connected immediately + oSound.connected = true; + if (_tO.onconnect) { + _tO.onconnect.apply(oSound); + } + } + } + } + if (_tO.autoLoad || _tO.autoPlay) { + if (oSound) { + if (_s.isHTML5) { + oSound.autobuffer = 'auto'; // early HTML5 implementation (non-standard) + oSound.preload = 'auto'; // standard + } else { + oSound.load(_tO); + } + } + } + if (_tO.autoPlay) { + oSound.play(); + } + return oSound; + }; + + this.destroySound = function(sID, _bFromSound) { + // explicitly destroy a sound before normal page unload, etc. + if (!_idCheck(sID)) { + return false; + } + var oS = _s.sounds[sID], i; + oS._iO = {}; // Disable all callbacks while the sound is being destroyed + oS.stop(); + oS.unload(); + for (i = 0; i < _s.soundIDs.length; i++) { + if (_s.soundIDs[i] === sID) { + _s.soundIDs.splice(i, 1); + break; + } + } + if (!_bFromSound) { + // ignore if being called from SMSound instance + oS.destruct(true); + } + oS = null; + delete _s.sounds[sID]; + return true; + }; + + this.load = function(sID, oOptions) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].load(oOptions); + }; + + this.unload = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].unload(); + }; + + this.play = function(sID, oOptions) { + var fN = 'soundManager.play(): '; + if (!_didInit || !_s.supported()) { + _complain(fN + _str(!_didInit?'notReady':'notOK')); + return false; + } + if (!_idCheck(sID)) { + if (!(oOptions instanceof Object)) { + oOptions = { + url: oOptions + }; // overloading use case: play('mySound','/path/to/some.mp3'); + } + if (oOptions && oOptions.url) { + // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'}); + _s._wD(fN + 'attempting to create "' + sID + '"', 1); + oOptions.id = sID; + return _s.createSound(oOptions).play(); + } else { + return false; + } + } + return _s.sounds[sID].play(oOptions); + }; + + this.start = this.play; // just for convenience + + this.setPosition = function(sID, nMsecOffset) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].setPosition(nMsecOffset); + }; + + this.stop = function(sID) { + if (!_idCheck(sID)) { + return false; + } + _s._wD('soundManager.stop(' + sID + ')', 1); + return _s.sounds[sID].stop(); + }; + + this.stopAll = function() { + _s._wD('soundManager.stopAll()', 1); + for (var oSound in _s.sounds) { + if (_s.sounds[oSound] instanceof SMSound) { + _s.sounds[oSound].stop(); // apply only to sound objects + } + } + }; + + this.pause = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].pause(); + }; + + this.pauseAll = function() { + for (var i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].pause(); + } + }; + + this.resume = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].resume(); + }; + + this.resumeAll = function() { + for (var i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].resume(); + } + }; + + this.togglePause = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].togglePause(); + }; + + this.setPan = function(sID, nPan) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].setPan(nPan); + }; + + this.setVolume = function(sID, nVol) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].setVolume(nVol); + }; + + this.mute = function(sID) { + var fN = 'soundManager.mute(): ', + i = 0; + if (typeof sID !== 'string') { + sID = null; + } + if (!sID) { + _s._wD(fN + 'Muting all sounds'); + for (i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].mute(); + } + _s.muted = true; + } else { + if (!_idCheck(sID)) { + return false; + } + _s._wD(fN + 'Muting "' + sID + '"'); + return _s.sounds[sID].mute(); + } + return true; + }; + + this.muteAll = function() { + _s.mute(); + }; + + this.unmute = function(sID) { + var fN = 'soundManager.unmute(): ', i; + if (typeof sID !== 'string') { + sID = null; + } + if (!sID) { + _s._wD(fN + 'Unmuting all sounds'); + for (i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].unmute(); + } + _s.muted = false; + } else { + if (!_idCheck(sID)) { + return false; + } + _s._wD(fN + 'Unmuting "' + sID + '"'); + return _s.sounds[sID].unmute(); + } + return true; + }; + + this.unmuteAll = function() { + _s.unmute(); + }; + + this.toggleMute = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].toggleMute(); + }; + + this.getMemoryUse = function() { + if (_fV === 8) { + return 0; + } + if (_s.o) { + return parseInt(_s.o._getMemoryUse(), 10); + } + }; + + this.disable = function(bNoDisable) { + // destroy all functions + if (typeof bNoDisable === 'undefined') { + bNoDisable = false; + } + if (_disabled) { + return false; + } + _disabled = true; + _wDS('shutdown', 1); + for (var i = _s.soundIDs.length; i--;) { + _disableObject(_s.sounds[_s.soundIDs[i]]); + } + _initComplete(bNoDisable); // fire "complete", despite fail + _removeEvt(_win, 'load', _initUserOnload); + return true; + }; + + this.canPlayMIME = function(sMIME) { + var result; + if (_s.hasHTML5) { + result = _html5CanPlay({type:sMIME}); + } + if (!_needsFlash || result) { + // no flash, or OK + return result; + } else { + return (sMIME?(sMIME.match(_s.mimePattern)?true:false):null); + } + }; + + this.canPlayURL = function(sURL) { + var result; + if (_s.hasHTML5) { + result = _html5CanPlay(sURL); + } + if (!_needsFlash || result) { + // no flash, or OK + return result; + } else { + return (sURL?(sURL.match(_s.filePattern)?true:false):null); + } + }; + + this.canPlayLink = function(oLink) { + if (typeof oLink.type !== 'undefined' && oLink.type) { + if (_s.canPlayMIME(oLink.type)) { + return true; + } + } + return _s.canPlayURL(oLink.href); + }; + + this.getSoundById = function(sID, suppressDebug) { + if (!sID) { + throw new Error('SoundManager.getSoundById(): sID is null/undefined'); + } + var result = _s.sounds[sID]; + if (!result && !suppressDebug) { + _s._wD('"' + sID + '" is an invalid sound ID.', 2); + } + return result; + }; + + this.onready = function(oMethod, oScope) { + if (oMethod && oMethod instanceof Function) { + if (_didInit) { + _wDS('queue'); + } + if (!oScope) { + oScope = _win; + } + _addOnReady(oMethod, oScope); + _processOnReady(); + return true; + } else { + throw _str('needFunction'); + } + }; + + this.getMoviePercent = function() { + return (_s.o && typeof _s.o.PercentLoaded !== 'undefined'?_s.o.PercentLoaded():null); + }; + + this._writeDebug = function(sText, sType, bTimestamp) { + // If the debug log callback is set, always call it, regardless of debugMode + if (_s.ondebuglog) { + _s.ondebuglog(sText, sType, bTimestamp); + } + // pseudo-private console.log()-style output + // + var sDID = 'soundmanager-debug', o, oItem, sMethod; + if (!_s.debugMode) { + return false; + } + if (typeof bTimestamp !== 'undefined' && bTimestamp) { + sText = sText + ' | ' + new Date().getTime(); + } + if (_hasConsole && _s.useConsole) { + sMethod = _debugLevels[sType]; + if (typeof console[sMethod] !== 'undefined') { + console[sMethod](sText); + } else { + console.log(sText); + } + if (_s.useConsoleOnly) { + return true; + } + } + try { + o = _id(sDID); + if (!o) { + return false; + } + oItem = _doc.createElement('div'); + if (++_wdCount % 2 === 0) { + oItem.className = 'sm2-alt'; + } + if (typeof sType === 'undefined') { + sType = 0; + } else { + sType = parseInt(sType, 10); + } + oItem.appendChild(_doc.createTextNode(sText)); + if (sType) { + if (sType >= 2) { + oItem.style.fontWeight = 'bold'; + } + if (sType === 3) { + oItem.style.color = '#ff3333'; + } + } + // o.appendChild(oItem); // top-to-bottom + o.insertBefore(oItem, o.firstChild); // bottom-to-top + } catch(e) { + // oh well + } + o = null; + // + return true; + }; + this._wD = this._writeDebug; // alias + + this._debug = function() { + // + _wDS('currentObj', 1); + for (var i = 0, j = _s.soundIDs.length; i < j; i++) { + _s.sounds[_s.soundIDs[i]]._debug(); + } + // + }; + + this.reboot = function() { + // attempt to reset and init SM2 + _s._wD('soundManager.reboot()'); + if (_s.soundIDs.length) { + _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...'); + } + for (var i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].destruct(); + } + // trash ze flash + try { + if (_isIE) { + _oRemovedHTML = _s.o.innerHTML; + } + _oRemoved = _s.o.parentNode.removeChild(_s.o); + _s._wD('Flash movie removed.'); + } catch(e) { + // uh-oh. + _wDS('badRemove', 2); + } + // actually, force recreate of movie. + _oRemovedHTML = _oRemoved = null; + _s.enabled = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false; + _s.soundIDs = _s.sounds = []; + _s.o = null; + for (i = _onready.length; i--;) { + _onready[i].fired = false; + } + _s._wD(_sm + ': Rebooting...'); + _win.setTimeout(function() { + _s.beginDelayedInit(); + }, 20); + }; + + this.destruct = function() { + _s._wD('soundManager.destruct()'); + _s.disable(true); + }; + + this.beginDelayedInit = function() { + // _s._wD('soundManager.beginDelayedInit()'); + _windowLoaded = true; + _dcLoaded(); + setTimeout(_beginInit, 20); + _delayWaitForEI(); + }; + + // --- SMSound (sound object) instance --- + + SMSound = function(oOptions) { + var _t = this, _resetProperties, _add_html5_events, _stop_html5_timer, _start_html5_timer, _get_html5_duration, _a; + this.sID = oOptions.id; + this.url = oOptions.url; + this.options = _mixin(oOptions); + this.instanceOptions = this.options; // per-play-instance-specific options + this._iO = this.instanceOptions; // short alias + // assign property defaults + this.pan = this.options.pan; + this.volume = this.options.volume; + this._lastURL = null; + this.isHTML5 = false; + + // --- public methods --- + + this.id3 = {}; + + this._debug = function() { + // + // pseudo-private console.log()-style output + if (_s.debugMode) { + var stuff = null, msg = [], sF, sfBracket, maxLength = 64; + for (stuff in _t.options) { + if (_t.options[stuff] !== null) { + if (_t.options[stuff] instanceof Function) { + // handle functions specially + sF = _t.options[stuff].toString(); + sF = sF.replace(/\s\s+/g, ' '); // normalize spaces + sfBracket = sF.indexOf('{'); + msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }'); + } else { + msg.push(' ' + stuff + ': ' + _t.options[stuff]); + } + } + } + _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}'); + } + // + }; + + this._debug(); + + this.load = function(oOptions) { + var oS = null; + if (typeof oOptions !== 'undefined') { + _t._iO = _mixin(oOptions); + _t.instanceOptions = _t._iO; + } else { + oOptions = _t.options; + _t._iO = oOptions; + _t.instanceOptions = _t._iO; + if (_t._lastURL && _t._lastURL !== _t.url) { + _wDS('manURL'); + _t._iO.url = _t.url; + _t.url = null; + } + } + _s._wD('soundManager.load(): ' + _t._iO.url, 1); + if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) { + _wDS('onURL', 1); + return _t; + } + _t._lastURL = _t.url; + _t.loaded = false; + _t.readyState = 1; + _t.playState = 0; + if (_html5OK(_t._iO)) { + _s._wD('HTML 5 load: '+_t._iO.url); + oS = _t._setup_html5(_t._iO); + oS.load(); + if (_t._iO.autoPlay) { + _t.play(); + } + } else { + try { + _t.isHTML5 = false; + _t._iO = _policyFix(_loopFix(_t._iO)); + if (_fV === 8) { + _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile); + } else { + _s.o._load(_t.sID, _t._iO.url, _t._iO.stream?true:false, _t._iO.autoPlay?true:false, _t._iO.loops||1, _t._iO.autoLoad?true:false, _t._iO.usePolicyFile); + } + } catch(e) { + _wDS('smError', 2); + _debugTS('onload', false); + _die(); + } + } + return _t; + }; + + this.unload = function() { + // Flash 8/AS2 can't "close" a stream - fake it by loading an empty MP3 + // Flash 9/AS3: Close stream, preventing further load + if (_t.readyState !== 0) { + _s._wD('SMSound.unload(): "' + _t.sID + '"'); + if (!_t.isHTML5) { + if (_fV === 8) { + _s.o._unload(_t.sID, _s.nullURL); + } else { + _s.o._unload(_t.sID); + } + } else { + _stop_html5_timer(); + if (_a) { + // abort()-style method here, stop loading? (doesn't exist?) + _a.pause(); + _a.src = _s.nullURL; // needed? does nulling object work? any better way to cancel/unload/abort? + _a.load(); + _t._audio = null; + _a = null; + // delete _t._audio; + } + } + // reset load/status flags + _resetProperties(); + } + return _t; + }; + + this.destruct = function(_bFromSM) { + _s._wD('SMSound.destruct(): "' + _t.sID + '"'); + if (!_t.isHTML5) { + // kill sound within Flash + // Disable the onfailure handler + _t._iO.onfailure = null; + _s.o._destroySound(_t.sID); + } else { + _stop_html5_timer(); + if (_a) { + _a.pause(); + _a.src = 'about:blank'; + _a.load(); + _t._audio = null; + _a = null; + // delete _t._audio; + } + } + if (!_bFromSM) { + _s.destroySound(_t.sID, true); // ensure deletion from controller + } + }; + + this.play = function(oOptions, _updatePlayState) { + var fN = 'SMSound.play(): ', allowMulti; + _updatePlayState = (typeof _updatePlayState === 'undefined' ? true : _updatePlayState); + if (!oOptions) { + oOptions = {}; + } + _t._iO = _mixin(oOptions, _t._iO); + _t._iO = _mixin(_t._iO, _t.options); + _t.instanceOptions = _t._iO; + if (_t._iO.serverURL) { + if (!_t.connected) { + if (!_t.getAutoPlay()) { + _s._wD(fN+' Netstream not connected yet - setting autoPlay'); + _t.setAutoPlay(true); + } + return _t; + } + } + if (_html5OK(_t._iO)) { + _t._setup_html5(_t._iO); + _start_html5_timer(); + } + // KJV paused sounds have playState 1. We want these sounds to play. + if (_t.playState === 1 && !_t.paused) { + allowMulti = _t._iO.multiShot; + if (!allowMulti) { + _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1); + return _t; + } else { + _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1); + if (_t.isHTML5) { + // TODO: BUG? + _t.setPosition(_t._iO.position); + } + } + } + if (!_t.loaded) { + if (_t.readyState === 0) { + _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1); + // try to get this sound playing ASAP + if (!_t.isHTML5) { + if (!_t._iO.serverURL) { + _t._iO.autoPlay = true; + _t.load(_t._iO); + } + } else { + _t.load(_t._iO); + _t.readyState = 1; + } + } else if (_t.readyState === 2) { + _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2); + return _t; + } else { + _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1); + } + } else { + _s._wD(fN + '"' + _t.sID + '"'); + } + // Streams will pause when their buffer is full if they are not auto-playing. + // In this case paused is true, but the song hasn't started playing yet. If + // we just call resume() the onplay() callback will never be called. + + // Also, if we just call resume() in this case and the sound has been muted + // (volume is 0), it will never have its volume set so sound will be heard + // when it shouldn't. + if (_t.paused && _t.position && _t.position > 0) { // https://gist.github.com/37b17df75cc4d7a90bf6 + _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1); + _t.resume(); + } else { + _s._wD(fN+'"'+ _t.sID+'" is starting to play'); + _t.playState = 1; + _t.paused = false; + if (!_t.instanceCount || _t._iO.multiShotEvents || (_fV > 8 && !_t.isHTML5 && !_t.getAutoPlay())) { + _t.instanceCount++; + } + _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0); + _t._iO = _policyFix(_loopFix(_t._iO)); + if (_t._iO.onplay && _updatePlayState) { + _t._iO.onplay.apply(_t); + } + _t.setVolume(_t._iO.volume, true); + _t.setPan(_t._iO.pan, true); + if (!_t.isHTML5) { + _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t.position:_t.position / 1000)); + } else { + _start_html5_timer(); + _t._setup_html5().play(); + } + } + return _t; + }; + + this.start = this.play; // just for convenience + + this.stop = function(bAll) { + if (_t.playState === 1) { + _t._onbufferchange(0); + _t.resetOnPosition(0); + if (!_t.isHTML5) { + _t.playState = 0; + } + _t.paused = false; + if (_t._iO.onstop) { + _t._iO.onstop.apply(_t); + } + if (!_t.isHTML5) { + _s.o._stop(_t.sID, bAll); + // hack for netStream: just unload + if (_t._iO.serverURL) { + _t.unload(); + } + } else { + if (_a) { + _t.setPosition(0); // act like Flash, though + _a.pause(); // html5 has no stop() + _t.playState = 0; + _t._onTimer(); // and update UI + _stop_html5_timer(); + _t.unload(); + } + } + _t.instanceCount = 0; + _t._iO = {}; + } + return _t; + }; + + this.setAutoPlay = function(autoPlay) { + _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off')); + _t._iO.autoPlay = autoPlay; + _s.o._setAutoPlay(_t.sID, autoPlay); + if (autoPlay) { + // KJV Only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP) + if (!_t.instanceCount && _t.readyState === 1) { + _t.instanceCount++; + _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount); + } + } + }; + + this.getAutoPlay = function() { + return _t._iO.autoPlay; + }; + + this.setPosition = function(nMsecOffset, bNoDebug) { + if (nMsecOffset === undefined) { + nMsecOffset = 0; + } + // KJV Use the duration from the instance options, if we don't have a track duration yet. + // Auto-loading streams with a starting position in their options will start playing + // as soon as they connect. In the start() call we set the position on the stream, + // but because the stream hasn't played _t.duration won't have been set (that is + // done in whileloading()). So if we don't have a duration yet, use the duration + // from the instance options, if available. + var position, offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); // position >= 0 and <= current available (loaded) duration + _t.position = offset; + _t.resetOnPosition(_t.position); + if (!_t.isHTML5) { + position = _fV === 9 ? _t.position : _t.position / 1000; + // KJV We want our sounds to play on seek. A progressive download that + // is loaded has paused = false so resume() does nothing and the sound + // doesn't play. Handle that case here. + if (_t.playState === 0) { + _t.play({ position: position }); + } else { + _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); // if paused or not playing, will not resume (by playing) + // if (_t.paused) { + // _t.resume(); + // } + } + } else if (_a) { + _s._wD('setPosition(): setting position to '+(_t.position / 1000)); + if (_t.playState) { + // DOM/JS errors/exceptions to watch out for: + // if seek is beyond (loaded?) position, "DOM exception 11" + // "INDEX_SIZE_ERR": DOM exception 1 + try { + _a.currentTime = _t.position / 1000; + } catch(e) { + _s._wD('setPosition('+_t.position+'): WARN: Caught exception: '+e.message, 2); + } + } else { + _s._wD('HTML 5 warning: cannot set position while playState == 0 (not playing)',2); + } + if (_t.paused) { // if paused, refresh UI right away + _t._onTimer(true); // force update + if (_t._iO.useMovieStar) { + _t.resume(); + } + } + } + return _t; + }; + + this.pause = function(bCallFlash) { + if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) { + return _t; + } + _s._wD('SMSound.pause()'); + _t.paused = true; + if (!_t.isHTML5) { + if (bCallFlash || bCallFlash === undefined) { + _s.o._pause(_t.sID); + } + } else { + _t._setup_html5().pause(); + _stop_html5_timer(); + } + if (_t._iO.onpause) { + _t._iO.onpause.apply(_t); + } + return _t; + }; + + this.resume = function() { + // When auto-loaded streams pause on buffer full they have a playState of 0. + // We need to make sure that the playState is set to 1 when these streams "resume". + if (!_t.paused) { + return _t; + } + _s._wD('SMSound.resume()'); + _t.paused = false; + _t.playState = 1; // TODO: verify that this is needed. + if (!_t.isHTML5) { + _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume) + } else { + _t._setup_html5().play(); + _start_html5_timer(); + } + if (_t._iO.onresume) { + _t._iO.onresume.apply(_t); + } + return _t; + }; + + this.togglePause = function() { + _s._wD('SMSound.togglePause()'); + if (_t.playState === 0) { + _t.play({ + position: (_fV === 9 && !_t.isHTML5 ? _t.position:_t.position / 1000) + }); + return _t; + } + if (_t.paused) { + _t.resume(); + } else { + _t.pause(); + } + return _t; + }; + + this.setPan = function(nPan, bInstanceOnly) { + if (typeof nPan === 'undefined') { + nPan = 0; + } + if (typeof bInstanceOnly === 'undefined') { + bInstanceOnly = false; + } + if (!_t.isHTML5) { + _s.o._setPan(_t.sID, nPan); + } // else { no HTML5 pan? } + _t._iO.pan = nPan; + if (!bInstanceOnly) { + _t.pan = nPan; + } + return _t; + }; + + this.setVolume = function(nVol, bInstanceOnly) { + if (typeof nVol === 'undefined') { + nVol = 100; + } + if (typeof bInstanceOnly === 'undefined') { + bInstanceOnly = false; + } + if (!_t.isHTML5) { + _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); + } else if (_a) { + _a.volume = nVol/100; + } + _t._iO.volume = nVol; + if (!bInstanceOnly) { + _t.volume = nVol; + } + return _t; + }; + + this.mute = function() { + _t.muted = true; + if (!_t.isHTML5) { + _s.o._setVolume(_t.sID, 0); + } else if (_a) { + _a.muted = true; + } + return _t; + }; + + this.unmute = function() { + _t.muted = false; + var hasIO = typeof _t._iO.volume !== 'undefined'; + if (!_t.isHTML5) { + _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); + } else if (_a) { + _a.muted = false; + } + return _t; + }; + + this.toggleMute = function() { + return (_t.muted?_t.unmute():_t.mute()); + }; + + this.onposition = function(nPosition, oMethod, oScope) { + // TODO: allow for ranges, too? eg. (nPosition instanceof Array) + _t._onPositionItems.push({ + position: nPosition, + method: oMethod, + scope: (typeof oScope !== 'undefined'?oScope:_t), + fired: false + }); + return _t; + }; + + this.processOnPosition = function() { + var i, item, j = _t._onPositionItems.length; + if (!j || !_t.playState || _t._onPositionFired >= j) { + return false; + } + for (i=j; i--;) { + item = _t._onPositionItems[i]; + if (!item.fired && _t.position >= item.position) { + item.method.apply(item.scope,[item.position]); + item.fired = true; + _s._onPositionFired++; + } + } + return true; + }; + + this.resetOnPosition = function(nPosition) { + // reset "fired" for items interested in this position + var i, item, j = _t._onPositionItems.length; + if (!j) { + return false; + } + for (i=j; i--;) { + item = _t._onPositionItems[i]; + if (item.fired && nPosition <= item.position) { + item.fired = false; + _s._onPositionFired--; + } + } + return true; + }; + + // pseudo-private soundManager reference + + this._onTimer = function(bForce) { + // HTML 5-only _whileplaying() etc. + var time, x = {}; + if (_t._hasTimer || bForce) { + if (_a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { // TODO: May not need to track readyState (1 = loading) + _t.duration = _get_html5_duration(); + _t.durationEstimate = _t.duration; + time = _a.currentTime?_a.currentTime*1000:0; + _t._whileplaying(time,x,x,x,x); + return true; + } else { + _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK')); + return false; + } + } + }; + + // --- private internals --- + + _get_html5_duration = function() { + var d = (_a?_a.duration*1000:undefined); + return (d && !isNaN(d)?d:null); + }; + + _start_html5_timer = function() { + if (_t.isHTML5) { + _startTimer(_t); + } + }; + + _stop_html5_timer = function() { + if (_t.isHTML5) { + _stopTimer(_t); + } + }; + + _resetProperties = function(bLoaded) { + _t._onPositionItems = []; + _t._onPositionFired = 0; + _t._hasTimer = null; + _t._added_events = null; + _t._audio = null; + _a = null; + _t.bytesLoaded = null; + _t.bytesTotal = null; + _t.position = null; + _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null); + _t.durationEstimate = null; + _t.failures = 0; + _t.loaded = false; + _t.playState = 0; + _t.paused = false; + _t.readyState = 0; // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success + _t.muted = false; + _t.didBeforeFinish = false; + _t.didJustBeforeFinish = false; + _t.isBuffering = false; + _t.instanceOptions = {}; + _t.instanceCount = 0; + _t.peakData = { + left: 0, + right: 0 + }; + _t.waveformData = { + left: [], + right: [] + }; + _t.eqData = []; // legacy: 1D array + _t.eqData.left = []; + _t.eqData.right = []; + }; + + _resetProperties(); + + // pseudo-private methods used by soundManager + + this._setup_html5 = function(oOptions) { + var _iO = _mixin(_t._iO, oOptions); + if (_a) { + if (_t.url !== _iO.url) { + _s._wD('setting new URL on existing object: '+_iO.url); + _a.src = _iO.url; + } + } else { + _s._wD('creating HTML 5 audio element with URL: '+_iO.url); + _t._audio = new Audio(_iO.url); + _a = _t._audio; + _t.isHTML5 = true; + _add_html5_events(); + } + _a.loop = (_iO.loops>1?'loop':''); + return _t._audio; + }; + + // related private methods + + _add_html5_events = function() { + if (_t._added_events) { + return false; + } + _t._added_events = true; + + function _add(oEvt, oFn, bCapture) { + return (_a ? _a.addEventListener(oEvt, oFn, bCapture||false) : null); + } + + _add('load', function(e) { + _s._wD('HTML5::load: '+_t.sID); + if (_a) { + _t._onbufferchange(0); + _t._whileloading(_t.bytesTotal, _t.bytesTotal, _get_html5_duration()); + _t._onload(true); + } + }, false); + + _add('canplay', function(e) { + _s._wD('HTML5::canplay: '+_t.sID); + // enough has loaded to play + _t._onbufferchange(0); + },false); + + _add('waiting', function(e) { + _s._wD('HTML5::waiting: '+_t.sID); + // playback faster than download rate, etc. + _t._onbufferchange(1); + },false); + + _add('progress', function(e) { // not supported everywhere yet.. + _s._wD('HTML5::progress: '+_t.sID+': loaded/total: '+(e.loaded||0)+'/'+(e.total||1)); + if (!_t.loaded && _a) { + _t._onbufferchange(0); // if progress, likely not buffering + _t._whileloading(e.loaded||0, e.total||1, _get_html5_duration()); + } + }, false); + + _add('error', function(e) { + if (_a) { + _s._wD('HTML5::error: '+_a.error.code); + // call load with error state? + _t._onload(false); + } + }, false); + + _add('loadstart', function(e) { + _s._wD('HTML5::loadstart: '+_t.sID); + // assume buffering at first + _t._onbufferchange(1); + }, false); + + _add('play', function(e) { + _s._wD('HTML5::play: '+_t.sID); + // once play starts, no buffering + _t._onbufferchange(0); + }, false); + + // TODO: verify if this is actually implemented anywhere yet. + _add('playing', function(e) { + _s._wD('HTML5::playing: '+_t.sID); + // once play starts, no buffering + _t._onbufferchange(0); + }, false); + + _add('timeupdate', function(e) { + _t._onTimer(); + }, false); + + // avoid stupid premature event-firing bug in Safari(?) + setTimeout(function(){ + if (_t && _a) { + _add('ended',function(e) { + _s._wD('HTML5::ended: '+_t.sID); + _t._onfinish(); + }, false); + } + }, 250); + return true; + }; + + // --- "private" methods called by Flash --- + + this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) { + _t.bytesLoaded = nBytesLoaded; + _t.bytesTotal = nBytesTotal; + _t.duration = Math.floor(nDuration); + _t.bufferLength = nBufferLength; + if (!_t._iO.isMovieStar) { + if (_t._iO.duration) { + // use options, if specified and larger + _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration; + } else { + _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10); + } + if (_t.durationEstimate === undefined) { + _t.durationEstimate = _t.duration; + } + _t.bufferLength = nBufferLength; + if (_t.readyState !== 3 && _t._iO.whileloading) { + _t._iO.whileloading.apply(_t); + } + } else { + _t.durationEstimate = _t.duration; + if (_t.readyState !== 3 && _t._iO.whileloading) { + _t._iO.whileloading.apply(_t); + } + } + }; + + this._onid3 = function(oID3PropNames, oID3Data) { + // oID3PropNames: string array (names) + // ID3Data: string array (data) + _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.'); + var oData = [], i, j; + for (i = 0, j = oID3PropNames.length; i < j; i++) { + oData[oID3PropNames[i]] = oID3Data[i]; + } + _t.id3 = _mixin(_t.id3, oData); + if (_t._iO.onid3) { + _t._iO.onid3.apply(_t); + } + }; + + this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) { + if (isNaN(nPosition) || nPosition === null) { + return false; // Flash may return NaN at times + } + if (_t.playState === 0 && nPosition > 0) { + // invalid position edge case for end/stop + nPosition = 0; + } + _t.position = nPosition; + _t.processOnPosition(); + if (_fV > 8 && !_t.isHTML5) { + if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { + _t.peakData = { + left: oPeakData.leftPeak, + right: oPeakData.rightPeak + }; + } + if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { + _t.waveformData = { + left: oWaveformDataLeft.split(','), + right: oWaveformDataRight.split(',') + }; + } + if (_t._iO.useEQData) { + if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) { + var eqLeft = oEQData.leftEQ.split(','); + _t.eqData = eqLeft; + _t.eqData.left = eqLeft; + if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) { + _t.eqData.right = oEQData.rightEQ.split(','); + } + } + } + } + if (_t.playState === 1) { + // special case/hack: ensure buffering is false if loading from cache (and not yet started) + if (!_t.isHTML5 && _s.flashVersion === 8 && !_t.position && _t.isBuffering) { + _t._onbufferchange(0); + } + if (_t._iO.whileplaying) { + _t._iO.whileplaying.apply(_t); // flash may call after actual finish + } + if ((_t.loaded || (!_t.loaded && _t._iO.isMovieStar)) && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration - _t.position <= _t._iO.onbeforefinishtime) { + _t._onbeforefinish(); + } + } + return true; + }; + + this._onconnect = function(bSuccess) { + var fN = 'SMSound._onconnect(): '; + bSuccess = (bSuccess === 1); + _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2)); + _t.connected = bSuccess; + if (bSuccess) { + _t.failures = 0; + if (_t._iO.onconnect) { + _t._iO.onconnect.apply(_t,[bSuccess]); + } + // don't play if the sound is being destroyed + if (_idCheck(_t.sID) && (_t.options.autoLoad || _t.getAutoPlay())) { + _t.play(undefined, _t.getAutoPlay()); // only update the play state if auto playing + } + } + }; + + this._onload = function(nSuccess) { + var fN = 'SMSound._onload(): ', loadOK = (nSuccess?true:false); + _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2)); + // + if (!loadOK && !_t.isHTML5) { + if (_s.sandbox.noRemote === true) { + _s._wD(fN + _str('noNet'), 1); + } + if (_s.sandbox.noLocal === true) { + _s._wD(fN + _str('noLocal'), 1); + } + } + // + _t.loaded = loadOK; + _t.readyState = loadOK?3:2; + _t._onbufferchange(0); + if (_t._iO.onload) { + _t._iO.onload.apply(_t, [loadOK]); + } + return true; + }; + + // fire onfailure() only once at most + // at this point we just recreate failed sounds rather than trying to reconnect. + this._onfailure = function(msg, level, code) { + _t.failures++; + _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures); + if (_t._iO.onfailure && _t.failures === 1) { + _t._iO.onfailure(_t, msg, level, code); + } else { + _s._wD('SMSound._onfailure(): ignoring'); + } + }; + + this._onbeforefinish = function() { + if (!_t.didBeforeFinish) { + _t.didBeforeFinish = true; + if (_t._iO.onbeforefinish) { + _s._wD('SMSound._onbeforefinish(): "' + _t.sID + '"'); + _t._iO.onbeforefinish.apply(_t); + } + } + }; + + this._onjustbeforefinish = function(msOffset) { + if (!_t.didJustBeforeFinish) { + _t.didJustBeforeFinish = true; + if (_t._iO.onjustbeforefinish) { + _s._wD('SMSound._onjustbeforefinish(): "' + _t.sID + '"'); + _t._iO.onjustbeforefinish.apply(_t); + } + } + }; + + // KJV - connect & play time callback from Flash + this._onstats = function(stats) { + if (_t._iO.onstats) { + _t._iO.onstats(_t, stats); + } + }; + + this._onfinish = function() { + // _s._wD('SMSound._onfinish(): "' + _t.sID + '" got instanceCount '+_t.instanceCount); + _t._onbufferchange(0); + _t.resetOnPosition(0); + if (_t._iO.onbeforefinishcomplete) { + _t._iO.onbeforefinishcomplete.apply(_t); + } + // reset some state items + _t.didBeforeFinish = false; + _t.didJustBeforeFinish = false; + if (_t.instanceCount) { + _t.instanceCount--; + if (!_t.instanceCount) { + // reset instance options + _t.playState = 0; + _t.paused = false; + _t.instanceCount = 0; + _t.instanceOptions = {}; + _stop_html5_timer(); + } + if (!_t.instanceCount || _t._iO.multiShotEvents) { + // fire onfinish for last, or every instance + if (_t._iO.onfinish) { + _s._wD('SMSound._onfinish(): "' + _t.sID + '"'); + _t._iO.onfinish.apply(_t); + } + } + } + }; + + this._onbufferchange = function(nIsBuffering) { + var fN = 'SMSound._onbufferchange()'; + if (_t.playState === 0) { + // ignore if not playing + return false; + } + if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) { + return false; + } + _t.isBuffering = (nIsBuffering === 1); + if (_t._iO.onbufferchange) { + _s._wD(fN + ': ' + nIsBuffering); + _t._iO.onbufferchange.apply(_t); + } + return true; + }; + + this._ondataerror = function(sError) { + // flash 9 wave/eq data handler + if (_t.playState > 0) { // hack: called at start, and end from flash at/after onfinish() + _s._wD('SMSound._ondataerror(): ' + sError); + if (_t._iO.ondataerror) { + _t._iO.ondataerror.apply(_t); + } + } + }; + + }; // SMSound() + + // --- private SM2 internals --- + + _getDocument = function() { + return (_doc.body?_doc.body:(_doc._docElement?_doc.documentElement:_doc.getElementsByTagName('div')[0])); + }; + + _id = function(sID) { + return _doc.getElementById(sID); + }; + + _mixin = function(oMain, oAdd) { + // non-destructive merge + var o1 = {}, i, o2, o; + for (i in oMain) { // clone c1 + if (oMain.hasOwnProperty(i)) { + o1[i] = oMain[i]; + } + } + o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd); + for (o in o2) { + if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') { + o1[o] = o2[o]; + } + } + return o1; + }; + + (function() { + var old = (_win.attachEvent), + evt = { + add: (old?'attachEvent':'addEventListener'), + remove: (old?'detachEvent':'removeEventListener') + }; + + function getArgs(oArgs) { + var args = _slice.call(oArgs), len = args.length; + if (old) { + args[1] = 'on' + args[1]; // prefix + if (len > 3) { + args.pop(); // no capture + } + } else if (len === 3) { + args.push(false); + } + return args; + } + + function apply(args, sType) { + var oFunc = args.shift()[evt[sType]]; + if (old) { + oFunc(args[0], args[1]); + } else { + oFunc.apply(this, args); + } + } + + _addEvt = function() { + apply(getArgs(arguments), 'add'); + }; + + _removeEvt = function() { + apply(getArgs(arguments), 'remove'); + }; + }()); + + _html5OK = function(iO) { + return ((iO.type?_html5CanPlay({type:iO.type}):false)||_html5CanPlay(iO.url)); + }; + + _html5CanPlay = function(sURL) { + // try to find MIME, test and return truthiness + if (!_s.useHTML5Audio || !_s.hasHTML5) { + return false; + } + var result, mime, fileExt, item, aF = _s.audioFormats; + if (!_html5Ext) { + _html5Ext = []; + for (item in aF) { + if (aF.hasOwnProperty(item)) { + _html5Ext.push(item); + if (aF[item].related) { + _html5Ext = _html5Ext.concat(aF[item].related); + } + } + } + _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')','i'); + } + mime = (typeof sURL.type !== 'undefined'?sURL.type:null); + fileExt = (typeof sURL === 'string'?sURL.toLowerCase().match(_html5Ext):null); // TODO: Strip URL queries, etc. + if (!fileExt || !fileExt.length) { + if (!mime) { + return false; + } + } else { + fileExt = fileExt[0].substr(1); // "mp3", for example + } + if (fileExt && typeof _s.html5[fileExt] !== 'undefined') { + // result known + return _s.html5[fileExt]; + } else { + if (!mime) { + if (fileExt && _s.html5[fileExt]) { + return _s.html5[fileExt]; + } else { + // best-case guess, audio/whatever-dot-filename-format-you're-playing + mime = 'audio/'+fileExt; + } + } + result = _s.html5.canPlayType(mime); + _s.html5[fileExt] = result; + // _s._wD('canPlayType, found result: '+result); + return result; + } + }; + + _testHTML5 = function() { + if (!_s.useHTML5Audio || typeof Audio === 'undefined') { + return false; + } + var a = (typeof Audio !== 'undefined' ? new Audio():null), item, support = {}, aF, i; + function _cp(m) { + var canPlay, i, j, isOK = false; + if (!a || typeof a.canPlayType !== 'function') { + return false; + } + if (m instanceof Array) { + // iterate through all mime types, return any successes + for (i=0, j=m.length; i + notReady: 'Not loaded yet - wait for soundManager.onload()/onready()', + notOK: 'Audio support is not available.', + appXHTML: _sm + '::createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.', + spcWmode: _sm + '::createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue', + swf404: _sm + ': Verify that %s is a valid path.', + tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)', + checkSWF: 'See SWF output for more debug info.', + localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/', + waitFocus: _sm + ': Special case: Waiting for focus-related event..', + waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...', + waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...', + needFunction: _sm + '.onready(): Function object expected', + badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character', + noMS: 'MovieStar mode not enabled. Exiting.', + currentObj: '--- ' + _sm + '._debug(): Current sound objects ---', + waitEI: _sm + '::initMovie(): Waiting for ExternalInterface call from Flash..', + waitOnload: _sm + ': Waiting for window.onload()', + docLoaded: _sm + ': Document already loaded', + onload: _sm + '::initComplete(): calling soundManager.onload()', + onloadOK: _sm + '.onload() complete', + init: '-- ' + _sm + '::init() --', + didInit: _sm + '::init(): Already called?', + flashJS: _sm + ': Attempting to call Flash from JS..', + noPolling: _sm + ': Polling (whileloading()/whileplaying() support) is disabled.', + secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html', + badRemove: 'Warning: Failed to remove flash movie.', + noPeak: 'Warning: peakData features unsupported for movieStar formats', + shutdown: _sm + '.disable(): Shutting down', + queue: _sm + '.onready(): Queueing handler', + smFail: _sm + ': Failed to initialise.', + smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.', + fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..', + fbLoaded: 'Flash loaded', + fbHandler: 'soundManager::flashBlockHandler()', + manURL: 'SMSound.load(): Using manually-assigned URL', + onURL: _sm + '.load(): current URL already assigned.', + badFV: 'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.', + as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)', + noNSLoop: 'Note: Looping not implemented for MovieStar formats', + needfl9: 'Note: Switching to flash 9, required for MP4 formats.', + mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case', + mfOn: 'mobileFlash::enabling on-screen flash repositioning', + policy: 'Enabling usePolicyFile for data access' + // + }; + + _id = function(sID) { + return _doc.getElementById(sID); + }; + + _str = function() { // o [,items to replace] + // + var args = _slice.call(arguments), // real array, please + o = args.shift(), // first arg + str = (_strings && _strings[o]?_strings[o]:''), i, j; + if (str && args && args.length) { + for (i = 0, j = args.length; i < j; i++) { + str = str.replace('%s', args[i]); + } + } + return str; + // + }; + + _loopFix = function(sOpt) { + // flash 8 requires stream = false for looping to work + if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) { + _wDS('as2loop'); + sOpt.stream = false; + } + return sOpt; + }; + + _policyFix = function(sOpt, sPre) { + if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) { + _s._wD((sPre?sPre+':':'') + _str('policy')); + sOpt.usePolicyFile = true; + } + return sOpt; + }; + + _complain = function(sMsg) { + if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') { + console.warn(sMsg); + } else { + _s._wD(sMsg); + } + }; + + _doNothing = function() { + return false; + }; + + _disableObject = function(o) { + for (var oProp in o) { + if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') { + o[oProp] = _doNothing; + } + } + oProp = null; + }; + + _failSafely = function(bNoDisable) { + // general failure exception handler + if (typeof bNoDisable === 'undefined') { + bNoDisable = false; + } + if (_disabled || bNoDisable) { + _wDS('smFail', 2); + _s.disable(bNoDisable); + } + }; + + _normalizeMovieURL = function(smURL) { + var urlParams = null; + if (smURL) { + if (smURL.match(/\.swf(\?\.*)?$/i)) { + urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4); + if (urlParams) { + return smURL; // assume user knows what they're doing + } + } else if (smURL.lastIndexOf('/') !== smURL.length - 1) { + smURL = smURL + '/'; + } + } + return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL; + }; + + _setVersionInfo = function() { + if (_fV !== 8 && _fV !== 9) { + _s._wD(_str('badFV', _fV, _defaultFlashVersion)); + _s.flashVersion = _defaultFlashVersion; + } + var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); // debug flash movie, if applicable + if (_s.flashVersion < 9 && _s.useHTML5Audio && _s.audioFormats.mp4.required) { + _s._wD(_str('needfl9')); + _s.flashVersion = 9; + } + _fV = _s.flashVersion; // short-hand for internal use + _s.version = _s.versionNumber + (_html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)')); + // set up default options + if (_fV > 8) { + _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options); + _s.features.buffering = true; + } + if (_fV > 8 && _s.useMovieStar) { + // flash 9+ support for movieStar formats as well as MP3 + _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions); + _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _s.netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); + _s.mimePattern = _s.netStreamMimeTypes; + _s.features.movieStar = true; + } else { + _s.features.movieStar = false; + } + _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')]; + _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf',isDebug); + _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8); + }; + + _setPolling = function(bPolling, bHighPerformance) { + if (!_s.o || !_s.allowPolling) { + return false; + } + _s.o._setPolling(bPolling, bHighPerformance); + }; + + (function() { + var old = (_win.attachEvent), + evt = { + add: (old?'attachEvent':'addEventListener'), + remove: (old?'detachEvent':'removeEventListener') + }; + + function getArgs(oArgs) { + var args = _slice.call(oArgs), len = args.length; + if (old) { + args[1] = 'on' + args[1]; // prefix + if (len > 3) { + args.pop(); // no capture + } + } else if (len === 3) { + args.push(false); + } + return args; + } + + function apply(args, sType) { + var oFunc = args.shift()[evt[sType]]; + if (old) { + oFunc(args[0], args[1]); + } else { + oFunc.apply(this, args); + } + } + + _addEvt = function() { + apply(getArgs(arguments), 'add'); + }; + + _removeEvt = function() { + apply(getArgs(arguments), 'remove'); + }; + }()); + + function _initDebug() { + if (_s.debugURLParam.test(_wl)) { + _s.debugMode = true; // allow force of debug mode via URL + } + // + if (_id(_s.debugID)) { + return false; + } + var oD, oDebug, oTarget, oToggle, tmp; + if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) { + oD = _doc.createElement('div'); + oD.id = _s.debugID + '-toggle'; + oToggle = { + 'position': 'fixed', + 'bottom': '0px', + 'right': '0px', + 'width': '1.2em', + 'height': '1.2em', + 'lineHeight': '1.2em', + 'margin': '2px', + 'textAlign': 'center', + 'border': '1px solid #999', + 'cursor': 'pointer', + 'background': '#fff', + 'color': '#333', + 'zIndex': 10001 + }; + oD.appendChild(_doc.createTextNode('-')); + oD.onclick = _toggleDebug; + oD.title = 'Toggle SM2 debug console'; + if (_ua.match(/msie 6/i)) { + oD.style.position = 'absolute'; + oD.style.cursor = 'hand'; + } + for (tmp in oToggle) { + if (oToggle.hasOwnProperty(tmp)) { + oD.style[tmp] = oToggle[tmp]; + } + } + oDebug = _doc.createElement('div'); + oDebug.id = _s.debugID; + oDebug.style.display = (_s.debugMode?'block':'none'); + if (_s.debugMode && !_id(oD.id)) { + try { + oTarget = _getDocument(); + oTarget.appendChild(oD); + } catch(e2) { + throw new Error(_str('appXHTML')); + } + oTarget.appendChild(oDebug); + } + } + oTarget = null; + // + } + + _mobileFlash = (function(){ + + var oM = null; + + function resetPosition() { + if (oM) { + oM.left = oM.top = '-9999px'; + } + } + + function reposition() { + oM.left = _win.scrollX+'px'; + oM.top = _win.scrollY+'px'; + } + + function setReposition(bOn) { + _s._wD('mobileFlash::flash on-screen hack: '+(bOn?'ON':'OFF')); + var f = _win[(bOn?'add':'remove')+'EventListener']; + f('resize', reposition, false); + f('scroll', reposition, false); + } + + function check(inDoc) { + // mobile flash (Android for starters) check + oM = _s.oMC.style; + if (_ua.match(/android/i)) { + if (inDoc) { + if (_s.flashLoadTimeout) { + _s._wDS('mfTimeout'); + _s.flashLoadTimeout = 0; + } + return false; + } + _s._wD('mfOn'); + oM.position = 'absolute'; + oM.left = oM.top = '0px'; + setReposition(true); + _s.onready(function(){ + setReposition(false); // detach + resetPosition(); // restore when OK/timed out + }); + reposition(); + } + return true; + } + + return { + 'check': check + }; + + }()); + + _createMovie = function(smID, smURL) { + + var specialCase = null, + remoteURL = (smURL?smURL:_s.url), + localURL = (_s.altURL?_s.altURL:remoteURL), + oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), s, x, sClass, side = '100%', isRTL = null, html = _doc.getElementsByTagName('html')[0]; + isRTL = (html && html.dir && html.dir.match(/rtl/i)); + smID = (typeof smID === 'undefined'?_s.id:smID); + + if (_didAppend && _appendSuccess) { + return false; // ignore if already succeeded + } + + function _initMsg() { + _s._wD('-- SoundManager 2 ' + _s.version + (!_html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (_s.useMovieStar?', MovieStar mode':'') + (_s.useHighPerformance?', high performance mode, ':', ') + ((_s.useFastPolling?'fast':'normal') + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') + ' --', 1); + } + + if (_html5Only) { + _setVersionInfo(); + _initMsg(); + _s.oMC = _id(_s.movieID); + _init(); + // prevent multiple init attempts + _didAppend = true; + _appendSuccess = true; + return false; + } + + _didAppend = true; + + // safety check for legacy (change to Flash 9 URL) + _setVersionInfo(); + _s.url = _normalizeMovieURL(this._overHTTP?remoteURL:localURL); + smURL = _s.url; + + _s.wmode = (!_s.wmode && _s.useHighPerformance && !_s.useMovieStar?'transparent':_s.wmode); + + if (_s.wmode !== null && !_isIE && !_s.useHighPerformance && navigator.platform.match(/win32/i)) { + _s.specialWmodeCase = true; + // extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here + // does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout + _wDS('spcWmode'); + _s.wmode = null; + } + + oEmbed = { + 'name': smID, + 'id': smID, + 'src': smURL, + 'width': side, + 'height': side, + 'quality': 'high', + 'allowScriptAccess': _s.allowScriptAccess, + 'bgcolor': _s.bgColor, + 'pluginspage': 'http://www.macromedia.com/go/getflashplayer', + 'type': 'application/x-shockwave-flash', + 'wmode': _s.wmode + }; + + if (_s.debugFlash) { + oEmbed.FlashVars = 'debug=1'; + } + + if (!_s.wmode) { + delete oEmbed.wmode; // don't write empty attribute + } + + if (_isIE) { + // IE is "special". + oMovie = _doc.createElement('div'); + movieHTML = '' + (_s.wmode?' ':'') + '' + (_s.debugFlash?'':'') + ''; + } else { + oMovie = _doc.createElement('embed'); + for (tmp in oEmbed) { + if (oEmbed.hasOwnProperty(tmp)) { + oMovie.setAttribute(tmp, oEmbed[tmp]); + } + } + } + + _initDebug(); + extraClass = _getSWFCSS(); + oTarget = _getDocument(); + + if (oTarget) { + _s.oMC = _id(_s.movieID)?_id(_s.movieID):_doc.createElement('div'); + if (!_s.oMC.id) { + _s.oMC.id = _s.movieID; + _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; + // "hide" flash movie + s = null; + oEl = null; + if (!_s.useFlashBlock) { + if (_s.useHighPerformance) { + s = { + 'position': 'fixed', + 'width': '8px', + 'height': '8px', + // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes. + 'bottom': '0px', + 'left': '0px', + 'overflow': 'hidden' + }; + } else { + s = { + 'position': 'absolute', + 'width': '6px', + 'height': '6px', + 'top': '-9999px', + 'left': '-9999px' + }; + if (isRTL) { + s.left = Math.abs(parseInt(s.left,10))+'px'; + } + } + } + if (_ua.match(/webkit/i)) { + _s.oMC.style.zIndex = 10000; // soundcloud-reported render/crash fix, safari 5 + } + if (!_s.debugFlash) { + for (x in s) { + if (s.hasOwnProperty(x)) { + _s.oMC.style[x] = s[x]; + } + } + } + try { + if (!_isIE) { + _s.oMC.appendChild(oMovie); + } + oTarget.appendChild(_s.oMC); + if (_isIE) { + oEl = _s.oMC.appendChild(_doc.createElement('div')); + oEl.className = _s.swfCSS.swfBox; + oEl.innerHTML = movieHTML; + } + _appendSuccess = true; + } catch(e) { + throw new Error(_str('appXHTML')); + } + _mobileFlash.check(); + } else { + // it's already in the document. + sClass = _s.oMC.className; + _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); + _s.oMC.appendChild(oMovie); + if (_isIE) { + oEl = _s.oMC.appendChild(_doc.createElement('div')); + oEl.className = _s.swfCSS.swfBox; + oEl.innerHTML = movieHTML; + } + _appendSuccess = true; + _mobileFlash.check(true); + } + } + + if (specialCase) { + _s._wD(specialCase); + } + + _initMsg(); + _s._wD('soundManager::createMovie(): Trying to load ' + smURL + (!this._overHTTP && _s.altURL?' (alternate URL)':''), 1); + + return true; + }; + + _idCheck = this.getSoundById; + + _initMovie = function() { + if (_html5Only) { + _createMovie(); + return false; + } + // attempt to get, or create, movie + if (_s.o) { + return false; // may already exist + } + _s.o = _s.getMovie(_s.id); // inline markup + if (!_s.o) { + if (!_oRemoved) { + // try to create + _createMovie(_s.id, _s.url); + } else { + // try to re-append removed movie after reboot() + if (!_isIE) { + _s.oMC.appendChild(_oRemoved); + } else { + _s.oMC.innerHTML = _oRemovedHTML; + } + _oRemoved = null; + _didAppend = true; + } + _s.o = _s.getMovie(_s.id); + } + if (_s.o) { + _s._wD('soundManager::initMovie(): Got '+_s.o.nodeName+' element ('+(_didAppend?'created via JS':'static HTML')+')'); + _wDS('waitEI'); + } + if (_s.oninitmovie instanceof Function) { + setTimeout(_s.oninitmovie, 1); + } + return true; + }; + + _go = function(sURL) { + // where it all begins. + if (sURL) { + _s.url = sURL; + } + _initMovie(); + }; + + _delayWaitForEI = function() { + setTimeout(_waitForEI, 500); + }; + + _waitForEI = function() { + if (_waitingForEI) { + return false; + } + _waitingForEI = true; + _removeEvt(_win, 'load', _delayWaitForEI); + if (_tryInitOnFocus && !_isFocused) { + _wDS('waitFocus'); + return false; + } + var p; + if (!_didInit) { + p = _s.getMoviePercent(); + _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':'')))); + } + setTimeout(function() { + p = _s.getMoviePercent(); + if (!_didInit) { + _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2); + if (!this._overHTTP && p) { + _wDS('localFail', 2); + if (!_s.debugFlash) { + _wDS('tryDebug', 2); + } + } + if (p === 0) { + // if 0 (not null), probably a 404. + _s._wD(_str('swf404', _s.url)); + } + _debugTS('flashtojs', false, ': Timed out' + this._overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)'); + } + // give up / time-out, depending + if (!_didInit && _okToDisable) { + if (p === null) { + // SWF failed. Maybe blocked. + if (_s.useFlashBlock || _s.flashLoadTimeout === 0) { + if (_s.useFlashBlock) { + _flashBlockHandler(); + } + _wDS('waitForever'); + } else { + // old SM2 behaviour, simply fail + _failSafely(true); + } + } else { + // flash loaded? Shouldn't be a blocking issue, then. + if (_s.flashLoadTimeout === 0) { + _wDS('waitForever'); + } else { + _failSafely(true); + } + } + } + }, _s.flashLoadTimeout); + }; + + _go = function(sURL) { + // where it all begins. + if (sURL) { + _s.url = sURL; + } + _initMovie(); + }; + + // + _wDS = function(o, errorLevel) { + if (!o) { + return ''; + } else { + return _s._wD(_str(o), errorLevel); + } + }; + + if (_wl.indexOf('debug=alert') + 1 && _s.debugMode) { + _s._wD = function(sText) {alert(sText);}; + } + + _toggleDebug = function() { + var o = _id(_s.debugID), + oT = _id(_s.debugID + '-toggle'); + if (!o) { + return false; + } + if (_debugOpen) { + // minimize + oT.innerHTML = '+'; + o.style.display = 'none'; + } else { + oT.innerHTML = '-'; + o.style.display = 'block'; + } + _debugOpen = !_debugOpen; + }; + + _debugTS = function(sEventType, bSuccess, sMessage) { + // troubleshooter debug hooks + if (typeof sm2Debugger !== 'undefined') { + try { + sm2Debugger.handleEvent(sEventType, bSuccess, sMessage); + } catch(e) { + // oh well + } + } + return true; + }; + // + + _getSWFCSS = function() { + var css = []; + if (_s.debugMode) { + css.push(_s.swfCSS.sm2Debug); + } + if (_s.debugFlash) { + css.push(_s.swfCSS.flashDebug); + } + if (_s.useHighPerformance) { + css.push(_s.swfCSS.highPerf); + } + return css.join(' '); + }; + + _flashBlockHandler = function() { + // *possible* flash block situation. + var name = _str('fbHandler'), p = _s.getMoviePercent(); + if (!_s.supported()) { + if (_needsFlash) { + // make the movie more visible, so user can fix + _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + ' ' + (p === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); + _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':'')); + } + _s.didFlashBlock = true; + _processOnReady(true); // fire onready(), complain lightly + if (_s.onerror instanceof Function) { + _s.onerror.apply(_win); + } + } else { + // SM2 loaded OK (or recovered) + if (_s.didFlashBlock) { + _s._wD(name+': Unblocked'); + } + if (_s.oMC) { + _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + (' '+_s.swfCSS.swfUnblocked); + } + } + }; + + _handleFocus = function() { + function cleanup() { + _removeEvt(_win, 'focus', _handleFocus); + _removeEvt(_win, 'load', _handleFocus); + } + if (_isFocused || !_tryInitOnFocus) { + cleanup(); + return true; + } + _okToDisable = true; + _isFocused = true; + _s._wD('soundManager::handleFocus()'); + if (_isSafari && _tryInitOnFocus) { + // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event + _removeEvt(_win, 'mousemove', _handleFocus); + } + // allow init to restart + _waitingForEI = false; + cleanup(); + return true; + }; + + _initComplete = function(bNoDisable) { + if (_didInit) { + return false; + } + if (_html5Only) { + // all good. + _s._wD('-- SoundManager 2: loaded --'); + _didInit = true; + _processOnReady(); + _initUserOnload(); + return true; + } + var sClass = _s.oMC.className, + wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()); + if (!wasTimeout) { + _didInit = true; + } + _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1); + if (_disabled || bNoDisable) { + if (_s.useFlashBlock) { + _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); + } + _processOnReady(); + _debugTS('onload', false); + if (_s.onerror instanceof Function) { + _s.onerror.apply(_win); + } + return false; + } else { + _debugTS('onload', true); + } + if (_s.waitForWindowLoad && !_windowLoaded) { + _wDS('waitOnload'); + _addEvt(_win, 'load', _initUserOnload); + return false; + } else { + if (_s.waitForWindowLoad && _windowLoaded) { + _wDS('docLoaded'); + } + _initUserOnload(); + } + return true; + }; + + _addOnReady = function(oMethod, oScope) { + _onready.push({ + 'method': oMethod, + 'scope': (oScope || null), + 'fired': false + }); + }; + + _processOnReady = function(ignoreInit) { + if (!_didInit && !ignoreInit) { + // not ready yet. + return false; + } + var status = { + success: (ignoreInit?_s.supported():!_disabled) + }, + queue = [], i, j, + canRetry = (!_s.useFlashBlock || (_s.useFlashBlock && !_s.supported())); + for (i = 0, j = _onready.length; i < j; i++) { + if (_onready[i].fired !== true) { + queue.push(_onready[i]); + } + } + if (queue.length) { + _s._wD(_sm + ': Firing ' + queue.length + ' onready() item' + (queue.length > 1?'s':'')); + for (i = 0, j = queue.length; i < j; i++) { + if (queue[i].scope) { + queue[i].method.apply(queue[i].scope, [status]); + } else { + queue[i].method(status); + } + if (!canRetry) { // flashblock case doesn't count here + queue[i].fired = true; + } + } + } + return true; + }; + + _initUserOnload = function() { + _win.setTimeout(function() { + if (_s.useFlashBlock) { + _flashBlockHandler(); + } + _processOnReady(); + _wDS('onload', 1); + // call user-defined "onload", scoped to window + if (_s.onload instanceof Function) { + _s.onload.apply(_win); + } + _wDS('onloadOK', 1); + if (_s.waitForWindowLoad) { + _addEvt(_win, 'load', _initUserOnload); + } + },1); + }; + + _featureCheck = function() { + var needsFlash, item, + isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_(3|4)/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Known Apple "radar" bug. https://bugs.webkit.org/show_bug.cgi?id=32159 + isSpecial = (_ua.match(/iphone os (1|2|3_0|3_1)/i)?true:false); // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works. + if (isSpecial) { + _s.hasHTML5 = false; // has Audio(), but is broken; let it load links directly. + _html5Only = true; // ignore flash case, however + if (_s.oMC) { + _s.oMC.style.display = 'none'; + } + return false; + } + if (_s.useHTML5Audio) { + if (!_s.html5 || !_s.html5.canPlayType) { + _s._wD('SoundManager: No HTML5 Audio() support detected.'); + _s.hasHTML5 = false; + return true; + } else { + _s.hasHTML5 = true; + } + if (isBadSafari) { + _s._wD('SoundManager::Note: Buggy HTML5 Audio in Safari on OS X 10.6.[3|4], see https://bugs.webkit.org/show_bug.cgi?id=32159 - disabling HTML5 audio',1); + _s.useHTML5Audio = false; + _s.hasHTML5 = false; + return true; + } + } else { + // flash required. + return true; + } + for (item in _s.audioFormats) { + if (_s.audioFormats.hasOwnProperty(item) && _s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) { + // may need flash for this format? + needsFlash = true; + } + } + // sanity check.. + if (_s.ignoreFlash) { + needsFlash = false; + } + _html5Only = (_s.useHTML5Audio && _s.hasHTML5 && !needsFlash); + return needsFlash; + }; + + _init = function() { + var item, tests = []; + _wDS('init'); + + // called after onload() + if (_didInit) { + _wDS('didInit'); + return false; + } + + function _cleanup() { + _removeEvt(_win, 'load', _s.beginDelayedInit); + } + + if (_s.hasHTML5) { + for (item in _s.audioFormats) { + if (_s.audioFormats.hasOwnProperty(item)) { + tests.push(item+': '+_s.html5[item]); + } + } + _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1); + } + + if (_html5Only) { + if (!_didInit) { + // we don't need no steenking flash! + _cleanup(); + _s.enabled = true; + _initComplete(); + } + return true; + } + + // flash path + _initMovie(); + try { + _wDS('flashJS'); + _s.o._externalInterfaceTest(false); // attempt to talk to Flash + if (!_s.allowPolling) { + _wDS('noPolling', 1); + } else { + _setPolling(true, _s.useFastPolling?true:false); + } + if (!_s.debugMode) { + _s.o._disableDebug(); + } + _s.enabled = true; + _debugTS('jstoflash', true); + } catch(e) { + _s._wD('js/flash exception: ' + e.toString()); + _debugTS('jstoflash', false); + _failSafely(true); // don't disable, for reboot() + _initComplete(); + return false; + } + _initComplete(); + // event cleanup + _cleanup(); + return true; + }; + + _beginInit = function() { + if (_initPending) { + return false; + } + _createMovie(); + _initMovie(); + _initPending = true; + return true; + }; + + _dcLoaded = function() { + if (_didDCLoaded) { + return false; + } + _didDCLoaded = true; + _initDebug(); + _testHTML5(); + _s.html5.usingFlash = _featureCheck(); + _needsFlash = _s.html5.usingFlash; + _didDCLoaded = true; + if (_doc.removeEventListener) { + _doc.removeEventListener('DOMContentLoaded', _dcLoaded, false); + } + _go(); + return true; + }; + + _startTimer = function(oSound) { + if (!oSound._hasTimer) { + oSound._hasTimer = true; + } + }; + + _stopTimer = function(oSound) { + if (oSound._hasTimer) { + oSound._hasTimer = false; + } + }; + + _die = function() { + if (_s.onerror instanceof Function) { + _s.onerror(); + } + _s.disable(); + }; + + // pseudo-private methods called by Flash + + this._setSandboxType = function(sandboxType) { + // + var sb = _s.sandbox; + sb.type = sandboxType; + sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')]; + _s._wD('Flash security sandbox type: ' + sb.type); + if (sb.type === 'localWithFile') { + sb.noRemote = true; + sb.noLocal = false; + _wDS('secNote', 2); + } else if (sb.type === 'localWithNetwork') { + sb.noRemote = false; + sb.noLocal = true; + } else if (sb.type === 'localTrusted') { + sb.noRemote = false; + sb.noLocal = false; + } + // + }; + + this._externalInterfaceOK = function(flashDate) { + // flash callback confirming flash loaded, EI working etc. + // flashDate = approx. timing/delay info for JS/flash bridge + if (_s.swfLoaded) { + return false; + } + var eiTime = new Date().getTime(); + _s._wD('soundManager::externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':'')); + _debugTS('swf', true); + _debugTS('flashtojs', true); + _s.swfLoaded = true; + _tryInitOnFocus = false; + if (_isIE) { + // IE needs a timeout OR delay until window.onload - may need TODO: investigating + setTimeout(_init, 100); + } else { + _init(); + } + }; + + _dcIE = function() { + if (_doc.readyState === 'complete') { + _dcLoaded(); + _doc.detachEvent('onreadystatechange', _dcIE); + } + return true; + }; + + // focus and window load, init + if (!_s.hasHTML5 || _needsFlash) { + // only applies to Flash mode + _addEvt(_win, 'focus', _handleFocus); + _addEvt(_win, 'load', _handleFocus); + _addEvt(_win, 'load', _delayWaitForEI); + if (_isSafari && _tryInitOnFocus) { + _addEvt(_win, 'mousemove', _handleFocus); // massive Safari focus hack + } + } + + if (_doc.addEventListener) { + _doc.addEventListener('DOMContentLoaded', _dcLoaded, false); + } else if (_doc.attachEvent) { + _doc.attachEvent('onreadystatechange', _dcIE); + } else { + // no add/attachevent support - safe to assume no JS -> Flash either + _debugTS('onload', false); + _die(); + } + + if (_doc.readyState === 'complete') { + setTimeout(_dcLoaded,100); + } + +} // SoundManager() + +// var SM2_DEFER = true; +// details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading + +if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) { + soundManager = new SoundManager(); +} + +// public interfaces +window.SoundManager = SoundManager; // constructor +window.soundManager = soundManager; // public instance: API, Flash callbacks etc. + +}(window)); diff --git a/docs/dymaxion/soundmanager2.swf b/docs/dymaxion/soundmanager2.swf new file mode 100755 index 0000000..4d2dc23 Binary files /dev/null and b/docs/dymaxion/soundmanager2.swf differ diff --git a/docs/dymaxion/soundmanager2_debug.swf b/docs/dymaxion/soundmanager2_debug.swf new file mode 100755 index 0000000..01ce0ea Binary files /dev/null and b/docs/dymaxion/soundmanager2_debug.swf differ diff --git a/docs/dymaxion/soundmanager2_flash9.swf b/docs/dymaxion/soundmanager2_flash9.swf new file mode 100755 index 0000000..dad27ea Binary files /dev/null and b/docs/dymaxion/soundmanager2_flash9.swf differ diff --git a/docs/dymaxion/soundmanager2_flash9_debug.swf b/docs/dymaxion/soundmanager2_flash9_debug.swf new file mode 100755 index 0000000..cdffb46 Binary files /dev/null and b/docs/dymaxion/soundmanager2_flash9_debug.swf differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010.zip b/docs/dymaxion/soundmanagerv297a-20101010.zip new file mode 100644 index 0000000..b9931d8 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010.zip differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/README.rdoc b/docs/dymaxion/soundmanagerv297a-20101010/README.rdoc new file mode 100755 index 0000000..b121244 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/README.rdoc @@ -0,0 +1,98 @@ +== SoundManager 2: JavaScript Sound for the Web + +By wrapping and extending HTML5 and Flash Audio APIs, SoundManager 2 brings reliable cross-platform audio to JavaScript. + +== HTML5 Audio() Support (Beta-ish) + + * 100% Flash-free MP3 + MP4/AAC where supported, compatible with Apple iPad 3.2, iPhone/iOS 4 + * Fallback to Flash for MP3/MP4 support, as needed + * SM2 API is unchanged, transparent; HTML5/flash switching handled internally + * HTML5 API support approximates Flash 8 API features, minus ID3, plus buffering + * Some other formats (WAV/OGG) supported via HTML5, depending on browser + * See soundManager.useHTML5Audio for implementation details. + +== Basic API Features (Flash 8) + + * Load, stop, play, pause, mute, seek, pan and volume control of sounds from Javascript + * Events: onload, whileloading, whileplaying, onfinish and more + * ID3V1 and ID3V2 tag support for MP3s (title, artist, genre etc.) + +== Shiny Flash 9 Features + + * RTMP / Flash Media Server streaming support (new, experimental) + * MPEG-4 (AAC, HE-AAC, H.264) audio support + * "MultiShot" play (layered/chorusing effects) + * Waveform/frequency spectrum data + * Peak (L/R channel volume) data + * Audio buffering state/event handling + +== General Tech Stuff + + * Full API Documentation with examples and notes + * console.log()-style debug output and troubleshooting tools + * Community-based discussion/support + +== As heard on The Internets + +A few nifty sites that have implemented SM2 for driving audio: + + * Muxtape + * SoundCloud / The Cloud Player + * 8tracks + * Last.fm + * Opera (media player component) + * Discogs + * Mixcrate + +== Project home, documentation, live demos etc.: + +http://www.schillmania.com/projects/soundmanager2/ + + +== Merged fork ( kjvarga: http://github.com/kjvarga/SoundManager2/ ) + +This SM2 fork contains the SoundManager2 implementation that is used on http://www.kazaa.com. + +We added RTMP support to SM2 which is now part of the SM2 (experimental) branch as of V2.96a.20100606. + +Downloads: http://www.schillmania.com/projects/soundmanager2/doc/download/ + +For more background on the addition of RTMP check out http://getsatisfaction.com/schillmania/topics/soundmanager_doesnt_support_rtmp + +Our old branch of development has been moved to http://github.com/kjvarga/SoundManager2/tree/pre_merge. + +== Changes + +In addition to the documented SM2 options, we have added the following. + +New options to SM2: + +* ondebuglog callback called with every debugging message. Useful if you need to programatically have access to the debug logs. We use this in our automated reporting of stream failures for QA. + +New options to createSound: + +* bufferTimes optional array of buffer times for double/multiple-buffering. Just specify an array of incrementing buffer sizes (in seconds) e.g. [0.5, 2, 8] for a half-second, then 2 second, then 8 second buffer. Buffers increment when full and reset to the smallest buffer when empty, or when starting to play an unbuffered portion of the stream. +* onstats callback called with statistics including how long it took to connect to the server, and how long it took to play (useful for QA). + +Our FMS server has some peculiarities that we have to deal with: +* bytesLoaded is always 0 for a streaming sound +* NetStream.Play.Stop is sent when it shouldn't +* We cannot get the stream length using a typical getStreamLength call +* We cannot get bandwidth information + +== Debugging + +1. Set soundManager.debugFlash = true; +2. Use a debug version of the SWF e.g. soundmanager2_flash9_debug.swf +3. Open the Flash IDE. Open the SM2 source code files. Start a remote debugging session. +4. Refresh the application in the browser (make sure caching is off). +5. The SWF should connect to Flash and allow you to step through the source. + +If it doesn't: +1. Make sure that the Flash version you have installed supports debugging +2. Make sure that the Flash debugger application is using the same version of Flash. + +== SM2 + +Project home, documentation, live demos etc.: +http://www.schillmania.com/projects/soundmanager2/ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360 button.psd b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360 button.psd new file mode 100755 index 0000000..afd0498 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360 button.psd differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.gif new file mode 100755 index 0000000..cf9eab3 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.png new file mode 100755 index 0000000..8f66539 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause-light.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.gif new file mode 100755 index 0000000..6e589ea Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.png new file mode 100755 index 0000000..dc84def Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-pause.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.gif new file mode 100755 index 0000000..eb36483 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.png new file mode 100755 index 0000000..a2f6557 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play-light.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.gif new file mode 100755 index 0000000..b97cd7f Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.png new file mode 100755 index 0000000..ce2d9a3 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360-button-play.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player-visualization.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player-visualization.css new file mode 100755 index 0000000..96cc582 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player-visualization.css @@ -0,0 +1,88 @@ +/* larger canvas, spectrum + EQ visualization and other items */ + +.ui360, +.sm2-360ui { + /* size of the container for the circle, etc. */ + width:256px; + height:256px; +} + +.ui360 { + position:relative; + /* a little extra spacing */ + padding-top:1px; + padding-bottom:1px; + margin-bottom:-18px; /* approximate "line height" we want */ + padding-left:248px; + margin-left:0px; + background-position:22.6% 50%; /* (~109px) initial play button position */ +} + +.ui360 a { + font:14px "helvetica neue",helvetica,monaco,lucida,terminal,monospace; + white-space:nowrap; + line-height:256px; +} + +.sm2-360ui { + margin-left:-256px; +} + +.ui360 .sm2-timing { + line-height:256px; +} + +.ui360 .sm2-timing { + font:bold 24px "helvetica neue",helvetica,monaco,lucida,terminal,monospace; + color:#333; + text-align:center; + line-height:256px; + text-indent:0px; +} + +.sm2-inline-list .ui360, +.sm2-inline-list .sm2-360ui { + margin-left:0px; +} + +.sm2-inline-list .ui360 { + margin:8px 13px 7px 0px; + padding-left:0px; + background-position:50% 50%; /* initial play button position */ +} + +.sm2-inline-list .sm2-360ui { + border:1px solid #eee; +} + +.sm2-inline-list .ui360 a { + position:absolute; + left:0px; + bottom:0px; + margin-left:1px; + width:100%; /* 2px padding in box */ + height:auto; + font-size:x-small; + padding:2px 0px; + color:#999; + line-height:15px; + text-align:center; + display:inline; + -moz-border-radius:0px; + -khtml-border-radius:0px; + border-radius:0px; +} + +.sm2-inline-list .ui360 a:focus, +.sm2-inline-list .ui360 a:active { + background-color:transparent; +} + +/* Use a bigger loading image for this layout */ + +.ui360 .sm2-360ui.sm2_buffering .sm2-360btn, +.ui360 .sm2-360ui.sm2_buffering .sm2-360btn:hover { + background:transparent url(icon_loading_spinner_bigger.gif) no-repeat 50% 50%; + opacity:0.5; + visibility:visible; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player.css new file mode 100755 index 0000000..a961dc5 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/360player.css @@ -0,0 +1,258 @@ +/* General warning: Beta-ish. Code could be a bit cleaner. */ + +.ui360, +.ui360 * { + position:relative; +} + +.ui360, +.sm2-360ui { + /* size of the container for the circle, etc. */ + width:50px; + height:50px; +} + +.ui360 { + position:relative; + /* a little extra spacing */ + padding-top:1px; + padding-bottom:1px; + margin-bottom:-18px; /* approximate "line height" we want */ + padding-left:42px; /* 50px, with a few off - margin used for visualization UI */ +} + +.ui360 a { + line-height:50px; +} + +.sm2-360ui { + margin-left:-50px; +} + +.ui360 { + width:auto; +} + +.ui360, +.ui360 * { + vertical-align:middle; +} + +.sm2-360ui { + position:relative; + display:inline-block; /* firefox 3 et al */ + float:left; /* firefox 2 needs this, inline-block would work with fx3 and others */ + *float:left; /* IE 6+7 */ + *display:inline; + *clear:left; +} + +.sm2-360ui.sm2_playing, +.sm2-360ui.sm2_paused { + /* bump on top when active */ + z-index:10; +} + +.ui360 a.sm2_link { /* this class added to playable links by SM2 */ + position:relative; +} + +.ui360 a { + color:#000; + text-decoration:none; +} + +.ui360 a, +.ui360 a:hover, +.ui360 a:focus { + padding:2px; + margin-left:-2px; + margin-top:-2px; +} + +.ui360 a:hover, +.ui360 a:focus { + background:#eee; + -moz-border-radius:3px; + -webkit-border-radius:3px; + -khtml-border-radius:3px; + border-radius:3px; + outline:none; +} + +.ui360 .sm2-canvas { + position:absolute; + left:0px; + top:0px; +} + +.ui360 .sm2-timing { + position:absolute; + display:block; + left:0px; + top:0px; + width:100%; + height:100%; + margin:0px; + font:11px "helvetica neue",helvetica,monaco,lucida,terminal,monospace; + color:#666; + text-align:center; + line-height:50px; +} + +.ui360 .sm2-timing.alignTweak { + text-indent:1px; /* devious center-alignment tweak for Safari (might break things for others.) */ +} + +.ui360 .sm2-cover { + position:absolute; + left:0px; + top:0px; + z-index:2; + display:none; +} + +.ui360 .sm2-360btn { + position:absolute; + top:50%; + left:50%; + width:22px; + height:22px; + margin-left:-11px; + margin-top:-11px; + cursor:pointer; + z-index:3; +} + +.ui360 .sm2-360btn-default { +} + +.ui360 .sm2-360data { + display:inline-block; + font-family:helvetica; +} + +.ui360 .sm2-360ui.sm2_playing .sm2-cover, +.ui360 .sm2-360ui.sm2_paused .sm2-cover { + display:block; +} + +/* this could be optimized a fair bit. */ + +.ui360, +.ui360 .sm2-360btn-default { + background:transparent url(360-button-play.png) no-repeat 50% 50%; + _background:transparent url(360-button-play.gif) no-repeat 50% 50%; /* IE 6-only: special crap GIF */ + cursor:pointer; +} + +.ui360 { + /* + "fake" button shown before SM2 has started, non-JS/non-SM2 case etc. + background image will be removed via JS, in threeSixyPlayer.init() + */ + background-position:6px 50%; +} + +.ui360 .sm2-360ui.sm2_paused .sm2-360btn { + background:transparent url(360-button-play.png) no-repeat 50% 50%; + _background:transparent url(360-button-play.gif) no-repeat 50% 50%; + cursor:pointer; +} + +.ui360 .sm2-360btn-default:hover, +.ui360 .sm2-360ui.sm2_paused .sm2-360btn:hover { + background:transparent url(360-button-play-light.png) no-repeat 50% 50%; + _background:transparent url(360-button-play.gif) no-repeat 50% 50%; + cursor:pointer; +} + +.ui360 .sm2-360ui.sm2_playing .sm2-360btn:hover, +.ui360 .sm2-360btn-playing:hover { + background:transparent url(360-button-pause-light.png) no-repeat 50% 50%; + _background:transparent url(360-button-pause-light.gif) no-repeat 50% 50%; + cursor:pointer; +} + + +.ui360 .sm2-360ui.sm2_playing .sm2-timing { + visibility:visible; +} + +.ui360 .sm2-360ui.sm2_buffering .sm2-timing { + visibility:hidden; +} + +.ui360 .sm2-360ui .sm2-timing, +.ui360 .sm2-360ui .sm2-360btn:hover + .sm2-timing, +.ui360 .sm2-360ui.sm2_paused .sm2-timing { + visibility:hidden; +} + +.ui360 .sm2-360ui.sm2_dragging .sm2-timing, +.ui360 .sm2-360ui.sm2_dragging .sm2-360btn:hover + .sm2-timing { + /* paused + dragging */ + visibility:visible; +} + +.ui360 .sm2-360ui.sm2_playing .sm2-360btn, +x.ui360 .sm2-360btn-playing, +.ui360 .sm2-360ui.sm2_dragging .sm2-360btn, +.ui360 .sm2-360ui.sm2_dragging .sm2-360btn:hover, +.ui360 .sm2-360ui.sm2_dragging .sm2-360btn-playing:hover { + /* don't let pause button show on hover when dragging (or paused and dragging) */ + background:transparent; + cursor:auto; +} + +.ui360 .sm2-360ui.sm2_buffering .sm2-360btn, +.ui360 .sm2-360ui.sm2_buffering .sm2-360btn:hover { + background:transparent url(icon_loading_spinner.gif) no-repeat 50% 50%; + opacity:0.5; + visibility:visible; +} + +/* inline list style */ + +.sm2-inline-list .ui360, +.sm2-inline-block .ui360 { + position:relative; + display:inline-block; + float:left; + _display:inline; + margin-bottom:-15px; +} + +.sm2-inline-list .ui360 { + margin-bottom:0px; +} + +.sm2-inline-block .ui360 { + margin-right:8px; +} + +.sm2-inline-list .ui360 a { + display:none; +} + +/* annotations */ + +ul.ui360playlist { + list-style-type:none; +} + +ul.ui360playlist, +ul.ui360playlist li { + margin:0px; + padding:0px; +} + +div.ui360 div.metadata { + display:none; +} + +div.ui360 a span.metadata, +div.ui360 a span.metadata * { + /* name of track, note etc. */ + vertical-align:baseline; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization-basic.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization-basic.html new file mode 100755 index 0000000..789846b --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization-basic.html @@ -0,0 +1,125 @@ + + + +360° MP3 player UI demo (SoundManager 2): Javascript + Canvas Visualization, basic example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +

    360° Player Demo - Visualization Example, Basic Template

    + +

    Canvas-based UI with visualization options. Note: No EQ/spectrum support for IE (too slow.) Data not available in HTML5.

    + +
    + +
    + +
    + + + +

    Inline list

    + +
    + + + + + + +
    + +

    Block list

    + + + +
    + +

    + SoundManager 2 project page (not an MP3 link) +

    + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization.html new file mode 100755 index 0000000..cb8071f --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/canvas-visualization.html @@ -0,0 +1,328 @@ + + + +360° MP3 player UI demo (SoundManager 2): Javascript + Canvas Visualization + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +

    SoundManager 2 / 360° Player Demo: JS + Canvas Visualization

    + +

    Canvas-based UI with visualization options. Note: Spectrum/EQ visualizations disabled for IE (too slow.) Data is not currently available under HTML5.

    +

    You can also show FPS or customize the UI, or see the hi-fi version. Check the basic template for a minimal code example; also see the default 360° UI.

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

    Inline list

    + + + +

    "I Tried" and "People Asking" courtesy of SonReal, from the "Lightyear" Mixtape.

    + +

    Block list

    + + + + +
    + +

    Variant: Annotations/meta-data

    + + +
      + +
    • + +
      + A Virtual Haircut (3 scenes) + +
      + +
    • + +
    • + +
      + Rubber Chicken Launch (Office) + + + + +
      + +
    • + +
    + +
    + +

    + SoundManager 2 project page (not an MP3 link) +

    + + + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.css new file mode 100755 index 0000000..27281c0 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.css @@ -0,0 +1,179 @@ +#cp-container { position:relative;float:left;display:inline; margin-left:1em;padding: 6px; background-color: #f6f6f6; border:1px solid #eee; width: 320px; height:180px;z-index:2; } + +.yui-picker-controls li, +.yui-picker-controls input { + font-size:1em; + font-family:"helvetica neue",helvetica,arial,verdana; +} + +#controls { + position:relative; + margin-top:1.5em; + font-size:0.85em; +} + +#options { + float:left; + display:inline; + margin-bottom:0.5em; + margin-top:-1.2em; +} + +#controls .checkbox { + float:left; + display:inline; + width:21.2em; + margin-right:2.5em; +} + +#controls .checkbox div { + /* tab */ + width:auto; + padding:0.4em; + border:1px solid #ddd; + border-bottom:none; + background:#eee; +} + +#controls .checkbox div, +#controls .checkbox input { + font-family:arial,tahoma,verdana,"sans serif"; + font-size:1em; + vertical-align:middle; +} + +#controls dl { + width:21em; +} + +#controls dl.col { + position:relative; + float:left; + display:inline; + margin:0px; + margin-right:1em; + padding:0.75em; +/* + height:12.4em; +*/ + height:auto; + border:1px solid #ddd; + background:#f6f6f6; +} + +#controls .disabled { + color:#ccc; +} + +#controls .disabled dt, +#controls .disabled dd { + color:#999; + opacity:0.5; +} + +#controls dl dd p { + margin:0px; + padding:0px; +} + +#controls dt, +#controls dd { + margin:0px; + padding:0px; +} + +#controls dt { + border-bottom:none; +} + +#controls dt { + float:left; + display:inline; + background:transparent; + padding-right:0.7em; + margin-right:0.7em; + border-right:1px solid #ccc; + font-size:1.1em; + color:#333; + font-family:"helvetica neue",helvetica,verdana,arial,"sans serif"; +} + +#controls dd { + margin:0px; + padding:0px; + font-size:0.9em; + vertical-align:middle; + color:#666; +} + +#controls .title { + float:left; + display:inline; + margin-right:0.6em; + color:#333; +} + +/* those slider bits you might be wondering about */ + +#controls .control { + position:relative; + border-left:0px; + width:214px; + height:20px; +} + +#controls .control .bar { + position:absolute; + left:0px; + top:0px; + width:214px; + height:20px; + background:transparent url(../_image/slider-bar.gif) no-repeat 0px 9px; + cursor:pointer; + cursor:hand; +} + +#controls .control .slider { + position:absolute; + left:0px; + top:0px; + width:20px; + height:20px; + background:transparent url(../_image/slider.png) no-repeat 0px 0px; + *background:none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='../_image/slider.png'); + cursor:pointer; + cursor:hand; +} + +#controls .control .slider:hover { + background:transparent url(../_image/slider-1.png) no-repeat 0px 0px; + *background:none; +} + +#controls .control .slider.hover { + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='../_image/slider-1.png'); +} + +#controls .disabled .control .slider { + background:transparent url(../_image/slider-disabled.png) no-repeat 0px 0px; + *background:none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='../_image/slider-disabled.png'); +} + +#controls .disabled .control .slider:hover { + background:transparent url(../_image/slider-disabled-1.png) no-repeat 0px 0px; + *background:none; +} + +#controls .disabled .control .slider.hover { + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='../_image/slider-disabled-1.png'); +} + +#controls input[type=text] { + width:5em; +} + +#options div { + margin-bottom:0.25em; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.js new file mode 100755 index 0000000..16a02dc --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/demo-slider-controls.js @@ -0,0 +1,711 @@ +/* + Ancient fireworks slider control code (2005) + http://schillmania.com/projects/fireworks/ + -------------------------------------------- + Not required for your use! +*/ + +function Animator2() { + var self = this; + this.tweens = []; + this.tweens['default'] = [1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]; + this.tweens['blast'] = [12,12,11,10,10,9,8,7,6,5,4,3,2,1]; + this.tweens['fade'] = [10,10,10,10,10,10,10,10,10,10]; + this.queue = []; + this.queue.IDs = []; + this.active = false; + this.timer = null; + + this.createTween = function(start,end,type) { + // return array of tween coordinate data (start->end) + type = type||'default'; + var tween = [start]; + var tmp = start; + var diff = end-start; + var x = self.tweens[type].length; + for (var i=0; i= 0.4 && pos <= 0.6) { + pos = 0.5; + } + pos = parseInt(pos*100); + // writeDebug('getPanX('+x+'): '+pos+'%'); + return pos; + } + + this.isEmpty = function(o) { + // needs further hacking + return (typeof(o)=='undefined'||(o==null&&o!=0)||(o==''&&o!=0)||o=='null'); + } + + this.init = function() { +// self.oFW = document.getElementById('fw'); +// self.oFP = document.getElementById('fp'); +// if (typeof(enableDebugMode)!='undefined' && (self.DEBUG||window.location.toString().toLowerCase().indexOf('debug')>=0)) enableDebugMode(); + self.getWindowCoords(); + self.animator = new Animator2(); + } + + this.destructor = function() { +/* + for (var i=self.fireworks.length; i--;) { + self.fireworks[i] = null; + } + self.fireworks = null; + if (soundManager) { + soundManager.destructor(); + soundManager = null; + } +*/ + } + + if (this.isSafari || this.isOpera) this.getWindowCoords = this.getWindowCoordsAlt; + +} + + +function Controller(o) { + var self = this; + this.o = o; + this.controls = []; + this.cb = []; + this.options = []; + this.functionExample = document.getElementById('function-example'); + this.fbIE = null; + + this.randomize = function() { + for (var i=1; i,\n\ + playRingColor: '"+threeSixtyPlayer.config.playRingColor+"',\n\ + backgroundRingColor: '"+threeSixtyPlayer.config.backgroundRingColor+"',\n\ + circleDiameter: "+threeSixtyPlayer.config.circleDiameter+",\n\ + circleRadius: "+threeSixtyPlayer.config.circleRadius+",\n\ + imageRoot: '"+threeSixtyPlayer.config.imageRoot+"',\n\ + animDuration: "+threeSixtyPlayer.config.animDuration+",\n\ + animTransition: Animator.tx.bouncy,\n\ + showHMSTime: "+threeSixtyPlayer.config.showHMSTime+",\n\ +\n\ + useWaveformData: "+threeSixtyPlayer.config.useWaveformData+",\n\ + waveformDataColor: '"+threeSixtyPlayer.config.waveformDataColor+"',\n\ + waveformDataDownsample: "+threeSixtyPlayer.config.waveformDataDownsample+",\n\ + waveformDataOutside: "+threeSixtyPlayer.config.waveformDataOutside+",\n\ + waveformDataConstrain: false,\n\ + waveformDataLineRatio: "+threeSixtyPlayer.config.waveformDataLineRatio+",\n\ +\n\ + useEQData: "+threeSixtyPlayer.config.useEQData+",\n\ + eqDataColor: '"+threeSixtyPlayer.config.eqDataColor+"',\n\ + eqDataDownsample: "+threeSixtyPlayer.config.eqDataDownsample+",\n\ + eqDataOutside: "+threeSixtyPlayer.config.eqDataOutside+",\n\ + eqDataLineRatio: "+threeSixtyPlayer.config.eqDataLineRatio+",\n\ +\n\ + usePeakData: "+threeSixtyPlayer.config.usePeakData+",\n\ + peakDataColor: '"+threeSixtyPlayer.config.peakDataColor+"',\n\ + peakDataOutside: "+threeSixtyPlayer.config.peakDataOutside+",\n\ + peakDataLineRatio: "+threeSixtyPlayer.config.peakDataLineRatio+",\n\ +\n\ + useAmplifier: "+threeSixtyPlayer.config.useAmplifier+"\n\ +\n\ +}"; +document.getElementById('config-code').style.display = 'block'; // weird Fx fix + } + + this.createCustomFirework = function() { + } + + this.destructor = function() { + for (var i=self.controls.length; i--;) { + self.controls[i].destructor(); + } + for (i=self.cb.length; i--;) { + self.cb.onclick = null; + self.cb[i] = null; + } + for (i=self.options.length; i--;) { + self.options[i] = null; + } + if (navigator.userAgent.match(/msie/i)) { + self.fbIE.onmouseover = null; + self.fbIE.onmouseout = null; + self.fbIE = null; + } + self.cb = null; + self.options = null; + self.controls = null; + self.functionExample = null; + self.o = null; + } + + var items = parseInt(this.o.length/3); + for (var i=0; iself.xMax) { + x = self.xMax; + } else if (x=self.tween.length-1) { + self.active = false; + self.frame = 0; + if (self._oncomplete) self._oncomplete(); +// self.doUpdate(); + return false; + } + self.doUpdate(); + return true; + } + + this.doUpdate = function(t) { + // if (!self.timer) self.timer = setTimeout(self.update,t||20); + self.update(); + } + + this.update = function() { + self.timer = null; + self.value = 1+parseInt(self.x/self.xMax*(self.scale-1)); + if (self.value<1) self.value = 1; + // if (self.oV.innerHTML != self.value) self.oV.innerHTML = self.value; + // self.oV.innerHTML = self.value; + } + + this.setValue = function(x) { + self.slide(self.x,Math.min(self.xMax,x)); + } + + this.randomize = function() { + self.slide(self.x,parseInt(Math.random()*self.xMax)); + } + + this.destructor = function() { + self.o.onmouseover = null; + self.o.onmouseout = null; + self.o.onmousedown = null; + self.o = null; + self.oV = null; + self.oB.onclick = null; + self.oB = null; + } + + if (soundManager.isIE) { + // IE is lame, no :hover + this.o.onmouseover = this.over; + this.o.onmouseout = this.out; + } + + this.o.onmousedown = this.down; + this.oB.onclick = this.barClick; + self.update(); + +} + +var gOID = 0; + +function demoInit() { + controller = new Controller(document.getElementById('controls').getElementsByTagName('dd')); +} + +function demoDestuctor() { + controller.destructor(); + controller = null; +} + +var controller = null; + +var mc = new MainController(); +// create null objects if APIs not present + +function createCP(oInput,oHandler) { + var Event = YAHOO.util.Event; + + cpHandler = oHandler; + if (picker != null) { + // picker.showcontrols(true); + var c = oInput.value.substr(1); + picker.setValue(hex2decArray([c.substr(0,2),c.substr(2,2),c.substr(4,2)]),true); // be silent + return false; + } + + Event.onDOMReady(function() { + picker = new YAHOO.widget.ColorPicker("cp-container", { + showhsvcontrols: true, + showhexcontrols: true, + images: { + PICKER_THUMB: "../_image/picker_thumb.png", + HUE_THUMB: "../_image/hue_thumb.png" + } + }); + +// picker.showcontrols(false); + //a listener for logging RGB color changes; + //this will only be visible if logger is enabled: + var onRgbChange = function(o) { + /*o is an object + { newValue: (array of R, G, B values), + prevValue: (array of R, G, B values), + type: "rgbChange" + } + */ + cpHandler(o.newValue); + controller.updateExampleCode(); + } + + //subscribe to the rgbChange event; + picker.on("rgbChange", onRgbChange); + + //use setValue to reset the value to white: + Event.on("reset", "click", function(e) { + picker.setValue([255, 255, 255], false); //false here means that rgbChange + //wil fire; true would silence it + }); + + //use the "get" method to get the current value + //of one of the Color Picker's properties; in + //this case, we'll get the hex value and write it + //to the log: + Event.on("gethex", "click", function(e) { + console.log("Current hex value: " + picker.get("hex")); + }); + + }); +} + +var picker = null; + +cpHandler = function() { +} + + + // hex -> dec / dec -> hex + // http://www.southwest.com.au/~jfuller/binary/converter.htm + + function dec2hex(cval) { + if (cval > 255) cval = 255; + var hexascii = "0123456789ABCDEF"; + var cval0 = Math.floor(cval/16); + var cval1 = cval-(cval0*16); + var c1 = hexascii.charAt(cval0); + var c2 = hexascii.charAt(cval1); + return (c1+c2); + } + + function hex2dec(cval) { + cval = cval.toUpperCase(); + var tval = 0; + var hexascii = "0123456789ABCDEF"; + var mychar, ch; + for (var c=0; c + + +360° MP3 player UI demo (SoundManager 2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +

    SoundManager 2 / 360° Player: JS + Canvas UI

    + +

    Canvas-based UI. Load progress, seek, play/pause etc. Also see 360° UI visualization demo.

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

    Alternate style: inline

    + + + +
    + +
    + +
    + + +

    How This Works

    + +

    The script looks for a container element matching div.ui360, and then the first link inside of it.

    + +
    + +
    <div class="ui360">
    + <a href="/path/to/an.mp3">
    +</div>
    + +
    + +

    When the link is clicked, the script adds a UI template to the block, prepending it in front of the MP3 link:

    + +
    <div class="ui360">
    + <-- dynamically-inserted block -->
    + <div class="ui">
    +  <canvas class="sm2-canvas"></canvas>
    +  <img class="sm2-360btn" /> 
    +  <div class="sm2-timing"></div>
    +  <div class="sm2-cover"></div>
    + </div>
    + <-- /UI -->
    + <a href="/path/to/an.mp3">
    +</div>
    + +

    Customizing the UI

    + +

    The player's default 50x50-pixel canvas is defined both within JavaScript and CSS. For an example with different values, see this larger version.

    + +
    threeSixtyPlayer.config = {
    +  playNext: false, // stop after one sound, or play through list until end
    +  autoPlay: false, // start playing the first sound right away
    +  loadRingColor: '#ccc', // amount of sound which has loaded
    +  playRingColor: '#000', // amount of sound which has played
    +  backgroundRingColor: '#eee', // "default" color shown underneath everything else
    +  imageRoot: '', // path to prepend for empty.gif used for play/pause button
    +  animDuration: 500,
    +  animTransition: Animator.tx.bouncy // http://www.berniecode.com/writing/animator.html
    +}
    + +

    The CSS for the canvas UI block is a bit ugly, but JavaScript reads the width of the .sm2-360ui element in the DOM as set by CSS and uses that to later draw and update the canvas element while playing.

    + +
    .ui360,
    +.sm2-360ui {
    +  /* size of the container for the circle, etc. */
    +  width:50px;
    +  height:50px;
    +}
    +
    + +

    Third-party Components

    + +

    This demo includes use of Bernie's Better Animation Class (Apache licensed) for some animation effects.

    +

    Also, some loader/spinner icons from ajaxload.info are used for showing loading/buffering states.

    + +
    + +

    + SoundManager 2 project page (not an MP3 link) +

    + + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/360player.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/360player.js new file mode 100755 index 0000000..419559c --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/360player.js @@ -0,0 +1,1270 @@ +/* + + SoundManager 2 Demo: 360-degree / "donut player" + ------------------------------------------------ + http://schillmania.com/projects/soundmanager2/ + + An inline player with a circular UI. + Based on the original SM2 inline player. + Inspired by Apple's preview feature in the + iTunes music store (iPhone), among others. + + Requires SoundManager 2 Javascript API. + Also uses Bernie's Better Animation Class (BSD): + http://www.berniecode.com/writing/animator.html + +*/ + +function ThreeSixtyPlayer() { + var self = this; + var pl = this; + var sm = soundManager; // soundManager instance + var uA = navigator.userAgent; + var isIE = (uA.match(/msie/i)); + var isOpera = (uA.match(/opera/i)); + var isSafari = (uA.match(/safari/i)); + var isChrome = (uA.match(/chrome/i)); + var isFirefox = (uA.match(/firefox/i)); + var isTouchDevice = (uA.match(/ipad|iphone/i)); + this.excludeClass = 'threesixty-exclude'; // CSS class for ignoring MP3 links + + this.links = []; + this.sounds = []; + this.soundsByURL = []; + this.indexByURL = []; + this.lastSound = null; + this.soundCount = 0; + this.oUITemplate = null; + this.oUIImageMap = null; + this.vuMeter = null; + + this.config = { + + playNext: false, // stop after one sound, or play through list until end + autoPlay: false, // start playing the first sound right away + loadRingColor: '#ccc', // how much has loaded + playRingColor: '#000', // how much has played + backgroundRingColor: '#eee', // color shown underneath load + play ("not yet loaded" color) + + // optional segment/annotation (metadata) stuff.. + segmentRingColor: 'rgba(255,255,255,0.33)', // metadata/annotation (segment) colors + segmentRingColorAlt: 'rgba(0,0,0,0.1)', + loadRingColorMetadata: '#ddd', // "annotations" load color + playRingColorMetadata: 'rgba(96,160,224,0.99)', // how much has played when metadata is present + playRingColorMetadata: 'rgba(128,192,256,0.9)', // how much has played when metadata is present + + circleDiameter: null, // set dynamically according to values from CSS + circleRadius: null, + imageRoot: '', // image path to prepend for transparent .GIF - eg. /images/ + animDuration: 500, + animTransition: Animator.tx.bouncy, // http://www.berniecode.com/writing/animator.html + showHMSTime: false, // hours:minutes:seconds vs. seconds-only + scaleFont: false, // also set the font size (if possible) while animating the circle + + // optional: spectrum or EQ graph in canvas (not supported in IE, too slow via ExCanvas) + useWaveformData: false, + waveformDataColor: '#0099ff', + waveformDataDownsample: 3, // use only one in X (of a set of 256 values) - 1 means all 256 + waveformDataOutside: false, + waveformDataConstrain: false, // if true, +ve values only - keep within inside circle + waveformDataLineRatio: 0.64, + + // "spectrum frequency" option + useEQData: false, + eqDataColor: '#339933', + eqDataDownsample: 4, // use only one in X (of 256 values) + eqDataOutside: true, + eqDataLineRatio: 0.54, + + // enable "amplifier" (canvas pulses like a speaker) effect + usePeakData: true, + peakDataColor: '#ff33ff', + peakDataOutside: true, + peakDataLineRatio: 0.5, + + useAmplifier: true, // "pulse" like a speaker + + fontSizeMax: null, // set according to CSS + + useFavIcon: false // Experimental (also requires usePeakData: true).. Try to draw a "VU Meter" in the favicon area, if browser supports it (Firefox + Opera as of 2009) + + } + + this.css = { + // CSS class names appended to link during various states + sDefault: 'sm2_link', // default state + sBuffering: 'sm2_buffering', + sPlaying: 'sm2_playing', + sPaused: 'sm2_paused' + } + + this.addEventHandler = function(o,evtName,evtHandler) { + typeof(attachEvent)=='undefined'?o.addEventListener(evtName,evtHandler,false):o.attachEvent('on'+evtName,evtHandler); + } + + this.removeEventHandler = function(o,evtName,evtHandler) { + typeof(attachEvent)=='undefined'?o.removeEventListener(evtName,evtHandler,false):o.detachEvent('on'+evtName,evtHandler); + } + + this.hasClass = function(o,cStr) { + return (typeof(o.className)!='undefined'?o.className.match(new RegExp('(\\s|^)'+cStr+'(\\s|$)')):false); + } + + this.addClass = function(o,cStr) { + if (!o || !cStr || self.hasClass(o,cStr)) return false; + o.className = (o.className?o.className+' ':'')+cStr; + } + + this.removeClass = function(o,cStr) { + if (!o || !cStr || !self.hasClass(o,cStr)) return false; + o.className = o.className.replace(new RegExp('( '+cStr+')|('+cStr+')','g'),''); + } + + this.getElementsByClassName = function(className,tagNames,oParent) { + var doc = (oParent||document); + var matches = []; + var i,j; + var nodes = []; + if (typeof tagNames != 'undefined' && typeof tagNames != 'string') { + for (i=tagNames.length; i--;) { + if (!nodes || !nodes[tagNames[i]]) { + nodes[tagNames[i]] = doc.getElementsByTagName(tagNames[i]); + } + } + } else if (tagNames) { + nodes = doc.getElementsByTagName(tagNames); + } else { + nodes = doc.all||doc.getElementsByTagName('*'); + } + if (typeof(tagNames)!='string') { + for (i=tagNames.length; i--;) { + for (j=nodes[tagNames[i]].length; j--;) { + if (self.hasClass(nodes[tagNames[i]][j],className)) { + matches.push(nodes[tagNames[i]][j]); + } + } + } + } else { + for (i=0; i 1) { + // only catch left-clicks + return true; + } + var o = self.getTheDamnLink(e); + if (o.nodeName.toLowerCase() != 'a') { + o = self.isChildOfNode(o,'a'); + if (!o) return true; + } + if (!self.isChildOfClass(o,'ui360')) { + // not a link we're interested in + return true; + } + var sURL = o.getAttribute('href'); + if (!o.href || !sm.canPlayLink(o) || self.hasClass(o,self.excludeClass)) { + return true; // pass-thru for non-MP3/non-links + } + sm._writeDebug('handleClick()'); + var soundURL = (o.href); + var thisSound = self.getSoundByURL(soundURL); + if (thisSound) { + // already exists + if (thisSound == self.lastSound) { + // and was playing (or paused) + thisSound.togglePause(); + } else { + // different sound + thisSound.togglePause(); // start playing current + sm._writeDebug('sound different than last sound: '+self.lastSound.sID); + if (self.lastSound) { + self.stopSound(self.lastSound); + } + } + } else { + // append some dom shiz + + // create sound + thisSound = sm.createSound({ + id:'ui360Sound'+(self.soundCount++), + url:soundURL, + onplay:self.events.play, + onstop:self.events.stop, + onpause:self.events.pause, + onresume:self.events.resume, + onfinish:self.events.finish, + onbufferchange:self.events.bufferchange, + whileloading:self.events.whileloading, + whileplaying:self.events.whileplaying + }); + var oContainer = o.parentNode; + // tack on some custom data + + thisSound._360data = { + oUI360: self.getParentByClassName(o,'ui360'), // the (whole) entire container + oLink: o, // DOM node for reference within SM2 object event handlers + className: self.css.sPlaying, + oUIBox: self.getElementsByClassName('sm2-360ui','div',oContainer)[0], + oCanvas: self.getElementsByClassName('sm2-canvas','canvas',oContainer)[0], + oButton: self.getElementsByClassName('sm2-360btn','img',oContainer)[0], + oTiming: self.getElementsByClassName('sm2-timing','div',oContainer)[0], + oCover: self.getElementsByClassName('sm2-cover','div',oContainer)[0], + lastTime: null, + didFinish: null, + pauseCount:0, + radius:0, + amplifier: (self.config.usePeakData?0.9:1), // TODO: x1 if not being used, else use dynamic "how much to amplify by" value + radiusMax: self.config.circleDiameter*0.175, // circle radius + width:0, + widthMax: self.config.circleDiameter*0.4, // width of the outer ring + lastValues: { + bytesLoaded: 0, + bytesTotal: 0, + position: 0, + durationEstimate: 0 + }, // used to track "last good known" values before sound finish/reset for anim + animating: false, + oAnim: new Animator({ + duration: self.config.animDuration, + transition:self.config.animTransition, + onComplete: function() { + // var thisSound = this; + // thisSound._360data.didFinish = false; // reset full circle + } + }), + oAnimProgress: function(nProgress) { + var thisSound = this; + thisSound._360data.radius = parseInt(thisSound._360data.radiusMax*thisSound._360data.amplifier*nProgress); + thisSound._360data.width = parseInt(thisSound._360data.widthMax*thisSound._360data.amplifier*nProgress); + if (self.config.scaleFont && self.config.fontSizeMax != null) { + thisSound._360data.oTiming.style.fontSize = parseInt(Math.max(1,self.config.fontSizeMax*nProgress))+'px'; + thisSound._360data.oTiming.style.opacity = nProgress; + } + if (thisSound.paused || thisSound.playState == 0 || thisSound._360data.lastValues.bytesLoaded == 0 || thisSound._360data.lastValues.position == 0) { + self.updatePlaying.apply(thisSound); + } + }, + fps: 0 + }; + + // "Metadata" (annotations) + if (typeof self.Metadata != 'undefined' && self.getElementsByClassName('metadata','div',thisSound._360data.oUI360).length) { + thisSound._360data.metadata = new self.Metadata(thisSound,self); + } + + // set the cover width/height to match the canvas + thisSound._360data.oCover.style.width = self.config.circleDiameter+'px'; + thisSound._360data.oCover.style.height = self.config.circleDiameter+'px'; + + // minimize ze font + if (self.config.scaleFont && self.config.fontSizeMax != null) { + thisSound._360data.oTiming.style.fontSize = '1px'; + } + + // set up ze animation + thisSound._360data.oAnim.addSubject(thisSound._360data.oAnimProgress,thisSound); + + // animate the radius out nice + self.refreshCoords(thisSound); + + self.updatePlaying.apply(thisSound); + + self.soundsByURL[soundURL] = thisSound; + self.sounds.push(thisSound); + if (self.lastSound) { + self.stopSound(self.lastSound); + } + thisSound.play(); + } + + self.lastSound = thisSound; // reference for next call + + if (typeof e != 'undefined' && typeof e.preventDefault != 'undefined') { + e.preventDefault(); + } else if (typeof event != 'undefined') { + event.returnValue = false; + } + return false; + } + + this.fanOut = function(oSound) { + var thisSound = oSound; + if (thisSound._360data.animating == 1) { + return false; + } + thisSound._360data.animating = 0; + soundManager._writeDebug('fanOut: '+thisSound.sID+': '+thisSound._360data.oLink.href); + thisSound._360data.oAnim.seekTo(1); // play to end + window.setTimeout(function() { + // oncomplete hack + thisSound._360data.animating = 0; + },self.config.animDuration+20); + } + + this.fanIn = function(oSound) { + var thisSound = oSound; + if (thisSound._360data.animating == -1) { + return false; + } + thisSound._360data.animating = -1; + soundManager._writeDebug('fanIn: '+thisSound.sID+': '+thisSound._360data.oLink.href); + // massive hack + thisSound._360data.oAnim.seekTo(0); // play to end + window.setTimeout(function() { + // reset full 360 fill after animation has completed (oncomplete hack) + thisSound._360data.didFinish = false; + thisSound._360data.animating = 0; + self.resetLastValues(thisSound); + },self.config.animDuration+20); + + } + + this.resetLastValues = function(oSound) { + var oData = oSound._360data; + oData.lastValues.position = 0; + // oData.lastValues.bytesLoaded = 0; // will likely be cached, if file is small + // oData.lastValues.bytesTotal = 0; + // oData.lastValues.durationEstimate = 0; + } + + this.refreshCoords = function(thisSound) { + thisSound._360data.canvasXY = self.findXY(thisSound._360data.oCanvas); + // thisSound._360data.canvasMid = [Math.floor(thisSound._360data.oCanvas.offsetWidth/2), Math.floor(thisSound._360data.oCanvas.offsetHeight/2)]; // doesn't work in IE, w/h are wrong + thisSound._360data.canvasMid = [self.config.circleRadius,self.config.circleRadius]; + thisSound._360data.canvasMidXY = [thisSound._360data.canvasXY[0]+thisSound._360data.canvasMid[0], thisSound._360data.canvasXY[1]+thisSound._360data.canvasMid[1]]; + } + + this.stopSound = function(oSound) { + soundManager._writeDebug('stopSound: '+oSound.sID); + soundManager.stop(oSound.sID); + soundManager.unload(oSound.sID); + } + + this.buttonClick = function(e) { + var o = e?(e.target?e.target:e.srcElement):event.srcElement; + self.handleClick({target:self.getParentByClassName(o,'sm2-360ui').nextSibling}); // link next to the nodes we inserted + return false; + } + + this.buttonMouseDown = function(e) { + // user might decide to drag from here + // watch for mouse move + if (!isTouchDevice) { + document.onmousemove = function(e) { + // should be boundary-checked, really (eg. move 3px first?) + self.mouseDown(e); + } + } else { + self.addEventHandler(document,'touchmove',self.mouseDown); + } + self.stopEvent(e); + return false; + } + + this.mouseDown = function(e) { + if (!self.lastSound) { + self.stopEvent(e); + return false; + } + var thisSound = self.lastSound; + // just in case, update coordinates (maybe the element moved since last time.) + self.refreshCoords(thisSound); + var oData = self.lastSound._360data; + self.addClass(oData.oUIBox,'sm2_dragging'); + oData.pauseCount = (self.lastSound.paused?1:0); + // self.lastSound.pause(); + self.mmh(e?e:event); + if (isTouchDevice) { + self.removeEventHandler(document,'touchmove',self.mouseDown); + self.addEventHandler(document,'touchmove',self.mmh); + self.addEventHandler(document,'touchend',self.mouseUp); + } else { + document.onmousemove = self.mmh; + document.onmouseup = self.mouseUp; + } + self.stopEvent(e); + return false; + } + + this.mouseUp = function(e) { + var oData = self.lastSound._360data; + self.removeClass(oData.oUIBox,'sm2_dragging'); + if (oData.pauseCount == 0) { + self.lastSound.resume(); + } + if (!isTouchDevice) { + document.onmousemove = null; + document.onmouseup = null; + } else { + self.removeEventHandler(document,'touchmove',self.mmh); + self.removeEventHandler(document,'touchend',self.mouseUP); + } + } + + var fullCircle = 360; + + this.mmh = function(e) { + if (typeof e == 'undefined') { + var e = event; + } + var oSound = self.lastSound; + var coords = self.getMouseXY(e); + var x = coords[0]; + var y = coords[1]; + var deltaX = x-oSound._360data.canvasMidXY[0]; + var deltaY = y-oSound._360data.canvasMidXY[1]; + var angle = Math.floor(fullCircle-(self.rad2deg(Math.atan2(deltaX,deltaY))+180)); + oSound.setPosition(oSound.durationEstimate*(angle/fullCircle)); + self.stopEvent(e); + return false; + } + + // assignMouseDown(); + + this.drawSolidArc = function(oCanvas, color, radius, width, radians, startAngle, noClear) { + + // thank you, http://www.snipersystems.co.nz/community/polarclock/tutorial.html + + var x = radius; + var y = radius; + + var canvas = oCanvas; + + if (canvas.getContext){ + // use getContext to use the canvas for drawing + var ctx = canvas.getContext('2d'); + } + + // var startAngle = 0; + var oCanvas = ctx; + + if (!noClear) { + self.clearCanvas(canvas); + } + // ctx.restore(); + + if (color) { + ctx.fillStyle = color; + } else { + // ctx.fillStyle = 'black'; + } + + oCanvas.beginPath(); + + if (isNaN(radians)) { + radians = 0; + } + + var innerRadius = radius-width; + var doesntLikeZero = (isOpera || isSafari); // safari 4 doesn't actually seem to mind. + + if (!doesntLikeZero || (doesntLikeZero && radius > 0)) { + oCanvas.arc(0, 0, radius, startAngle, radians, false); + var endPoint = self.getArcEndpointCoords(innerRadius, radians); + oCanvas.lineTo(endPoint.x, endPoint.y); + oCanvas.arc(0, 0, innerRadius, radians, startAngle, true); + oCanvas.closePath(); + oCanvas.fill(); + } + + } + + this.getArcEndpointCoords = function(radius, radians) { + return { + x: radius * Math.cos(radians), + y: radius * Math.sin(radians) + }; + } + + +this.deg2rad = function(nDeg) { + return (nDeg * Math.PI/180); +} + +this.rad2deg = function(nRad) { + return (nRad * 180/Math.PI); +} + +this.getTime = function(nMSec,bAsString) { + // convert milliseconds to mm:ss, return as object literal or string + var nSec = Math.floor(nMSec/1000); + var min = Math.floor(nSec/60); + var sec = nSec-(min*60); + // if (min == 0 && sec == 0) return null; // return 0:00 as null + return (bAsString?(min+':'+(sec<10?'0'+sec:sec)):{'min':min,'sec':sec}); +} + +this.clearCanvas = function(oCanvas) { + var canvas = oCanvas; + var ctx = null; + if (canvas.getContext){ + // use getContext to use the canvas for drawing + ctx = canvas.getContext('2d'); + } + var width = canvas.offsetWidth; + var height = canvas.offsetHeight; + ctx.clearRect(-(width/2), -(height/2), width, height); +} + + +var fullCircle = (isOpera||isChrome?359.9:360); // I dunno what Opera doesn't like about this. + +this.updatePlaying = function() { + if (this.bytesLoaded) { + this._360data.lastValues.bytesLoaded = this.bytesLoaded; + this._360data.lastValues.bytesTotal = this.bytesTotal; + } + if (this.position) { + this._360data.lastValues.position = this.position; + } + if (this.durationEstimate) { + this._360data.lastValues.durationEstimate = this.durationEstimate; + } + + self.drawSolidArc(this._360data.oCanvas,self.config.backgroundRingColor,this._360data.width,this._360data.radius,self.deg2rad(fullCircle),false); + + self.drawSolidArc(this._360data.oCanvas,(this._360data.metadata?self.config.loadRingColorMetadata:self.config.loadRingColor),this._360data.width,this._360data.radius,self.deg2rad(fullCircle*(this._360data.lastValues.bytesLoaded/this._360data.lastValues.bytesTotal)),0,true); + + if (this._360data.lastValues.position != 0) { + // don't draw if 0 (full black circle in Opera) + self.drawSolidArc(this._360data.oCanvas,(this._360data.metadata?self.config.playRingColorMetadata:self.config.playRingColor),this._360data.width,this._360data.radius,self.deg2rad((this._360data.didFinish==1?fullCircle:fullCircle*(this._360data.lastValues.position/this._360data.lastValues.durationEstimate))),0,true); + } + + // metadata goes here + if (this._360data.metadata) { + this._360data.metadata.events.whileplaying(); + } + + var timeNow = (self.config.showHMSTime?self.getTime(this.position,true):parseInt(this.position/1000)); + + if (timeNow != this._360data.lastTime) { + this._360data.lastTime = timeNow; + this._360data.oTiming.innerHTML = timeNow; + } + + // draw spectrum, if applicable + if (!isIE) { // IE can render maybe 3 or 4 FPS when including the wave/EQ, so don't bother. + self.updateWaveform(this); + // self.updateWaveformOld(this); + } + + if (self.config.useFavIcon && self.vuMeter) { + self.vuMeter.updateVU(this); + } + +} + + this.updateWaveform = function(oSound) { + + if ((!self.config.useWaveformData && !self.config.useEQData) || (!sm.features.waveformData && !sm.features.eqData)) { + // feature not enabled.. + return false; + } + + if (!oSound.waveformData.left.length && !oSound.eqData.length && !oSound.peakData.left) { + // no data (or errored out/paused/unavailable?) + return false; + } + + /* use for testing the data */ + /* + for (i=0; i<256; i++) { + oSound.eqData[i] = 1-(i/256); + } + */ + + var oCanvas = oSound._360data.oCanvas.getContext('2d'); + var offX = 0; + var offY = parseInt(self.config.circleDiameter/2); + var scale = offY/2; // Y axis (+/- this distance from 0) + var lineWidth = Math.floor(self.config.circleDiameter-(self.config.circleDiameter*0.175)/(self.config.circleDiameter/255)); // width for each line + lineWidth = 1; + var lineHeight = 1; + var thisY = 0; + var offset = offY; + + if (self.config.useWaveformData) { + // raw waveform + var downSample = self.config.waveformDataDownsample; // only sample X in 256 (greater number = less sample points) + downSample = Math.max(1,downSample); // make sure it's at least 1 + var dataLength = 256; + var sampleCount = (dataLength/downSample); + var startAngle = 0; + var endAngle = 0; + var waveData = null; + var innerRadius = (self.config.waveformDataOutside?1:(self.config.waveformDataConstrain?0.5:0.565)); + var scale = (self.config.waveformDataOutside?0.7:0.75); + var perItemAngle = self.deg2rad((360/sampleCount)*self.config.waveformDataLineRatio); // 0.85 = clean pixel lines at 150? // self.deg2rad(360*(Math.max(1,downSample-1))/sampleCount); + for (var i=0; i16500 Hz), most stuff won't actually use it. + var sampleCount = (eqSamples/downSample); + var innerRadius = (self.config.eqDataOutside?1:0.565); + var direction = (self.config.eqDataOutside?-1:1); + var scale = (self.config.eqDataOutside?0.5:0.75); + var startAngle = 0; + var endAngle = 0; + var perItemAngle = self.deg2rad((360/sampleCount)*self.config.eqDataLineRatio); // self.deg2rad(360/(sampleCount+1)); + var playedAngle = self.deg2rad((oSound._360data.didFinish==1?360:360*(oSound._360data.lastValues.position/oSound._360data.lastValues.durationEstimate))); + var j=0; + var iAvg = 0; + for (var i=0; iplayedAngle?self.config.eqDataColor:self.config.playRingColor),oSound._360data.width*innerRadius,oSound._360data.radius*scale*(oSound.eqData.left[i]*direction),endAngle,startAngle,true); + } + } + + if (self.config.usePeakData) { + if (!oSound._360data.animating) { + var nPeak = (oSound.peakData.left||oSound.peakData.right); + // GIANT HACK: use EQ spectrum data for bass frequencies + var eqSamples = 3; + for (var i=0; i', + ' ', // note use of imageMap, edit or remove if you use a different-size image. + '
    ', // + Ever-so-slight Safari horizontal alignment tweak + '
    ' + ]; + } + + this.init = function() { + sm._writeDebug('threeSixtyPlayer.init()'); + var oItems = self.getElementsByClassName('ui360','div'); + var oLinks = []; + + for (var i=0,j=oItems.length; i0) { + self.addEventHandler(document,'click',self.handleClick); + if (self.config.autoPlay) { + self.handleClick({target:self.links[0],preventDefault:function(){}}); + } + } + sm._writeDebug('threeSixtyPlayer.init(): Found '+foundItems+' relevant items.'); + + if (self.config.useFavIcon && typeof this.VUMeter != 'undefined') { + this.vuMeter = new this.VUMeter(this); + } + + } + +} + +// Optional: VU Meter component + +ThreeSixtyPlayer.prototype.VUMeter = function(oParent) { + + var self = oParent; + var me = this; + this.vuMeterData = []; + this.vuDataCanvas = null; + var _head = document.getElementsByTagName('head')[0]; + var isOpera = (navigator.userAgent.match(/opera/i)); + var isFirefox = (navigator.userAgent.match(/firefox/i)); + + this.setPageIcon = function(sDataURL) { + + if (!self.config.useFavIcon || !self.config.usePeakData || !sDataURL) { + return false; + } + + var link = document.getElementById('sm2-favicon'); + if (link) { + _head.removeChild(link); + link = null; + } + if (!link) { + link = document.createElement('link'); + link.id = 'sm2-favicon'; + link.rel = 'shortcut icon'; + link.type = 'image/png'; + link.href = sDataURL; + document.getElementsByTagName('head')[0].appendChild(link); + } + } + + this.resetPageIcon = function() { + if (!self.config.useFavIcon) { + return false; + } + var link = document.getElementById('favicon'); + if (link) { + link.href = '/favicon.ico'; + } + } + + this.updateVU = function(oSound) { + if (soundManager.flashVersion >= 9 && self.config.useFavIcon && self.config.usePeakData) { + me.setPageIcon(me.vuMeterData[parseInt(16*oSound.peakData.left)][parseInt(16*oSound.peakData.right)]); + } + } + + this.createVUData = function() { + var i=0; + var j=0; + var canvas = me.vuDataCanvas.getContext('2d'); + var vuGrad = canvas.createLinearGradient(0, 16, 0, 0); + vuGrad.addColorStop(0,'rgb(0,192,0)'); + vuGrad.addColorStop(0.30,'rgb(0,255,0)'); + vuGrad.addColorStop(0.625,'rgb(255,255,0)'); + vuGrad.addColorStop(0.85,'rgb(255,0,0)'); + var bgGrad = canvas.createLinearGradient(0, 16, 0, 0); + var outline = 'rgba(0,0,0,0.2)'; + bgGrad.addColorStop(0,outline); + bgGrad.addColorStop(1,'rgba(0,0,0,0.5)'); + for (i=0; i<16; i++) { + me.vuMeterData[i] = []; + } + for (var i=0; i<16; i++) { + for (j=0; j<16; j++) { + // reset/erase canvas + me.vuDataCanvas.setAttribute('width',16); + me.vuDataCanvas.setAttribute('height',16); + // draw new stuffs + canvas.fillStyle = bgGrad; + canvas.fillRect(0,0,7,15); + canvas.fillRect(8,0,7,15); + /* + // shadow + canvas.fillStyle = 'rgba(0,0,0,0.1)'; + canvas.fillRect(1,15-i,7,17-(17-i)); + canvas.fillRect(9,15-j,7,17-(17-j)); + */ + canvas.fillStyle = vuGrad; + canvas.fillRect(0,15-i,7,16-(16-i)); + canvas.fillRect(8,15-j,7,16-(16-j)); + // and now, clear out some bits. + canvas.clearRect(0,3,16,1); + canvas.clearRect(0,7,16,1); + canvas.clearRect(0,11,16,1); + me.vuMeterData[i][j] = me.vuDataCanvas.toDataURL('image/png'); + // for debugging VU images + /* + var o = document.createElement('img'); + o.style.marginRight = '5px'; + o.src = vuMeterData[i][j]; + document.documentElement.appendChild(o); + */ + } + } + }; + + this.testCanvas = function(noOpaque) { + // canvas + toDataURL(); + var c = document.createElement('canvas'); + var ctx = null; + if (!c || typeof c.getContext == 'undefined') { + return null; + } + ctx = c.getContext('2d'); + if (!ctx || typeof c.toDataURL != 'function') { + return null; + } + // just in case.. + try { + var ok = c.toDataURL('image/png'); + } catch(e) { + // no canvas or no toDataURL() + return null; + } + // assume we're all good. + return c; + } + + this.init = function() { + if (self.config.useFavIcon) { + me.vuDataCanvas = me.testCanvas(true); + if (me.vuDataCanvas && (isFirefox || isOpera)) { + // these browsers support dynamically-updating the favicon + me.createVUData(); + } else { + // browser doesn't support doing this + self.config.useFavIcon = false; + } + } + } + + this.init(); + +} + +// completely optional: Metadata/annotations/segments code + +ThreeSixtyPlayer.prototype.Metadata = function(oSound, oParent) { + soundManager._wD('Metadata()'); + var me = this; + var oBox = oSound._360data.oUI360; + var o = oBox.getElementsByTagName('ul')[0]; + var oItems = o.getElementsByTagName('li'); + var isFirefox = (navigator.userAgent.match(/firefox/i)); + this.lastWPExec = 0; + this.refreshInterval = 250; + + var isAlt = false; + + this.events = { + whileplaying: function() { + var width = oSound._360data.width; + var radius = oSound._360data.radius; + var fullDuration = (oSound.durationEstimate||(me.totalTime*1000)); + var isAlt = null; + for (var i=0,j=me.data.length; ime.refreshInterval) { + me.refresh(); + me.lastWPExec = d; + } + } + } + + this.refresh = function() { + // Display info as appropriate + var index = null; + var now = oSound.position; + var metadata = oSound._360data.metadata.data; + for (var i=0, j=metadata.length; i= metadata[i].startTimeMS && now <= metadata[i].endTimeMS) { + index = i; + break; + } + } + if (index != metadata.currentItem && index < metadata.length) { + // update + oSound._360data.oLink.innerHTML = metadata.mainTitle+' '; + // self.setPageTitle(metadata[index].title+' | '+metadata.mainTitle); + metadata.currentItem = index; + } + } + + this.totalTime = 0; + + this.strToTime = function(sTime) { + var segments = sTime.split(':'); + var seconds = 0; + for (var i=segments.length; i--;) { + seconds += parseInt(segments[i])*Math.pow(60,segments.length-1-i,10); // hours, minutes + } + return seconds; + } + + this.data = []; + this.data.givenDuration = null; + this.data.currentItem = null; + this.data.mainTitle = oSound._360data.oLink.innerHTML; + for (var i=0; i= Math.abs(this.state - this.target)) { + this.state = this.target; + } else { + this.state += movement; + } + + try { + this.propagate(); + } finally { + this.options.onStep.call(this); + if (this.target == this.state) { + window.clearInterval(this.intervalId); + this.intervalId = null; + this.options.onComplete.call(this); + } + } + }, + // shortcuts + play: function() {this.seekFromTo(0, 1)}, + reverse: function() {this.seekFromTo(1, 0)}, + // return a string describing this Animator, for debugging + inspect: function() { + var str = "# 20) return; + } + }, + getStyle: function(state) { + state = this.from + ((this.to - this.from) * state); + if (this.property == 'filter') return "alpha(opacity=" + Math.round(state*100) + ")"; + if (this.property == 'opacity') return state; + return Math.round(state) + this.units; + }, + inspect: function() { + return "\t" + this.property + "(" + this.from + this.units + " to " + this.to + this.units + ")\n"; + } +} + +// animates a colour based style property between two hex values +function ColorStyleSubject(els, property, from, to) { + this.els = Animator.makeArray(els); + this.property = Animator.camelize(property); + this.to = this.expandColor(to); + this.from = this.expandColor(from); + this.origFrom = from; + this.origTo = to; +} + +ColorStyleSubject.prototype = { + // parse "#FFFF00" to [256, 256, 0] + expandColor: function(color) { + var hexColor, red, green, blue; + hexColor = ColorStyleSubject.parseColor(color); + if (hexColor) { + red = parseInt(hexColor.slice(1, 3), 16); + green = parseInt(hexColor.slice(3, 5), 16); + blue = parseInt(hexColor.slice(5, 7), 16); + return [red,green,blue] + } + if (window.DEBUG) { + alert("Invalid colour: '" + color + "'"); + } + }, + getValueForState: function(color, state) { + return Math.round(this.from[color] + ((this.to[color] - this.from[color]) * state)); + }, + setState: function(state) { + var color = '#' + + ColorStyleSubject.toColorPart(this.getValueForState(0, state)) + + ColorStyleSubject.toColorPart(this.getValueForState(1, state)) + + ColorStyleSubject.toColorPart(this.getValueForState(2, state)); + for (var i=0; i 255) number = 255; + var digits = number.toString(16); + if (number < 16) return '0' + digits; + return digits; +} +ColorStyleSubject.parseColor.rgbRe = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i; +ColorStyleSubject.parseColor.hexRe = /^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/; + +// Animates discrete styles, i.e. ones that do not scale but have discrete values +// that can't be interpolated +function DiscreteStyleSubject(els, property, from, to, threshold) { + this.els = Animator.makeArray(els); + this.property = Animator.camelize(property); + this.from = from; + this.to = to; + this.threshold = threshold || 0.5; +} + +DiscreteStyleSubject.prototype = { + setState: function(state) { + var j=0; + for (var i=0; i section ? 1 : 0); + } + if (this.options.rememberance) { + document.location.hash = this.rememberanceTexts[section]; + } + } +} diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/excanvas.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/excanvas.js new file mode 100755 index 0000000..d748873 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/360-player/script/excanvas.js @@ -0,0 +1,17 @@ +// Excanvas (Explorer Canvas) R43 +// http://excanvas.sourceforge.net/ +// Copyright 2006 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +if(!document.createElement("canvas").getContext){(function(){var u=Math;var v=u.round;var r=u.sin;var C=u.cos;var l=u.abs;var B=u.sqrt;var a=10;var n=a/2;function g(){return this.context_||(this.context_=new p(this))}var t=Array.prototype.slice;function D(j,m,E){var i=t.call(arguments,2);return function(){return j.apply(m,i.concat(t.call(arguments)))}}var h={init:function(i){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var j=i||document;j.createElement("canvas");j.attachEvent("onreadystatechange",D(this.init_,this,j))}},init_:function(F){if(!F.namespaces.g_vml_){F.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML")}if(!F.namespaces.g_o_){F.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML")}if(!F.styleSheets.ex_canvas_){var E=F.createStyleSheet();E.owningElement.id="ex_canvas_";E.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var m=F.getElementsByTagName("canvas");for(var j=0;j','","");this.element_.insertAdjacentHTML("BeforeEnd",Y.join(""))};k.stroke=function(ae){var J=[];var K=false;var ap=c(ae?this.fillStyle:this.strokeStyle);var aa=ap.color;var ak=ap.alpha*this.globalAlpha;var F=10;var M=10;J.push("V.x){V.x=ai.x}if(ao.y==null||ai.yV.y){V.y=ai.y}}}J.push(' ">');if(!ae){var U=this.lineScale_*this.lineWidth;if(U<1){ak*=U}J.push("')}else{if(typeof this.fillStyle=="object"){var N=this.fillStyle;var S=0;var ah={x:0,y:0};var ab=0;var Q=1;if(N.type_=="gradient"){var P=N.x0_/this.arcScaleX_;var m=N.y0_/this.arcScaleY_;var O=N.x1_/this.arcScaleX_;var aq=N.y1_/this.arcScaleY_;var am=this.getCoords_(P,m);var al=this.getCoords_(O,aq);var I=al.x-am.x;var G=al.y-am.y;S=Math.atan2(I,G)*180/Math.PI;if(S<0){S+=360}if(S<0.000001){S=0}}else{var am=this.getCoords_(N.x0_,N.y0_);var j=V.x-ao.x;var E=V.y-ao.y;ah={x:(am.x-ao.x)/j,y:(am.y-ao.y)/E};j/=this.arcScaleX_*a;E/=this.arcScaleY_*a;var ag=u.max(j,E);ab=2*N.r0_/ag;Q=2*N.r1_/ag-ab}var Z=N.colors_;Z.sort(function(H,i){return H.offset-i.offset});var T=Z.length;var Y=Z[0].color;var X=Z[T-1].color;var ad=Z[0].alpha*this.globalAlpha;var ac=Z[T-1].alpha*this.globalAlpha;var af=[];for(var aj=0;aj')}else{J.push('')}}J.push("");this.element_.insertAdjacentHTML("beforeEnd",J.join(""))};k.fill=function(){this.stroke(true)};k.closePath=function(){this.currentPath_.push({type:"close"})};k.getCoords_=function(E,j){var i=this.m_;return{x:a*(E*i[0][0]+j*i[1][0]+i[2][0])-n,y:a*(E*i[0][1]+j*i[1][1]+i[2][1])-n}};k.save=function(){var i={};w(this,i);this.aStack_.push(i);this.mStack_.push(this.m_);this.m_=d(q(),this.m_)};k.restore=function(){w(this.aStack_.pop(),this);this.m_=this.mStack_.pop()};k.translate=function(m,j){var i=[[1,0,0],[0,1,0],[m,j,1]];this.m_=d(i,this.m_)};k.rotate=function(j){var E=C(j);var m=r(j);var i=[[E,m,0],[-m,E,0],[0,0,1]];this.m_=d(i,this.m_)};k.scale=function(G,F){this.arcScaleX_*=G;this.arcScaleY_*=F;var j=[[G,0,0],[0,F,0],[0,0,1]];var i=this.m_=d(j,this.m_);var E=i[0][0]*i[1][1]-i[0][1]*i[1][0];this.lineScale_=B(l(E))};k.clip=function(){};k.arcTo=function(){};k.createPattern=function(){return new f};function z(i){this.type_=i;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}z.prototype.addColorStop=function(j,i){i=c(i);this.colors_.push({offset:j,color:i.color,alpha:i.alpha})};function f(){}G_vmlCanvasManager=h;CanvasRenderingContext2D=p;CanvasGradient=z;CanvasPattern=f})()}; \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot1.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot1.png new file mode 100755 index 0000000..8684432 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot1.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot2.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot2.png new file mode 100755 index 0000000..b0700fe Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot2.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot3.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot3.png new file mode 100755 index 0000000..8ba6617 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot3.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot4.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot4.png new file mode 100755 index 0000000..ab67cc7 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/360ui-screenshot4.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/8tracks-logo.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/8tracks-logo.png new file mode 100755 index 0000000..e1dbc64 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/8tracks-logo.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/discogs.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/discogs.gif new file mode 100755 index 0000000..d039d51 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/discogs.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9-dark.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9-dark.png new file mode 100755 index 0000000..d76a3a1 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9-dark.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9.png new file mode 100755 index 0000000..77da060 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/flash9.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/getsatisfaction-icon.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/getsatisfaction-icon.gif new file mode 100755 index 0000000..f3762c7 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/getsatisfaction-icon.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/hue_thumb.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/hue_thumb.png new file mode 100755 index 0000000..413ee98 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/hue_thumb.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/lastfm.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/lastfm.png new file mode 100755 index 0000000..623005a Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/lastfm.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/mixcrate.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/mixcrate.png new file mode 100755 index 0000000..7e21115 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/mixcrate.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/muxtape-logo.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/muxtape-logo.png new file mode 100755 index 0000000..a29bfd7 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/muxtape-logo.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-bw.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-bw.png new file mode 100755 index 0000000..e9dc665 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-bw.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-dark.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-dark.png new file mode 100755 index 0000000..549158d Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new-dark.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new.png new file mode 100755 index 0000000..62e05e4 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/new.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/opera.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/opera.png new file mode 100755 index 0000000..9baf845 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/opera.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/picker_thumb.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/picker_thumb.png new file mode 100755 index 0000000..f757cc6 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/picker_thumb.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-1.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-1.png new file mode 100755 index 0000000..b7a5f32 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-1.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-bar.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-bar.gif new file mode 100755 index 0000000..8e25d0e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider-bar.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider.png new file mode 100755 index 0000000..abcbf8b Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/slider.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/soundcloud-thecloudplayer-logo.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/soundcloud-thecloudplayer-logo.png new file mode 100755 index 0000000..f88af99 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/soundcloud-thecloudplayer-logo.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/speaker.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/speaker.png new file mode 100755 index 0000000..9197793 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/speaker.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/wedge.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/wedge.png new file mode 100755 index 0000000..b55dd08 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_image/wedge.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/1hz-10khz-sweep.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/1hz-10khz-sweep.mp3 new file mode 100755 index 0000000..226ac1e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/1hz-10khz-sweep.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/440hz.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/440hz.mp3 new file mode 100755 index 0000000..e2dd5e0 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/440hz.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/880hz.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/880hz.mp3 new file mode 100755 index 0000000..756e8d9 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/880hz.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background0.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background0.mp3 new file mode 100755 index 0000000..3816dd7 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background0.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background1.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background1.mp3 new file mode 100755 index 0000000..9e9c638 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background1.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background2.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background2.mp3 new file mode 100755 index 0000000..ec251cf Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/background2.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/bass.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/bass.mp3 new file mode 100755 index 0000000..adc281f Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/bass.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-0.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-0.mp3 new file mode 100755 index 0000000..243c3e5 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-0.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-1.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-1.mp3 new file mode 100755 index 0000000..a2833fd Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/button-1.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-high.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-high.mp3 new file mode 100755 index 0000000..afb09d7 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-high.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-low.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-low.mp3 new file mode 100755 index 0000000..9cbe8fe Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/click-low.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/coins.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/coins.mp3 new file mode 100755 index 0000000..f0c2401 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/coins.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/fancy-beer-bottle-pop.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/fancy-beer-bottle-pop.mp3 new file mode 100755 index 0000000..4498874 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/fancy-beer-bottle-pop.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mak.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mak.mp3 new file mode 100755 index 0000000..9bc9af3 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mak.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover.mp3 new file mode 100755 index 0000000..9e9a4f4 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover2.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover2.mp3 new file mode 100755 index 0000000..9273f99 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover2.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover3.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover3.mp3 new file mode 100755 index 0000000..93d04be Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/mouseover3.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/select.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/select.mp3 new file mode 100755 index 0000000..9f9c711 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/select.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/sine, square, sawtooth, rando.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/sine, square, sawtooth, rando.mp3 new file mode 100755 index 0000000..a649164 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/_mp3/sine, square, sawtooth, rando.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/css/animation.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/css/animation.css new file mode 100755 index 0000000..380a671 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/css/animation.css @@ -0,0 +1,74 @@ +body { + font-size:75%; +} + +h1, h2, h3 { + font:normal 3em "Helvetica Neue Light","Helvetica Neue",helvetica,georgia,"times new roman","Arial Rounded MT Bold",verdana,tahoma,arial,"sans serif"; + font-weight:normal; + margin-bottom:0px; +} + +h1, h2 { + letter-spacing:-1px; /* zomg web x.0! ;) */ +} + +h1, h2, h3 { + padding-bottom:1px; + margin-bottom:0.25em; +} + +h1 { + margin-top:0px; + margin-bottom:0px; + background-color:#666; + color:#ccc; + margin-left:-5px; + padding-left:5px; + padding-right:5px; + padding-bottom:5px; +} + +h1, +h1 a { + color:#fff; + text-decoration:none; +} + +h1 a:hover { + text-decoration:underline; +} + +h2 { + font-size:2em; + margin-top:1em; + background-color:#aaa; + color:#fff; + padding:5px; + margin-left:-5px; + min-width:23em; +} + +h3 { + font-size:1.65em; + margin-top:0.5em; + margin-bottom:0.25em; + color:#333; + min-width:28em; +} + +h3 a { + font-size:small; +} + +h4 { + color:#444; +} +p { + font:normal 1em/2em verdana,tahoma,arial,"sans serif"; +} + +.balls img { + position:absolute; + width:12px; + height:12px; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/image/ball.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/image/ball.gif new file mode 100755 index 0000000..0f13534 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/image/ball.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/index.html new file mode 100755 index 0000000..7d010a8 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + +
    + +

    Interval-based animation (with sound)

    + +

    + Click + drag for fun. +

    + +

    Speeding Up ExternalInterface: Keep .swf in view

    + +

    SoundManager 2 now incorporates a "high performance" mode, which has been shown to noticeably improve timing and frequency of flash callbacks. This is important for timing, reducing delay between a JS call and the sound being played, etc.

    + +

    To reduce audio delay and timing issues from slow JS/Flash communication, SM2 will try to ensure that the flash movie is visible on screen at all times. If hidden or otherwise off-screen, Flash will be given lower priority and thus JS/flash "lag" (ie., delay) will be introduced when trying to play audio "in sync."

    + +

    Generally, positioning the flash movie using position:fixed and bottom/left or bottom/right 0px is the less-intrusive option.

    + +

    + Throw from mouse +

    +

    + + +

    + + +

    Sound source: "Acclivity", Free Sound Project

    + +
    + +
    + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/script/animation.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/script/animation.js new file mode 100755 index 0000000..f167761 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-1/script/animation.js @@ -0,0 +1,189 @@ +var balls = []; +var canvasX = 0; +var canvasY = 0; +var timer = null; +var m_lastX = 0; +var m_lastY = 0; +var M_SPACE = 24; +var B_VMIN = 5; +var B_VMAX = 5; +var B_WIDTH = 13; +var B_HEIGHT = 13; +var useMouse = null; +var ballSound = null; +var ballPopSound = null; + +function rnd(n) { + return Math.random()*n; +} + +function rndI(n) { + return parseInt(rnd(n)); +} + +function createBall(oParent) { + oParent.appendChild(balls[0].cloneNode(true)); + initBall(balls[balls.length-1],balls.length); +} + +function createBallAtMouse(e) { + e = e?e:event; + createBall(document.getElementById('ball-container')); + with (balls[balls.length-1]) { + _x = e.clientX; + _y = e.clientY; + if (useMouse.checked != false) { + _vX = (m_lastX-e.clientX)*-0.7; + _vY = (m_lastY-e.clientY)*-0.7; + } else { + _vX = 0; + _vY = 0; + } + } + moveBall(balls[balls.length-1]); +} + +function initBall(oBall,i) { + oBall._id = 'ball'+i; + oBall._active = true; + oBall._x = rnd(canvasX); + oBall._y = rnd(canvasY); + oBall._vX = B_VMIN+rnd(B_VMAX)*(Math.random()>0.5?1:-1); + oBall._vY = B_VMIN+rnd(B_VMAX); + oBall.style.display = 'block'; +} + +function moveBall(oBall) { + oBall._x += oBall._vX; + oBall._y += (oBall._vY++); // gravity! + var bounce = false; + if ((oBall._vX>0 && oBall._x+oBall._vX+B_WIDTH>canvasX) || (oBall._vX<0 && oBall._x+oBall._vX<0)) { + oBall._vX *= -1; + bounce = true; + } + if ((oBall._vY>0 && oBall._y+oBall._vY+B_HEIGHT>canvasY) || (oBall._vY<0 && oBall._y+oBall._vY<0)) { + // bounce on Y axis - with resistance on both axes + if (oBall._vY>0) oBall._y = canvasY-B_HEIGHT; // bounce exactly from bottom + oBall._vY *= -(oBall._vY>1?0.6:1); + bounce = true; + if (Math.abs(oBall._vX)>0.5) { + oBall._vX *= 0.85; + } else { + oBall._vX = 0; + } + if (Math.abs(oBall._vY)<=3 && Math.abs(oBall._vX==0)) { + oBall._active = false; + bounce = false; + ballPopSound.play(); + oBall.style.display = 'none'; + } + } + oBall.style.left = oBall._x+'px'; + oBall.style.top = oBall._y+'px'; + if (bounce) ballSound.play({pan:getPan(oBall._x,canvasX)}); +} + +function getPan(x,canvasX) { + var pos = x/canvasX; + var pan = null; + if (pos<=0.4) { + pan = Math.floor(-100+(pos/0.4*100)); + } else if (pos>0.4 && pos<=0.5) { + pan = 0; + } else { + pan = Math.floor(pos*100); + } + return pan; +} + +function animateStuff() { + for (var i=balls.length; i--;) { + if (balls[i]._active) moveBall(balls[i]); + } +} + +function startAnimation() { + if (!timer) timer = setInterval(animateStuff,20); + document.getElementById('b-start').disabled = true; + document.getElementById('b-stop').disabled = false; +} + +function stopAnimation() { + if (!timer) return false; + clearInterval(timer); + timer = null; + document.getElementById('b-start').disabled = false; + document.getElementById('b-stop').disabled = true; +} + +function mouseDown(e) { + e = e?e:event; + m_lastX = e.clientX; + m_lastY = e.clientY; + document.onmousemove = mouseMove; + document.onmouseup = mouseUp; + return false; +} + +function mouseMove(e) { + e = e?e:event; + if (Math.abs(e.clientX-m_lastX)>M_SPACE || Math.abs(e.clientY-m_lastY)>M_SPACE) { + createBallAtMouse(e); + m_lastX = e.clientX; + m_lastY = e.clientY; + } + return false; +} + +function mouseUp() { + document.onmousemove = null; + document.onmouseup = null; +} + +function init() { + ballSound = soundManager.createSound({ + id: 'ballSound', + url: '../animation/audio/fingerplop.mp3', + volume: 50, + multiShot: true, + autoLoad: true + }); + ballPopSound = soundManager.createSound({ + id: 'ballPopSound', + url: '../animation/audio/fingerplop2.mp3', + volume: 50, + multiShot: true, + autoLoad: true + }); + balls = document.getElementById('ball-container').getElementsByTagName('img'); + for (var i=balls.length; i--;) { + initBall(balls[i],i); + } + useMouse = document.getElementById('useMouse'); + useMouse.checked = true; + getWindowCoords(); + startAnimation(); + document.onmousedown = mouseDown; +} + +// I know this is kinda broken in Opera. +getWindowCoords = (navigator.userAgent.toLowerCase().indexOf('opera')>0||navigator.appVersion.toLowerCase().indexOf('safari')!=-1)?function() { + canvasX = window.innerWidth; + canvasY = window.innerHeight; +}:function() { + canvasX = document.documentElement.clientWidth||document.body.clientWidth||document.body.scrollWidth; + canvasY = document.documentElement.clientHeight||document.body.clientHeight||document.body.scrollHeight; +} + +window.onresize = getWindowCoords; + +soundManager.flashVersion = 9; +soundManager.url = '../../swf/'; +soundManager.useHighPerformance = true; +soundManager.debugMode = false; // disable debug mode +soundManager.defaultOptions.multiShot = true; + +soundManager.onload = function() { + // soundManager is ready to use (create sounds and so on) + init(); +} diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-land.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-land.png new file mode 100755 index 0000000..e87b2d7 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-land.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-sky.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-sky.png new file mode 100755 index 0000000..f05abde Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/bg-sky.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-10.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-10.cur new file mode 100755 index 0000000..1f78e9e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-10.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-11.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-11.cur new file mode 100755 index 0000000..c559d34 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-11.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-3.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-3.cur new file mode 100755 index 0000000..5864f78 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-3.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-4.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-4.cur new file mode 100755 index 0000000..668fba6 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-4.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-5.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-5.cur new file mode 100755 index 0000000..54de2c9 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-5.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-6.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-6.cur new file mode 100755 index 0000000..d6c536f Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-6.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-7.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-7.cur new file mode 100755 index 0000000..779af62 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-7.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-8.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-8.cur new file mode 100755 index 0000000..07c406e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-8.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-9.cur b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-9.cur new file mode 100755 index 0000000..98bf364 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-9.cur differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-shadow.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-shadow.png new file mode 100755 index 0000000..f200f35 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/cursor-shadow.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/dot.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/dot.png new file mode 100755 index 0000000..8d5592b Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/dot.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/index.html new file mode 100755 index 0000000..1d2201c --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2a/index.html @@ -0,0 +1,360 @@ + + +SoundManager Demo + + + + + + + + +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    + + +
    + +
    +

    SoundManager 2: JS/DOM + Sound Demo

    +

    Heavy DOM manipulation + Javascript Sound (see code for experimental ideas)

    +
    + +

    Click and drag to draw.. Noisily.

    +
    + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/bonk.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/bonk.mp3 new file mode 100755 index 0000000..2bce046 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/bonk.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop.mp3 new file mode 100755 index 0000000..663155e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop2.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop2.mp3 new file mode 100755 index 0000000..10f8bb2 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/audio/fingerplop2.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/css/animation.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/css/animation.css new file mode 100755 index 0000000..2764bc2 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/css/animation.css @@ -0,0 +1,36 @@ +body { + font-size:75%; + background:#667788; + color:#fff; + text-shadow:0 0 0 #fff; /* Safari nonsense */ +} + +h1, h2, h3 { + font:normal 3em "Helvetica Neue",georgia,"times new roman","Arial Rounded MT Bold",helvetica,verdana,tahoma,arial,"sans serif"; + font-weight:normal; + margin-bottom:0px; +} + + +h1 { + margin-top:0px; +} + +h1, h2 { + letter-spacing:-1px; /* zomg web x.0! ;) */ +} + +h2 { + font-size:2em; + margin-top:0.25em; +} + +p { + font:normal 1em verdana,tahoma,arial,"sans serif"; +} + +.point { + position:absolute; + width:32px; + height:32px; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/ball.gif b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/ball.gif new file mode 100755 index 0000000..0f13534 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/ball.gif differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/point.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/point.png new file mode 100755 index 0000000..043a88f Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/image/point.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/index.html new file mode 100755 index 0000000..e51dcf5 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/index.html @@ -0,0 +1,21 @@ + + + + + + + + + +
    + +

    SoundManager 2 demo: A Noisy Page

    +

    Example of sound tied to javascript/DOM event handlers

    + +

    Click and drag for fun.

    + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/script/animation.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/script/animation.js new file mode 100755 index 0000000..61d2382 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/animation-2b/script/animation.js @@ -0,0 +1,94 @@ +soundManager.flashVersion = 9; +soundManager.url = '../../swf/'; +soundManager.useHighPerformance = true; +soundManager.wmode = 'transparent'; +soundManager.debugMode = false; + +var points = []; +var o = null; +var lastX = 0; +var lastY = 0; +var threshhold = 4; +var threshMax = 32; +var noise = null; +var screenX = 0; + +function doPaint(e) { + var x = (e||event).clientX; + var y = (e||event).clientY; + var diff = Math.max(Math.abs(x-lastX),Math.abs(y-lastY)); + if (diff>threshhold) { + lastX = x; + lastY = y; + points.push(new Point(x,y,Math.min(diff/(32),3))); + } + return false; +} + +function stopPaint() { + document.onmousemove = null; + document.onmouseup = null; + // soundManager.play('up'); +} + +function startPaint(e) { + // soundManager.play('down'); + document.onmousemove = doPaint; + document.onmouseup = stopPaint; + lastX = (e||event).clientX; + lastY = (e||event).clientY; + screenX = (window.innerWidth?window.innerWidth:document.documentElement.clientWidth||document.body.clientWidth); + e?e.stopPropagation():event.returnValue = false; + return false; +} + +function initPoints() { + o = document.createElement('img'); + o.src = 'image/point.png'; + o.className = 'point'; + document.onmousedown = startPaint; + document.onmouseup = stopPaint; +} + +function Point(x,y,scale) { + var self = this; + this.data = { + x: x, + y: y, + scale: scale, + scalePX: parseInt(32*scale) + } + this.o = o.cloneNode(false); + this.o.style.left = (x-(this.data.scalePX/2))+'px'; + this.o.style.top = (y-(this.data.scalePX/2))+'px'; + this.o.style.width = this.o.style.height = this.data.scalePX+'px'; + var screenX2 = parseInt(screenX/2); + noise.play({volume:parseInt(Math.min(1,scale/3)*100),pan:(x + + +SoundManager 2: Animation + Sound Demos + + + + + +
    + +

    Javascript Animation + Sound Demos using SoundManager 2

    + +
      +
    1. Interval-based animation (with sound)
    2. +
    3. Smashable Christmas Lights
    4. +
    5. JS-DOM "painting" + Sound, V1
    6. +
    7. JS-DOM "painting" + Sound, V2
    8. +
    + +

    External demo: A Noisy DOM - part of a Yahoo! User Interface blog post, Enhancing YUI-based Apps with Audio.

    + + + +
    diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/api/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/api/index.html new file mode 100755 index 0000000..8ccd5b9 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/api/index.html @@ -0,0 +1,676 @@ + + + +SoundManager 2: Basic API Demo, Examples + + + + + + + + + + + + + + + + +
    + +

    SoundManager 2 / API Demo and Code Examples

    + +

    You can run the API demos with HTML5 enabled, Flash 8 (API default), Flash 9 (normal) or Flash 9 + highPerformance + fastPolling modes (higher JS callback frequency).

    + +

    Wondering where to start? This page has inline executable code examples using the SoundManager 2 API.

    + +

    If you're wondering "How to include SM2 in my page?", the basic template will get you started.

    + +
    + +
    + +

    The basics (old-skool style): onload() + onerror()

    + +

    Once you have SM2 included in your page, you merely need to hook into its onload()/onerror() events:

    + +
    soundManager.onload = function() {
    +  // soundManager is ready to use.
    +  // createSound() / play() etc. can now be called
    +}
    +soundManager.onerror = function() {
    +  // Oh no! No sound support.
    +  // Maybe configure your app to ignore sound calls.
    +  // (SM2 calls will silently return false after this point.)
    +}
    +
    + +

    The modern method: Adding "onready" listeners

    + +

    You can register listeners by passing a function to onready(), and it will be called when SoundManager has finished starting up:

    + +
    soundManager.onready(function() {
    +  if (soundManager.supported()) {
    +    // createSound() / play() etc. can now be called
    +  } else {
    +    // uh-oh, SM2 failed to start - error, unsupported etc.
    +  }
    +});
    +
    + +

    An optional status object is actually passed to your onready() listener, which you can use instead of checking soundManager.supported():

    + +
    soundManager.onready(function(oStatus) {
    +  // oStatus: object containing "success" parameter
    +  if (oStatus.success) {
    +    // createSound() / play() etc. can now be called
    +  } else {
    +    // uh-oh, SM2 failed to start - error, unsupported etc.
    +  }
    +});
    +
    + +

    SoundManager first processes the onready queue in the order items were added, and then fires soundManager.onload() or onerror(). If you call onready() after SM2 has loaded, your callback will be fired immediately.

    + +

    A note about initialization

    + +

    Keep in mind SoundManager's core methods (createSound, etc.) will not be available until soundManager.onload() fires. The initialization time for SM2 can vary across browsers/platforms, and should effectively be assumed to be "asynchronous." Because of this, it is recommended you write your code to handle soundManager.onload() being called either before or after window.onload().

    +

    If you wish to have SM2 always wait for window.onload() before calling soundManager.onload()/onerror(), you can apply the following:

    +
    soundManager.waitForWindowLoad = true;
    + +

    Debug Output, disabling and minified versions

    +

    SoundManager 2 has debug mode enabled by default and will write to agents supporting console.log-style debugging, and/or a custom <div> element in the absence of a console.

    +

    To disable debug output, set soundManager.debugMode = false;

    +

    Alternately, you may use the no-debug, minified version of the SM2 javascript library (which has internal debug code removed, and will silently return false.)

    + +

    Demo 1a: Create + play (simple method)

    +
    soundManager.play('mySound0','../mpc/audio/AMB_SN_5.mp3');
    + +

    Creates and plays a sound with ID "mySound0", at the specified URL. The sound can then be referenced by that ID later, eg. soundManager.play('mySound0');

    +

    Note that this method is only provided for convenience, and allows only ID and URL as parameters. If you want to specify other options (volume, loop, event handlers), you must use the object literal syntax as given below.

    + +

    Demo 1b: Create + play (better method)

    + +
    soundManager.createSound({
    + id:'mySound1',
    + url:'../mpc/audio/CHINA_1.mp3'
    +});
    +soundManager.play('mySound1');
    + +

    Creates, then plays a sound. This object literal method allows for other parameters to be used (see demo 2)

    + +

    Variant: Use object returned from createSound() (best method)

    + +
    var aSoundObject = soundManager.createSound({
    + id:'mySound2',
    + url:'../mpc/audio/CHINA_1.mp3'
    +});
    +aSoundObject.play();
    + +

    Creates, then plays a sound. This object literal method allows for other parameters to be used (see demo 2)

    + +

    Demo 2: Create with onfinish event handler + play with volume argument

    +
    var demo2Sound = soundManager.createSound({
    + id:'mySound4',
    + url:'../mpc/audio/CHINA_1.mp3',
    + onfinish:function() {
    +   soundManager._writeDebug(this.sID+' finished playing');
    + }
    +});
    +demo2Sound.play({volume:50});
    +
    + +

    (creates, then plays a new sound - a function is called when the sound finishes playing)

    + +

    Demo 3: Play a pre-existing sound

    +
    soundManager.play('aDrumSound');
    + +

    This plays an existing sound which was created by soundManager.onload() (for reference, view source of this page.)

    + +

    Demo 4a: Play a sequence of sounds via "onfinish", with multiShot*

    +
    soundManager.play('aDrumSound',{multiShotEvents:true,onfinish:function(){soundManager.play('aCymbalSound');}})
    +

    Differently formatted:

    +
    soundManager.play('aDrumSound',{
    +  multiShotEvents: true, // allow onfinish() to fire for each "shot" (default: only fire onfinish() for last shot.)
    +  onfinish:function() {
    +    soundManager.play('aCymbalSound');
    +  }
    +});
    + +

    This will play an existing sound (created in-page), and uses the "onfinish" handler to make a call to play a second, pre-existing sound.

    +

    Also note that the button can be clicked multiple times, and the sound will be "layered" as multiShot is enabled for both of these sounds when using Flash 9. An onfinish event will also fire as each sound finishes.

    +

    Bug/behaviour note: Whenever "play" is called on a SMSound object, any parameters passed in will apply to all currently-playing instances of the sound if multiShot is allowed. For example, the onfinish handler from demo 4a will apply to demo 3 if 4a is started while 3 is still playing.

    +

    * Multishot is Flash 9+ only.

    + +

    Demo 4b: Create and play a sequence of new sounds via "onfinish"

    +
    soundManager.createSound({
    + id:'aBassDrum',
    + url:'../mpc/audio/AMB_BD_1.mp3',
    + multiShot:false,
    + onfinish:function() {
    +   soundManager.play('aRimSound','AMB_RIM1.mp3');
    + }
    +});
    +soundManager.play('aRimSound');
    + +

    This will crate and play a new sound, using the "onfinish" handler to create and play a second, new sound.

    +

    It is recommended to create sound objects first, to simplify troubleshooting.

    + +

    Demo 4c: Looping a sound (conventional, onfinish()-based)

    +
    var s = soundManager.createSound({
    +  id:'hhCymbal',
    +  url:'../mpc/audio/AMB_HHOP.mp3'
    +});
    +
    +s.play({
    +  onfinish: function() {
    +    this.play();
    +    // or, soundManager.play('hhCymbal');
    +  }
    +});
    +
    + + | +

    Note that there are issues with seamlessly-looping sounds, it is "close, but not perfect" with Flash 8/9 at this point.

    + +

    Demo 4d: Looping a sound ("loops" parameter method)

    +
    var s = soundManager.createSound({
    +  id:'hhCymbal',
    +  url:'../mpc/audio/AMB_HHOP.mp3'
    +});
    +
    +s.play({
    +  loops: 3
    +});
    +
    + + | +

    Looping is possible as shown above using Flash 9. With flash 8, the sound must be preloaded before looping can begin - eg. autoLoad: true, onload: function() { this.play{loops:3} }. For tighter looping, see See Seamless Looping MP3 in Flash for further details.

    + + +

    Demo 4e: Sound timing notifications using onposition()

    +
    var s = soundManager.getSoundById('aCymbalSound'); // existing sound object
    +
    +// register some listeners (only do this once, they will work for subsequent plays)
    +
    +if (typeof addedListeners === 'undefined') {
    +  addedListeners = true;
    +
    +  s.onposition(500, function(eventPosition) { // fire at 0.5 seconds
    +    soundManager._writeDebug('Sound '+this.sID+' has reached position '+eventPosition);
    +  });
    +
    +  s.onposition(1000, function(eventPosition) {// fire at 1 second
    +    soundManager._writeDebug('Sound '+this.sID+' has reached position '+eventPosition);
    +  });
    +}
    +
    +s.play({
    +  whileplaying:function() {
    +    // demo only: show sound position while playing, for context
    +    soundManager._writeDebug('position = ' + this.position);
    +  }
    +});
    +
    + + +

    onposition() allows you to add an event listener for a given time (in miliseconds, watching the position property); the event fires when that time has been reached while a sound is playing.

    +

    Note that for multiShot cases, the listeners will only fire for the original (first) shot because its position is the only one that is tracked within Flash.

    + +

    Demo 5a: Set sound parameters, then play

    +
    var sound = soundManager.getSoundById('chinaCymbal'); // predefined/preloaded sound
    +sound.setPosition(500); // 500 msec into sound
    +sound.setPan(-75);      // 75% left pan
    +sound.play();
    +
    + | +

    This will set the position of an existing, pre-loaded sound, then play it.

    + +

    Variant: play()

    +
    var sound = soundManager.getSoundById('chinaCymbal');
    +sound.play({position:500,pan:-75});
    +
    + | +

    Note that if planning to layer sounds with multiShot (Flash 9 only), this variant method will give best results as each new "channel" is started with parameters.

    + +

    Demo 5b: Global sound muting

    +

    If not passed a sound ID, soundManager.mute() will mute all existing and newly-created sounds. soundManager.unmute() can also be passed a sound ID, and performs the inverse either on a single sound or all sounds.

    +

    In this demo, all sounds are globally muted and unmuted a few times. Different parameters are used to help audibly separate the sounds.

    +
    soundManager.mute(); // mute all sounds
    +
    +soundManager.createSound({
    + id: '880hz',
    + url: '../_mp3/880hz.mp3',
    + autoLoad:true,
    + onload: function() {
    +   // soundManager.mute(); // mute all sounds
    +   // play (muted) cymbal sound..
    +   this.play({
    +     volume:75, // volume for when un-muted
    +     pan:-75,   // mostly on left channel 
    +     // .. and clean-up afterwards
    +     onfinish:function() {
    +       this.destruct();
    +     }
    +   });
    +
    +   this.setVolume(25); // new volume for when un-muted..
    +
    +   soundManager.play('s440hz',{
    +     pan:75,
    +     onfinish:function() {
    +       document.getElementById('btn-d5b').disabled = false;
    +     }
    +   });
    +
    +   // once playing, toggle all sounds some more
    +   setTimeout(soundManager.unmute,500);
    +   setTimeout(soundManager.mute,1000);
    +   setTimeout(soundManager.unmute,1500);
    +   setTimeout(soundManager.mute,2000);
    +   setTimeout(soundManager.unmute,2500);
    + }
    +});
    + + + +

    Demo 5c: Per-object sound muting

    +
    soundManager.createSound({
    + id: '880hz',
    + url: '../_mp3/880hz.mp3',
    + autoLoad:true,
    + onload: function() {
    +   soundManager.mute('880hz'); // mute this - alternately, this.mute() would work here
    +   soundManager.play('s440hz',{ // play another sound to demo muting
    +    onfinish: function() {
    +      document.getElementById('btn-d5c').disabled = false;
    +    }
    +   });
    +
    +   // play 880hz (muted)..
    +   this.play({
    +     volume:75,
    +     // .. and clean-up afterwards
    +     onfinish:function() {
    +       this.destruct();
    +     }
    +   });
    +
    +   this.setVolume(50); // still muted, however..
    +
    +   // mute/unmute china cymbal some more
    +   // mute sound calls: soundManager.mute('880hz'), or soundManager.getSoundById('880hz').mute();
    +   setTimeout(this.unmute,250);
    +   setTimeout(this.mute,500);
    +   setTimeout(this.unmute,750);
    +   setTimeout(this.mute,1000);
    +   setTimeout(this.unmute,1250);
    + }
    +});
    + + + +

    Demo 6: Create, play, unload and destroy a sound

    +
    var foo = soundManager.createSound({
    + id: 'fooSound',
    + url: '../mpc/audio/AMB_BD_1.mp3'
    +});
    +
    +// soundManager.play('fooSound');
    +
    +// (Some time later on...)
    +// soundManager.unload('fooSound'); - release the loaded MP3
    +// soundManager.destroySound('fooSound'); - destroy the sound, freeing up memory etc. Also calls unload().
    +
    +// Alternate (demo) approach, call methods directly on sound object itself:
    +foo.play({
    + onfinish:function() {
    +   // once sound has loaded and played, unload and destroy it.
    +   this.destruct(); // will also try to unload before destroying.
    + }
    +});
    + + + +

    Demo 7: Create, manually pre-load and finally play a sound

    +
    var preload = soundManager.createSound({
    + id: 'preloadSound',
    + url: '../mpc/audio/AMB_HHOP.mp3'
    +});
    +
    +preload.load(); // load the sound ahead of time
    +setTimeout(preload.play,1500); // and start playing it 1.5 seconds from now
    +
    + + +

    Demo 8: Create and play an invalid sound (404)

    +
    var bad = soundManager.createSound({
    +  id:'badSound',
    +  url:'badurl.mp3',
    +  onload: function(bSuccess) {
    +    soundManager._writeDebug('sound '+(bSuccess?'loaded!':'did NOT load.'));
    +  }
    +});
    +bad.play();
    +
    + + +

    Demo 9: Create and destroy a sound at once (unusual crash testcase)

    +
    var s = soundManager.createSound({
    +  id:'testcase',
    +  url:'../mpc/audio/AMB_HHOP.mp3'
    +});
    +s.play();
    +s.destruct();
    +
    + + +

    Demo 10: Sound timing (position accuracy testcase)

    +

    The Flash 9 version seems to resume the sound 1 msec earlier than it should, perhaps related to the timing/delay issue most noticeable on Windows.

    +
    var count = 0;
    +var pos = -1;
    +var s = soundManager.createSound({
    +  id: 's',
    +  url: '../mpc/audio/CHINA_1.mp3',
    +  whileplaying: function() {
    +    if (count == 0) {
    +      if (this.position > 1000) {
    +        this.pause();
    +        pos = this.position;
    +        count++;
    +        this.resume();
    +      }
    +    } else if (count == 1) {
    +      soundManager._writeDebug('old position: ' + pos);
    +      soundManager._writeDebug('new position: ' + this.position);
    +      // See that this.position is less than pos!
    +      count++;
    +    }
    +  },
    +  onfinish: function() {
    +    this.destruct();
    +  }
    +});
    +s.play();
    + + +

    Demo 11: Inline whileplaying() event assignment

    +

    Note that when using the Flash 9 version of SM2 with Flash 9 and 10 plugins, flash/OS-related delay conditions may result in the position property being less than the duration property, even by the end of the sound.

    +
    var foo = soundManager.createSound({
    +  id: 'bar',
    +  url: '../mpc/audio/CRASH_1.mp3'
    +});
    +foo.options.whileplaying = function() {
    +  soundManager._writeDebug('whileplaying(): '+this.position+' / '+this.duration);
    +}
    +foo.play();
    +
    +// note: assign .options before calling .play(), as that "bakes" the options into a play instance object.
    +// the below "late" event handler assignment will have no effect on the already-playing instance.
    +foo.options.onfinish = function() { soundManager._writeDebug(this.sID+' stopped.'); }
    +
    + + +

    Demo 12: 48 KHz MP3 sampling rate playback issue workaround

    +

    To work around a known "chipmunk" sampling rate issue with 48 KHz MP3s in Flash, one can apparently load a sound using Flash 9 with stream = false, and then call play() once the sound has fully-loaded. Exactly why this works is not known.

    +
    var fortyeight = soundManager.createSound({
    +  id: 's-48khz',
    +  url: 'http://freshly-ground.com/data/audio/48khz-test.mp3'
    +});
    +
    +if (!fortyeight.loaded) {
    +  // first time loading/playing
    +  fortyeight.load({
    +    stream: false,
    +    onload: function() {
    +      // sound has fully-loaded
    +      this.play();
    +    }
    +  });
    +} else {
    +  // sound has already loaded
    +  fortyeight.play();
    +}
    +
    + + +

    Demo 13: onbeforefinish() testcase

    +

    This event fires when the sound's position property is equal to or less than onbeforefinishtime msec from the end of the sound, as defined by duration. If unspecified, a default value is used (eg. 5000 msec.)

    +
    var d13 = soundManager.createSound({
    +  id: 'demo13',
    +  url: '../mpc/audio/CRASH_1.mp3',
    +  onbeforefinish: function() {
    +    soundManager._writeDebug(this.sID+'.onbeforefinish(): '+this.position+' of '+this.duration);
    +  },
    +  onbeforefinishtime: 1000
    +});
    +d13.play();
    +
    + + +

    Demo 14: autoLoad:true + play() testcase

    +

    Bug testcase (Flash 8 version-specific): creating a sound with autoLoad:true and immediately calling play() does not work.

    +
    var autoLoadTest = soundManager.createSound({
    +   id: 'autoLoadTest',
    +   url: getRandomMP3URL(),
    +   onload: function() {
    +	soundManager._writeDebug(this.sID+' loaded.');
    +   },
    +   onplay: function() {
    +     soundManager._writeDebug('Starting sound: '+this.sID);
    +   },
    +   autoPlay: false,
    +   autoLoad: true,
    +   stream: true
    +  });
    +  // autoLoadTest.play(); // sound will not start
    +  setTimeout(autoLoadTest.play,1000); // may work with a delay?
    +
    +

    Under Flash 8, this case does not work as expected. Even with the delay, the sound does not begin playing as soon as expected - sometimes it fires after the sound loads, in fact. For this reason, avoid using autoLoad:true if you intend to play the sound shortly after creating it when using Flash 8.

    + + +

    Demo 15: autoPlay + onfinish() testcase

    +

    Bug testcase (Flash 8 version-specific): onfinish() does not fire with autoPlay:true

    +
    var sound = soundManager.createSound({
    + id: 'demo15',
    + url: '../mpc/audio/AMB_SN13.mp3',
    + onfinish: function() {
    +  soundManager._writeDebug(this.sID+' finished (now destroying)');
    +  // destroy this sound
    +  this.destruct();
    + },
    + autoPlay: true,
    + multiShot: false
    +});
    +
    + + +

    Demo 16: onstop() -> unload() testcase

    +

    Bug testcase: unload() from onstop() does not work

    +
    var sound16 = soundManager.createSound({
    + id: 'demo16',
    + url: getRandomMP3URL(),
    + onstop: function() {
    +  soundManager.unload(this.sID);
    + },
    + onload: function() {
    +   soundManager._writeDebug('loaded');
    + }
    +});
    +sound16.play();
    +setTimeout(sound16.stop,1500);
    +
    + + +

    Demo 17: Buffering event handler/property example (Flash 9 only)

    +

    Reporting the isBuffering property of a SMSound object

    +
    if (soundManager.flashVersion != 8) {
    +  var sound17 = soundManager.createSound({
    +    id: 'demo17',
    +    url: getRandomMP3URL(),
    +    onbufferchange: function() {
    +      soundManager._writeDebug('Buffering '+(this.isBuffering?'started':'stopped')+'.');
    +    },
    +    onload: function() {
    +      soundManager._writeDebug(this.sID+' loaded.');
    +    }
    +  });
    +  sound17.play();
    +}
    +
    + + + + + +
    + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/christmaslights-home.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/christmaslights-home.js new file mode 100755 index 0000000..2ebc4fa --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/christmaslights-home.js @@ -0,0 +1,510 @@ +// Christmas Light Smashfest +// Adapted from XLSF 2007 as originally used on http://schillmania.com/?theme=2007&christmas=1 + +var Y = { + // shortcuts + A: YAHOO.util.Anim, + D: YAHOO.util.Dom, + E: YAHOO.util.Event, + UE: YAHOO.util.Easing, + CA: YAHOO.util.ColorAnim, + BG: YAHOO.util.BgPosAnim +} + +function XLSF(oTarget,urlBase,lightClass) { + var writeDebug = soundManager._wD; + writeDebug('XLSF()'); + var IS_MOON_COMPUTER = false; + var isIE = navigator.userAgent.match(/msie/i); + var self = this; + var xlsf = self; + var animDuration = 1; + this.oFrag = document.createDocumentFragment(); + this.oTarget = (oTarget?oTarget:document.documentElement); + this.oExplosionBox = document.createElement('div'); + this.oExplosionBox.className = 'xlsf-fragment-box'; + this.oExplosionFrag = document.createElement('div'); + this.oExplosionFrag.className = 'xlsf-fragment'; + this.lights = []; + this.lightClasses = { + pico: 32, + tiny: 50, + small: 64, + medium: 72, + large: 96 + } + this.urlBase = (typeof urlBase == 'undefined' || !urlBase?'demo/christmas-lights/':urlBase); + + if (window.innerWidth || window.innerHeight) { + var screenX = window.innerWidth; // -(!isIE?24:2); + var screenY = window.innerHeight; + } else { + var screenX = (document.documentElement.clientWidth||document.body.clientWidth||document.body.scrollWidth); // -(!isIE?8:0); + var screenY = (document.documentElement.clientHeight||document.body.clientHeight||document.body.scrollHeight); + } + + this.lightClass = (screenX>1280?'small':'pico'); // kind of light to show (32px to 96px square) + + if (typeof lightClass != 'undefined') { + // hack: override + this.lightClass = lightClass; + } + + if (window.location.href.match(/size=/i)) { + this.lightClass = window.location.href.substr(window.location.href.indexOf('size=')+5); + } + + this.lightXY = this.lightClasses[this.lightClass]; // shortcut to w/h + + this.lightGroups = { + left: [], + top: [], + right: [], + bottom: [] + } + this.lightSmashCounter = 0; + this.lightIndex = 0; + this.lightInterval = 250; + this.timer = null; + this.bgBaseX = 0; + this.bgBaseY = 0; + this.soundIDs = 0; + this.soundPan = { + panValue: 75, + left: 0, + mid: 481, + right: 962 + } + + this.cover = document.createElement('div'); + this.cover.className = 'xlsf-cover'; + document.documentElement.appendChild(this.cover); + + this.initSounds = function() { + for (var i=0; i<6; i++) { + soundManager.createSound({ + id: 'smash'+i, + url: xlsf.urlBase+'sound/glass'+i+'.mp3', + autoLoad: true, + multiShot: true, + volume:50 + }); + } + self.initSounds = function() {} // safety net + } + + this.appendLights = function() { + writeDebug('xlsf.appendLights()'); + self.oTarget.appendChild(self.oFrag); + self.oFrag = document.createDocumentFragment(); + } + + function ExplosionFragment(nType,sClass,x,y,vX,vY) { + var self = this; + this.o = xlsf.oExplosionFrag.cloneNode(true); + this.nType = nType; + this.sClass = sClass; + this.x = x; + this.y = y; + this.w = 50; + this.h = 50; + this.bgBaseX = 0; + this.bgBaseY = this.h*this.nType; + this.vX = vX*(1.5+Math.random()); + this.vY = vY*(1.5+Math.random()); + this.oA = null; + this.oA2 = null; + this.burstPhase = 3; // starting background offset point + this.burstPhases = 4; // 1+offset (ignore large size) + this.o.style.backgroundPosition = ((this.w*-this.burstPhase)+'px '+(this.h*-nType)+'px'); + + // boundary checks + if (self.sClass == 'left') { + this.vX = Math.abs(this.vX); + } else if (self.sClass == 'right') { + this.vX = Math.abs(this.vX)*-1; + } + + this.burstTween = function() { + // determine frame to show + var phase = 1+Math.floor((this.currentFrame/this.totalFrames)*self.burstPhases); + if (phase != self.burstPhase) { + self.burstPhase = phase; + self.o.style.backgroundPosition = ((self.w*-self.burstPhase)+'px '+(self.h*-nType)+'px'); + } + } + + this.burst = function() { + self.oA = new Y.A(self.o,{marginLeft:{to:(self.vX*8)},marginTop:{to:(self.vY*8)}},animDuration,Y.UE.easeOutStrong); + self.oA.onTween.subscribe(self.burstTween); + // self.oA.onComplete.subscribe(self.hide); + self.oA.animate(); + } + + this.hide = function() { + if (!isIE) self.o.style.opacity = 0; + } + + this.reset = function() { + self.o.style.left = '0px'; + self.o.style.top = '0px'; + self.o.style.marginLeft = '0px'; + self.o.style.marginTop = '0px'; + if (!isIE) self.o.style.opacity = 1; + } + + this.animate = function() { + self.reset(); + self.burst(); + } + + } + + function Explosion(nType,sClass,x,y) { + var oParent = this; + var self = this; + this.o = null; + this.nType = nType; + this.sClass = sClass; + this.x = x; + this.y = y; + this.boxVX = 0; + this.boxVY = 0; + this.o = xlsf.oExplosionBox.cloneNode(true); + this.o.style.left = x+'px'; + this.o.style.top = y+'px'; + // this.oFrag = document.createDocumentFragment(); + this.fragments = []; + + var mX = x; + var mY = y; + + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,-5,-5)); + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,0,-5)); + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,5,-5)); + + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,-5,0)); + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,0,0)); + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,5,0)); + + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,5,-5)); + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,5,0)); + this.fragments.push(new ExplosionFragment(nType,sClass,mX,mY,5,5)); + + this.init = function() { + for (var i=self.fragments.length; i--;) { + self.o.appendChild(self.fragments[i].o); + } + // xlsf.oTarget.appendChild(self.o); + // self.oFrag = document.createDocumentFragment(); + if (!IS_MOON_COMPUTER) { + // faster rendering, particles get cropped + xlsf.oFrag.appendChild(self.o); + } else { + // slower rendering, can overlay body + // _id('header').appendChild(self.o); + // (document.documentElement?document.documentElement:document.body).appendChild(o); + xlsf.oFrag.appendChild(self.o); + } + } + + this.reset = function() { + // clean-up + // self.o.parentNode.removeChild(self.o); + self.o.style.display = 'none'; + self.o.style.marginLeft = '0px'; + self.o.style.marginTop = '0px'; + self.o.style.left = self.x+'px'; + self.o.style.top = self.y+'px'; + if (!isIE) self.o.style.opacity = 1; + for (var i=self.fragments.length; i--;) { + self.fragments[i].reset(); + } + } + + this.trigger = function(boxVX,boxVY) { + self.o.style.display = 'block'; + self.boxVX = boxVX; + self.boxVY = boxVY; + // boundary checks + if (self.sClass == 'right') { + self.boxVX = Math.abs(self.boxVX)*-1; + } else if (self.sClass == 'left') { + self.boxVX = Math.abs(self.boxVX); + } + for (var i=self.fragments.length; i--;) { + self.fragments[i].animate(); + } + if (!isIE && (IS_MOON_COMPUTER)) { + var oAExplode = new Y.A(self.o,{marginLeft:{to:100*self.boxVX},marginTop:{to:150*self.boxVY},opacity:{to:0.01}},animDuration,Y.UE.easeInStrong); + } else { + // even IE 7 sucks w/alpha-transparent PNG + CSS opacity. Boo urns. + var oAExplode = new Y.A(self.o,{marginLeft:{to:100*self.boxVX},marginTop:{to:150*self.boxVY}},animDuration,Y.UE.easeInStrong); + } + oAExplode.onComplete.subscribe(self.reset); + oAExplode.animate(); + // setTimeout(self.reset,animDuration*1000*1.5); + } + + this.init(); + + // this.trigger(); // boooom! + + } + + function Light(sSizeClass,sClass,nType,x,y) { + var self = this; + this.o = document.createElement('div'); + this.sClass = sClass; + this.sSizeClass = sSizeClass; + this.nType = (nType||0); + this.useY = (sClass == 'left' || sClass == 'right'); + this.state = null; + this.broken = 0; + this.w = xlsf.lightClasses[sSizeClass]; + this.h = xlsf.lightClasses[sSizeClass]; + this.x = x; + this.y = y; + this.bg = xlsf.urlBase+'image/bulbs-'+this.w+'x'+this.h+'-'+this.sClass+'.png'; + this.o.style.width = this.w+'px'; + this.o.style.height = this.h+'px'; + this.o.style.background = 'url('+this.bg+') no-repeat 0px 0px'; + this.bgBaseX = (self.useY?-self.w*this.nType:0); + this.bgBaseY = (!self.useY?-self.h*this.nType:0); + this.glassType = parseInt(Math.random()*6); + this.oExplosion = null; + this.soundID = 'smash'+this.glassType; + var panValue = xlsf.soundPan.panValue; // eg. +/- 80% + this.pan = parseInt(this.x<=xlsf.soundPan.mid?-panValue+((this.x/xlsf.soundPan.mid)*panValue):(this.x-xlsf.soundPan.mid)/(xlsf.soundPan.right-xlsf.soundPan.mid)*panValue); + + this.initSound = function() { + } + + this.setBGPos = function(x,y) { + self.o.style.backgroundPosition = ((self.bgBaseX+x)+'px '+(self.bgBaseY+y)+'px'); + } + + this.setLight = function(bOn) { + if (self.broken || self.state == bOn) return false; + if (!self.w || !self.h) self.getDimensions(); + self.state = bOn; + if (self.useY) { + self.setBGPos(0,-this.h*(bOn?0:1)); + } else { + self.setBGPos(-this.w*(bOn?0:1),0); + } + } + + this.getDimensions = function() { + self.w = self.o.offsetWidth; + self.h = self.o.offsetHeight; + self.bgBaseX = (self.useY?-self.w*self.nType:0); + self.bgBaseY = (!self.useY?-self.h*self.nType:0); + } + + this.on = function() { + self.setLight(1); + } + + this.off = function() { + self.setLight(0); + } + + this.flickr = function() { + self.setLight(Math.random()>=0.5?1:0); + } + + this.toggle = function() { + self.setLight(!self.state?1:0); + } + + this.explode = function(e) { + // self.oExplosion = new Explosion(self.nType,self.sClass,self.x,self.y); + self.oExplosion.trigger(0,1); // boooom! + } + + this.smash = function(e) { + if (self.broken) return false; + self.broken = true; + if (soundManager && soundManager.supported()) { + soundManager.play(self.soundID,{pan:self.pan}); + // soundManager.sounds[self.soundID].play({pan:self.pan}); + // if (self.bonusSound != null) window.setTimeout(self.smashBonus,1000); + } + self.explode(e); + var rndFrame = 2; // +parseInt(Math.random()*3); + if (self.useY) { + self.setBGPos(0,self.h*-rndFrame); + } else { + self.setBGPos(self.w*-rndFrame,0); + } + xlsf.lightSmashCounter++; + } + + this.smashBonus = function() { + // soundManager.play(self.bonusSounds[self.bonusSound],urlBase+'sound/'+self.bonusSounds[self.bonusSound]+'.mp3'); + } + + this.reset = function() { + if (!self.broken) return false; + self.broken = false; + self.state = null; + xlsf.lightSmashCounter--; + self.flickr(); + } + + this.init = function() { + self.o.className = 'xlsf-light '+this.sizeClass+' '+this.sClass; + self.o.style.left = self.x+'px'; + self.o.style.top = self.y+'px'; + self.o.style.width = self.w+'px'; + self.o.style.height = self.h+'px'; + self.o.onmouseover = self.smash; + self.o.onclick = self.smash; + self.flickr(); + xlsf.oFrag.appendChild(self.o); + self.oExplosion = new Explosion(self.nType,self.sClass,self.x,self.y); + } + + this.init(); + + } // Light() + + this.createLight = function(sClass,nType,x,y) { + var oLight = new Light(self.lightClass,sClass,nType,x,y); + self.lightGroups[sClass].push(oLight); + self.lights.push(oLight); + return oLight; + } + + this.rotateLights = function() { + self.lights[self.lightIndex==self.lights.length?self.lights.length-1:self.lightIndex].off(); + self.lightIndex++; + if (self.lightIndex == self.lights.length) { + self.lightIndex = 0; + } + self.lights[self.lightIndex].on(); + } + + this.randomLights = function() { + self.lights[parseInt(Math.random()*self.lights.length)].toggle(); + } + + + this.destroyLights = function() { + self.startSequence(self.destroyLight,20); + } + + this.destroyLight = function() { + var groupSize = 2; // # to smash at a time + if (self.lightSmashCounter + var offset = parseInt(document.getElementsByTagName('h1')[0].offsetWidth)+16; + + var jMax = Math.floor((screenX-offset-16)/self.lightXY); + var iMax = Math.floor((screenY-offset-16)/self.lightXY); + + for (j=0; j=0.5?1:0); + } + + this.toggle = function() { + self.setLight(!self.state?1:0); + } + + this.explode = function(e) { + // self.oExplosion = new Explosion(self.nType,self.sClass,self.x,self.y); + self.oExplosion.trigger(0,1); // boooom! + } + + this.smash = function(e) { + if (self.broken) return false; + self.broken = true; + if (soundManager && soundManager.supported()) { + soundManager.play(self.soundID,{pan:self.pan}); + // soundManager.sounds[self.soundID].play({pan:self.pan}); + // if (self.bonusSound != null) window.setTimeout(self.smashBonus,1000); + } + self.explode(e); + var rndFrame = 2; // +parseInt(Math.random()*3); + if (self.useY) { + self.setBGPos(0,self.h*-rndFrame); + } else { + self.setBGPos(self.w*-rndFrame,0); + } + xlsf.lightSmashCounter++; + // xlsf.doNukeCheck(); + // window.setTimeout(self.reset,3000); // respawn + } + + this.smashBonus = function() { + // soundManager.play(self.bonusSounds[self.bonusSound],urlBase+'sound/'+self.bonusSounds[self.bonusSound]+'.mp3'); + } + + this.reset = function() { + if (!self.broken) return false; + self.broken = false; + self.state = null; + xlsf.lightSmashCounter--; + // self.oExplosion.reset(); // may not be necessary + self.flickr(); + } + + this.init = function() { + self.o.className = 'xlsf-light '+this.sizeClass+' '+this.sClass; + self.o.style.left = self.x+'px'; + self.o.style.top = self.y+'px'; + self.o.style.width = self.w+'px'; + self.o.style.height = self.h+'px'; + // self.o.onmouseover = self.toggle; + // self.o.onmouseout = self.toggle; + self.o.onmouseover = self.smash; + self.o.onclick = self.smash; + self.flickr(); + xlsf.oFrag.appendChild(self.o); + self.oExplosion = new Explosion(self.nType,self.sClass,self.x,self.y); + } + + this.init(); + + } // Light() + + this.createLight = function(sClass,nType,x,y) { + var oLight = new Light(self.lightClass,sClass,nType,x,y); + self.lightGroups[sClass].push(oLight); + self.lights.push(oLight); + return oLight; + } + + this.rotateLights = function() { + self.lights[self.lightIndex==self.lights.length?self.lights.length-1:self.lightIndex].off(); + self.lightIndex++; + if (self.lightIndex == self.lights.length) { + self.lightIndex = 0; + } + self.lights[self.lightIndex].on(); + } + + this.randomLights = function() { + self.lights[parseInt(Math.random()*self.lights.length)].toggle(); + } + + + this.destroyLights = function() { + self.startSequence(self.destroyLight,20); + } + + this.destroyLight = function() { + var groupSize = 2; // # to smash at a time + if (self.lightSmashCounter2) bsCounter = 0; // hack - loop through sounds + } +*/ + + this.appendLights(); + + // post-load/init case in the event this object is created late + // if (soundManager && soundManager._didInit && !soundManager._disabled) this.initSounds(); + + this.startSequence(self.randomLights); + + // setTimeout(this.destroyLights,10000); + // setTimeout(this.uberSmash,10000); + +} // --- XLSF2007() + +var xlsf = null; + +function smashInit() { + xlsf = new XLSF(document.getElementById('lights')); + xlsf.initSounds(); + document.getElementById('loading').style.display = 'none'; +} + +soundManager.url = '../../swf/'; +soundManager.flashVersion = 9; +soundManager.debugMode = false; + +soundManager.onload = function() { + setTimeout(smashInit,500); +} + +soundManager.onerror = function() { + setTimeout(smashInit,500); +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bg-strip-dark.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bg-strip-dark.png new file mode 100755 index 0000000..80e07d9 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bg-strip-dark.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/blank.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/blank.png new file mode 100755 index 0000000..85af9fd Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/blank.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-bottom.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-bottom.png new file mode 100755 index 0000000..7246c01 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-bottom.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-left.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-left.png new file mode 100755 index 0000000..1cf077f Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-left.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-right.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-right.png new file mode 100755 index 0000000..8e68ec1 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-right.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-top.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-top.png new file mode 100755 index 0000000..0156c25 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-32x32-top.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-bottom.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-bottom.png new file mode 100755 index 0000000..79d3b07 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-bottom.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-fragments.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-fragments.png new file mode 100755 index 0000000..f963a89 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-fragments.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-left.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-left.png new file mode 100755 index 0000000..6aa0965 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-left.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-right.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-right.png new file mode 100755 index 0000000..c095739 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-right.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-top.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-top.png new file mode 100755 index 0000000..780fe75 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50-top.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50.png new file mode 100755 index 0000000..eb31135 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-50x50.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-bottom.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-bottom.png new file mode 100755 index 0000000..49341a1 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-bottom.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-left.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-left.png new file mode 100755 index 0000000..cb581e4 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-left.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-right.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-right.png new file mode 100755 index 0000000..fdd54ee Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-right.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-top.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-top.png new file mode 100755 index 0000000..09b098b Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-64x64-top.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-bottom.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-bottom.png new file mode 100755 index 0000000..4e5cae3 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-bottom.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-left.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-left.png new file mode 100755 index 0000000..c8bfa43 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-left.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-right.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-right.png new file mode 100755 index 0000000..20a614b Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-right.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-top.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-top.png new file mode 100755 index 0000000..76fd676 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-72x72-top.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-bottom.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-bottom.png new file mode 100755 index 0000000..3506236 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-bottom.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-left.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-left.png new file mode 100755 index 0000000..6f727e5 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-left.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-right.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-right.png new file mode 100755 index 0000000..f4456d6 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-right.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-top.png b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-top.png new file mode 100755 index 0000000..5c2ba64 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/image/bulbs-96x96-top.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/index.html new file mode 100755 index 0000000..ff9c6fe --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/index.html @@ -0,0 +1,33 @@ + + +Smashable Christmas Lights + + + + + + + + + +
    + +
    +

    Christmas Light Smashfest 2008: Prototype

    +

    Rendering...

    +
    + +
    + +
    + +
    + pico | tiny | small | medium | large +
    + +
    + + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass0.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass0.mp3 new file mode 100755 index 0000000..c161c69 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass0.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass1.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass1.mp3 new file mode 100755 index 0000000..8d7d6b5 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass1.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass2.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass2.mp3 new file mode 100755 index 0000000..ef5f556 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass2.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass3.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass3.mp3 new file mode 100755 index 0000000..be7886e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass3.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass4.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass4.mp3 new file mode 100755 index 0000000..0f328f6 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass4.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass5.mp3 b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass5.mp3 new file mode 100755 index 0000000..b54513e Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/sound/glass5.mp3 differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/yahoo-dom-event-animation-260.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/yahoo-dom-event-animation-260.js new file mode 100755 index 0000000..c38fd9f --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/christmas-lights/yahoo-dom-event-animation-260.js @@ -0,0 +1,35 @@ +/* +Copyright (c) 2008, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.6.0 +*/ +if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.6.0",build:"1321"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var K=YAHOO.env.ua.ie?"focusin":"focus";var L=YAHOO.env.ua.ie?"focusout":"blur";return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var M=this;var N=function(){M._tryPreloadAttach();};this._interval=setInterval(N,this.POLL_INTERVAL);}},onAvailable:function(R,O,S,Q,P){var M=(YAHOO.lang.isString(R))?[R]:R;for(var N=0;N-1;Q--){W=(this._removeListener(N[Q],M,V,Y)&&W);}return W;}}if(!V||!V.call){return this.purgeElement(N,false,M);}if("unload"==M){for(Q=J.length-1;Q>-1;Q--){X=J[Q];if(X&&X[0]==N&&X[1]==M&&X[2]==V){J.splice(Q,1);return true;}}return false;}var R=null;var S=arguments[4];if("undefined"===typeof S){S=this._getCacheIndex(N,M,V);}if(S>=0){R=I[S];}if(!N||!R){return false;}if(this.useLegacyEvent(N,M)){var P=this.getLegacyIndex(N,M);var O=E[P];if(O){for(Q=0,T=O.length;Q0&&F.length>0);}var R=[];var T=function(V,W){var U=V;if(W.override){if(W.override===true){U=W.obj;}else{U=W.override;}}W.fn.call(U,W.obj);};var N,M,Q,P,O=[];for(N=0,M=F.length;N-1;N--){Q=F[N];if(!Q||!Q.id){F.splice(N,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(Q,R,T){var O=(YAHOO.lang.isString(Q))?this.getEl(Q):Q;var S=this.getListeners(O,T),P,M;if(S){for(P=S.length-1;P>-1;P--){var N=S[P];this._removeListener(O,N.type,N.fn,N.capture);}}if(R&&O&&O.childNodes){for(P=0,M=O.childNodes.length;P-1;O--){N=I[O];if(N){M._removeListener(N[M.EL],N[M.TYPE],N[M.FN],N[M.CAPTURE],O);}}N=null;}G=null;M._simpleRemove(window,"unload",M._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var M=document.documentElement,N=document.body;if(M&&(M.scrollTop||M.scrollLeft)){return[M.scrollTop,M.scrollLeft];}else{if(N){return[N.scrollTop,N.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(O,P,N,M){O.addEventListener(P,N,(M));};}else{if(window.attachEvent){return function(O,P,N,M){O.attachEvent("on"+P,N);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(O,P,N,M){O.removeEventListener(P,N,(M));};}else{if(window.detachEvent){return function(N,O,M){N.detachEvent("on"+O,M);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener; +/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */ +if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{}; +var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C0)?E:0;}B.Dom.setStyle(this.getEl(),C,E+D);},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.6.0",build:"1321"}); \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/debug.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/debug.css new file mode 100755 index 0000000..728fd4b --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/debug.css @@ -0,0 +1,25 @@ +#soundmanager-debug { + position:fixed; + _position:absolute; /* IE <7 */ + bottom:1em; + right:1em; + width:38em; + height:30em; + overflow:auto; + padding:0px; + margin:1em; + font-family:monaco,"VT-100",terminal,"lucida console",courier,system; + opacity:0.9; + color:#333; + border:1px solid #ccddee; + -moz-border-radius:3px; + -khtml-border-radius:3px; + -webkit-border-radius:3px; + background:#f3f9ff; +} + +#soundmanager-debug div { + font-size:x-small; + padding:0.2em; + margin:0px; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/basic.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/basic.html new file mode 100755 index 0000000..39b768b --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/basic.html @@ -0,0 +1,36 @@ + + + +SoundManager 2: Flash blocker handling - basic example + + + + + + + + + + + + +
    + +

    SoundManager 2: Flashblock / "click to flash" handling: Basic Demo

    + +
    + +
    + +

    See flashblock.css as a template for making your own SM2 + flash block implementations.

    + +
    \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/flashblock.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/flashblock.css new file mode 100755 index 0000000..6733a08 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/flashblock.css @@ -0,0 +1,99 @@ +/* + SoundManager 2 + useFlashBlock + Flash positioning and flashblock / clicktoflash handling +*/ + +#sm2-container { + /* + where the SM2 flash movie goes. by default, relative container. + set relative or absolute here, and don't touch it later or bad things will happen (see below comments.) + */ + position:relative; + width:1px; + height:1px; + _overflow:hidden; /* screw IE 6, just make it display nice */ +} + +#sm2-container object, +#sm2-container embed { + /* + the actual movie bit. + SWF needs to be able to be moved off-screen without display: or position: changes. important. + changing display: or position: or overflow: here or on parent can cause SFW reload or other weird issues after unblock, + eg. SM2 starts but strange errors, no whileplaying() etc. + */ + position:absolute; +} + +#sm2-container object, +#sm2-container embed, +#sm2-container.swf_timedout, +#sm2-container.swf_timedout object, +#sm2-container.swf_timedout embed { + /* + when SM2 didn't start normally, time-out case. flash blocked, missing SWF, no flash? + 48px square flash placeholder is typically used by blockers. + */ + left:auto; + top:auto; + width:48px; + height:48px; +} + +#sm2-container.swf_unblocked { + /* SWF unblocked, or was never blocked to begin with; try to collapse container as much as possible. */ + width:1px; + height:1px; +} + +#sm2-container.swf_unblocked object, +#sm2-container.swf_unblocked embed { + /* hide flash off-screen (relative to container) when it has loaded OK */ + left:-9999em; + top:-9999em; +} + +#sm2-container.swf_error { + /* when there is a fatal error (flash loaded, but SM2 failed) */ + display:none; +} + +#sm2-container.high_performance { + /* "high performance" case: keep on-screen at all times */ + position:absolute; + position:fixed; + _top:-9999px; /* IE 6 hax, no position:fixed */ + _left:-9999px; + bottom:0px; + left:0px; + /* + special case: show at first with w/h, hide when unblocked. + might be bad/annoying. + */ + width:48px; + height:48px; + z-index:99; /* try to stay on top */ +} + +#sm2-container.high_performance.swf_unblocked { + z-index:auto; +} + +#sm2-container.high_performance.swf_unblocked, +#sm2-container.high_performance.swf_unblocked object, +#sm2-container.high_performance.swf_unblocked embed { + /* 8x8px is required minimum to load in fx/win32 in some cases(?), 6x6+ good for fast performance, even better when on-screen via position:fixed */ + width:8px; + height:8px; +} + +#sm2-container.high_performance.swf_unblocked object, +#sm2-container.high_performance.swf_unblocked embed { + /* high-performance case must stay on-screen */ + left:auto; + top:auto; +} + +#sm2-container.high_performance.swf_timedout { + z-index:99; /* try to stay on top */ +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/index.html new file mode 100755 index 0000000..796308e --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/index.html @@ -0,0 +1,125 @@ + + + +SoundManager 2: Flash Block handling examples + + + + + + + + + + + + + + + + +
    + +

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

    + +

    Show SWF inline, wait indefinitely for load (click-to-run or whitelist)

    + +

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

    + +

    Where (and when) to show the SWF

    + +

    To handle potential flash block cases, put <div id="sm2-container"></div> in your markup where you'd like the SWF to appear in those cases. If not specified, SM2 will create and append the #sm2-container node to the document when it starts.

    + +

    When soundManager.useFlashBlock is true, SM2 will not apply styles (eg. style.position.left) directly to the flash; rather, it will assign CSS classes and you can handle it as you choose. Take a look at the related CSS file you will also need if you turn this feature on.

    + +

    Handling failed start-up cases

    + +

    In the blocked/failed start-up case, #sm2-container will have a class name of swf_timedout applied to it.

    + +

    SM2 will start its init process, and will fire onready(), onload() and onerror() handlers accordingly. Keep in mind that while onerror() may fire at first, it may be preceded by a successful onload() if the user first loads the page and then later unblocks the flash movie.

    + +

    Note that flash blockers may not run when viewing offline (via file://) content, so try viewing this demo online. For FlashBlock (under Firefox), you can also go to about:config using your address bar and change the value of flashblock.blockLocal to test while offline.

    + +

    Flash Block Example

    + +

    Here, Flash is appended by SM2 to the #sm2-container DIV and after a failed start attempt (if you have a blocker active), will have a swf_timedout class appended.

    + +

    The SWF uses position:absolute and negative left/top values so as not to affect the normal page layout, but shifts to left:auto;top:auto (effectively left/top:0) in the blocked case, and becomes visible to the user. On a successful unblock, the movie goes back to left/top:-9999em and is hidden from view.

    + +

    SoundManager 2 load status: Loading...

    + + + +
    + +
    + +

    Flash Block-related CSS

    + +

    When soundManager.useFlashBlock is enabled, CSS is applied to #sm2-container depending on the progress of SM2's start-up.

    +

    This page + demos use the rules below, fully-defined and commented in flashblock.css. Use it as a base for your own SM2 + flash block implementations.

    + +
    #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 */
    +}
    + +

    Basic Demo

    + +

    For a more minimal example, see the basic flashblock demo.

    + +
    diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.css new file mode 100755 index 0000000..d8a9e69 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.css @@ -0,0 +1,61 @@ +#sm2-container { + /* where the SM2 flash movie goes. */ + position:relative; +} + +#sm2-container, +#sm2-container embed, +#sm2-container.swf_timedout { + /* 48px square flash placeholder is typically used by blockers */ + width:48px; + height:48px; +} + +#sm2-container.swf_timedout { + /* likely a flash block situation. Maybe make it more bold, red, show descriptive nested elements? */ + border:1px solid red; +} + +#sm2-container object, +#sm2-container embed { + /* hide flash off-screen by default */ + position:absolute; + left:-9999em; + top:-9999em; +} + +#sm2-container.swf_timedout object, +#sm2-container.swf_timedout embed { + /* when blocked, make visible inside container */ + left:auto; + top:auto; +} + +#sm2-container object, +#sm2-container embed { + /* 6x6 is small enough to be "invisible" and not blocked by click2flash if allowed, also enough to be really fast/performant on-screen */ + width:48px; + height:48px; +} + +#sm2-container.swf_unblocked, +#sm2-container.swf_unblocked object, +#sm2-container.swf_unblocked embed { + width:6px; + height:6px; +} + +#sm2-container.high_performance { + position:absolute; + position:fixed; + _top:0px; /* IE 6 hax */ + bottom:0px; + left:0px; +} + +#sm2-container.high_performance object, +#sm2-container.high_performance embed { + position:absolute; + left:0px; + top:0px; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.js new file mode 100755 index 0000000..f96cf46 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/flashblock.js @@ -0,0 +1,90 @@ +/* + + FlashBlock handler for SoundManager 2 + ------------------------------------------------------------------- + Attempt to handle and gracefully recover from flashblock conditions + Requires SoundManger v2.95a.20090717+ + + http://schillmania.com/projects/soundmanager2/ + +*/ +soundManager._flashBlock = new function() { + + var _s = this; + this.name = 'soundManager._flashblock'; + this.didTimeout = false; // did initial attempt fail? + this.timer = null; // for setTimeout call + + this.startTimer = function(nMsec) { + // soundManager._wD(_s.name+'_.starttimer()'); + _s.timer = window.setTimeout(_s.checkFlashStatus,nMsec); + }; + + this.stopTimer = function() { + // soundManager._wD(_s.name+'.stoptimer()'); + if (_s.timer) { + window.clearTimeout(_s.timer); + _s.timer = null; + } + }; + + this.checkFlashStatus = function() { + // soundManager._wD(_s.name+'.checkflashstatus()'); + var _sm = soundManager; + var oMC = _sm.oMC; // DIV (default: #sm2-container) for .SWF + var oStatus = document.getElementById('sm2-status'); // demo-only + + if (!_sm.supported()) { + // make the movie more visible, so user can fix + oMC.className = 'swf-timedout'; + _s.didTimeout = true; + var msg = 'No flash response, applying .swf-timedout CSS..'; + _sm._wD(_s.name+': '+msg); + if (oStatus) { + oStatus.innerHTML = ''+msg+''; + } + } else { + // SM2 loaded OK + // move the movie container to its proper place + oMC.className = 'swf-loaded'; + if (!_s.didTimeout) { + // SM2 didn't previously fail, no blocker active + var msg = 'SM2 loaded OK (before timeout), fast unblock or no blocker.'; + _sm._writeDebug(_s.name+'.checkFlashStatus: '+msg,1); + if (oStatus) { + oStatus.innerHTML = ''+msg+''; + } + } else { + var msg = 'SM2 recovered after block (or timeout), loaded OK.'; + _sm._wD(_s.name+': '+msg); + if (oStatus) { + oStatus.innerHTML = ''+msg+''; + } + } + // stop timer, if applicable + _s.stopTimer(); + return false; + } + }; + + soundManager.flashLoadTimeout = 0; // wait forever for flash to load - we'll set our own timeout via oninitmovie() + + soundManager.oninitmovie = function() { + // when SWF is written (or ready to start), wait and make SWF visible (time-out case) + soundManager._flashBlock.startTimer(750); + }; + + soundManager.onready(function(oStatus) { + // SM2 has now initialized, either no blocking OR blocked movie was allowed/whitelisted + var fb = soundManager._flashBlock; + if (oStatus.success) { + // Yay! recovered OK. + fb.checkFlashStatus(); + } else { + // Blocking was passed (or no blocking), but then something *else* went wrong. + } + // stop timer, if applicable + fb.stopTimer(); + }); + +}(); diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/index.html new file mode 100755 index 0000000..c8acee7 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/flashblock/method1/index.html @@ -0,0 +1,79 @@ + + + +SoundManager 2: Flash blocker handling examples + + + + + + + + + + + + + + + + +
    + +

    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 potential flash block cases, a flash container DIV with an ID of "sm2-container" is placed in the HTML. SM2 will find and append the flash movie to this element. In this case, the SWF can be targeted with CSS and is not positioned off-screen as it normally would be.

    +

    SM2 will start its init process, and will fire onready(), onload() and onerror() handlers accordingly. Keep in mind that while onerror() may fire at first, it may be preceded by a successful onload() if the user first loads the page and then later unblocks the flash movie.

    +

    Note that flash blockers may not run when viewing offline (via file://) content, so try viewing this demo online. For FlashBlock (under Firefox), you can also adjust flashblock.blockLocal under about:config in the address bar to test while offline.

    + +

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

    +
    #sm2-container.movieContainer {/* Initial state: position:absolute/off-screen, or inline/relative */}
    +#sm2-container.swf_timedout {/* Didn't load before time-out, show to user: On-screen, red border, etc..? */}
    +#sm2-container.swf_unblocked {/* Applied if a timeout followed by an unblock (flash started.) Move off-screen. */}
    +#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 */}
    +#sm2-container.swf_error {/* Additional modifier, "something really broke" (fatal: security, missing SWF etc.) */}
    + +

    SoundManager 2 load status: Loading...

    + +

    Take a look at flashblock.css for implementation details.

    + +
    + +
    + +
    diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/index.css b/docs/dymaxion/soundmanagerv297a-20101010/demo/index.css new file mode 100755 index 0000000..b2493a6 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/index.css @@ -0,0 +1,1715 @@ +body { + background:#fff; + margin:0px; + padding:0px; + font:75% "helvetica neue",helvetica,arial,verdana,tahoma,"sans serif"; +} + +h1, +h2.special { + letter-spacing:-0.025em; +} + +h1, h2, h3, h4 { + font-size:1em; + margin:0px; + padding:0px; + vertical-align:middle; +} + +h4.new, +h4.recent, +h4.flash9 { + min-height:24px; +} + +h1 { + font-size:2em; +} + +h2 { + font-family:helvetica,arial,verdana,tahoma,"sans serif"; + font-size:1.5em; +} + +h3 { + font-size:1.17em; + border-bottom:1px solid #ccc; + padding-bottom:0.25em; + margin-top:1.5em; +} + +h4 { + margin:1.5em 0px 0.5em 0px; + font-size:1.15em; +} + +h5 { + font-size:1em; + color:#666; +} + +.c2 h5 { + border-bottom:1px solid #ccc; + padding-bottom:0.25em; +} + +body.home h4 { + border-bottom: 1px solid #e9e9e9; + padding-bottom: 0.33em; + margin-bottom: 0.75em; +} + +em em { + /* special highlight */ + color:#003366; + background:#e9f3ff; + font-weight:bold; + margin-top:-0.3em; + padding:0.2em 0.25em; +} + +pre { + border-left:2px solid #f3f3f3; + padding-left:0.5em; +} + +dl pre { + border-color:#e9f3ff; + margin-left:-0.5em; +} + +dl.alt pre { + border-color:#f3f3f3; +} + +pre, +code, +pre code, +.code, +dt, +#soundmanager-debug { + font-family:monaco,"Andale Mono","VT-100","Lucida Console","Courier New",monospace,courier,system,sans-serif; +} + +pre, +code, +.code, +dt, +#soundmanager-debug { + font-size:11px; + font-weight:normal; + line-height:1.5em; + color:#006699; + background:#f6fcff; +} + +pre { + font-size:11px; /* x-small */ + line-height:1.75em; +} + +pre.specialcommentblock span span { + *line-height:1.75em; +} + +pre span span { + /* font-size:x-small; */ +} + +pre.small { + font-size:90%; +} + +p pre, +p.in pre { + font-size:0.97em; +} + +#soundmanager-debug { + background:#fff; + padding-left:0.75em; + border:2px solid #ddeeff; + font-size:11px; + line-height:1.7em; +} + +body.home #soundmanager-debug { + position:fixed; + _position:absolute; /* IE <7 */ + bottom:1em; + right:1em; + height:12em; + width:auto; + overflow:auto; + padding:0px; + margin:1em 6px 6px 1em; + opacity:0.95; + color:#333; + border:1px solid #ccddee; + -moz-border-radius:3px; + -khtml-border-radius:3px; + -webkit-border-radius:3px; + background:#f3f9ff; + z-index:10; + font-size:small; + line-height:1.2em; +} + +body.home #soundmanager-debug div { + padding-left:0.5em; +} + +#soundmanager-debug div { + margin:0px; + padding:0.25em 0px; + font-size:11px; + color:#333; +} + +#soundmanager-debug div.sm2-alt { + background-color:#fff; + color:#556677; +} + +#live-debug { + display:table; + *display:block; +} + +#live-debug #soundmanager-debug .sm2-alt { + background-color:#f3f9ff; + color:#336699; +} + +dd pre, +dd code { + background:transparent; +/* + font-size:1.15em; + *font-size:1em; +*/ +} + +pre code { + font-size:1em; +} + +pre { + white-space:-moz-pre-wrap; + white-space:pre-wrap; + word-wrap:break-word; /* IE */ +} + +pre span, +code span, +dt span { + color:#339933; +} + +pre span span, +code span span, +dt span span { + color:#667788; +} + +pre.block, +pre.block code, +div.block div.code { + position:relative; + display:table; + *display:block; + border:1px solid #ccc; + -moz-border-radius:3px; + -khtml-border-radius:3px; + -webkit-border-radius:3px; +} + +div.block, +pre.block { + background:#e9f3ff; + border-color:#eee; + padding:3px; +} + +pre.block code, +div.block div.code { + background:#fff; + border:1px solid #ccddee; + padding:0.5em; + font-size:11px; + line-height:1.75em; +} + +dl { + background:#f9fcff; + padding-bottom:1px; +} + +dd { + margin:1em 0px; + padding:0px 0.5em; + line-height:1.5em; +} + +dt { + margin:0px; + padding:0px; + margin:0.5em 0px 1em 0px; + border-bottom:1px solid #ddeeff; + padding:0.3em 0.3em 0.4em 0.3em; + padding-top:0.5em; + text-indent:0.25em; + background:#eef6ff; + font-size:1.15em; +} + +dt.alt { + background:#f3f3f3; + border-bottom-color:#e6e6e6; +} + +dl.alt { + background:#fcfcfc; + padding:0px 0px 1px 0px; +} + +h2 { + padding-top:0.5em; +} + +#top { + position:relative; + padding:1em 1em 0px 1em; + background:#222; + color:#fff; + z-index:1; +} + +#top, +#top div { + *zoom:1; +} + +#top h1 { + /* special christmas light case */ + display:inline; +} + +#top h2 { + /* tagline */ + font-size:1.25em; + font-weight:lighter; + padding-top:2px; + letter-spacing:-1px; +} + +#main { + position:relative; + padding:0px 0px 2em 0px; + padding-top:1px; + margin:0px auto; + max-width:110em; + *padding:0px 1em 2em 1em; + zoom:1; +} + +.columnar { + position:relative; + margin:0px; + padding:0px; + margin:2em 0.5em 0.5em 0.5em; +} + +.columnar .c1 { + position:absolute; + left:0px; + top:0px; + width:20em; + height:30px; + _position:relative; /* IE 6 hackery */ + _height:auto; +} + +#doc .columnar .c1 { + left:auto; + right:1em; + _right:auto; +} + +.columnar .c1 h2 { + position:relative; + font-size:1.2em; + padding:0.46em 0.5em; + vertical-align:middle; + background:#333; + color:#fff; +} + +.columnar .c1 p { + margin:0.5em 0px 1em 0px; + padding-left:0.5em; + padding-right:0.5em; + font-size:0.95em; + line-height:1.35em; + color:#666; +} + +.columnar .c1 p code { + font-size:xx-small; + color:#336699; +} + +.columnar .c2 { + position:relative; + margin-top:2.33em; + margin-top:1px; + border-top:0.25em solid #333; + margin-left:22em; + margin-bottom:1.5em; +} + +.triple .columnar .c2 { + margin-right:21.25em; + min-width:20em; +} + +#doc .triple .columnar .c2 { + margin-left:21.5em; + margin-right:23em; + _margin-right:0px; /* not you, IE 6. */ +} + +#doc .triple .columnar .c1 { + margin-right:0px; + margin-left:21.25em; +} + +.columnar .c2 p:first-child { + margin-top:0.2em; +} + +.columnar .c2 h3:first-child { + margin-top:0.2em; + padding-bottom:0.3em; +} + +.columnar .c2 > .f-block:first-child > h4 { + margin-top:0.5em; +} + +.columnar .c2 strong strong { + display:block; + padding:0.5em; + border-bottom:1px solid #999; + background:#f0f6ff; + color:#336699; +} + +.columnar .c2 p { + line-height:1.5em; +} + +.three .columnar { + position:relative; +} + +.three .columnar .c1 { + position:relative; + width:20em; +} + +.three .columnar .c2 { + position:relative; + margin-right:16em; +} + +.c3 { + position:absolute; + right:1em; + margin-right:16px; + top:2em; + width:16em; + margin-top:-0.5em; +} + +#doc .c3 { + right:auto; + margin-right:0px; + margin-left:16px; + left:1.25em; +} + +#nav { + position:relative; + margin-top:0.75em; + margin-left:-0.5em; +} + +ul { + line-height:1.5em; +} + +#nav ul { + margin:0px; + padding:0px; + line-height:1em; + list-style-type:none; +} + +#nav>ul { +/* + border-top:1px solid #333; +*/ +} + +#nav ul li { + position:relative; + margin:0px; + padding:0px; + float:left; + display:inline; + padding-right:1px; +} + +#nav ul li ul { + position:absolute; + z-index:1; + display:none; + min-width:17em; + max-width:20em; + background:#3399cc; + opacity:0.95; + _width:17em; + *opacity:1; + *top:1.5em; + *left:0px; +} + +#nav ul li:last-child ul { + right:1px; +} + + +#nav ul li:hover ul, +#nav ul li ul:hover { + display:block; +} + +#nav ul li ul li { + float:none; + display:block; + width:100%; +} + +#nav ul li ul li a { + display:block; + width:auto; + border:none; + padding:0.4em; + padding-left:1em; + color:#fff; +} + +#nav ul li a { + display:inline-block; + padding:0.3em 0.5em; + padding-left:0.75em; + padding-right:0.75em; + text-decoration:none; + font-weight:bold; + color:#ccc; +} + +#nav ul li strong a { + background:#336699; + background:#; + background:#fff; + color:#333; +} + +#nav ul li strong a:hover, +#nav ul li a:hover, +#nav ul>li:hover strong a, +#nav ul>li:hover>a { + background:#3399cc; + color:#fff; +} + +#nav ul li ul li a:hover { + background:#336699; +} + +#version { + position:relative; + float:right; + display:inline; + margin-left:1em; + font-size:x-small; + margin-bottom:0px; + margin-top:0.25em; + color:#999; +} + +div.clear { + clear:both; + font-size:1px; + line-height:1px; +} + +.note { + margin-top:0.5em; + font-size:0.95em; + color:#999; +} + +.note a { + color:#666; + padding:1px; + margin:-1px; +} + +.note a:hover { + color:#fff; + background:#666; +} + +ul.standard { + line-height:1.5em; + padding-left:1.2em; + *padding-left:0px; + color:#333; + margin-top:0.5em; + margin-bottom:0.5em; + list-style-type:square; +} + +ul.standard li { + margin-bottom:0.5em; +} + +ul.standard ul { + margin-top:0.5em; + margin-bottom:1em; + padding-left:1.2em; +} + +.c3 { + background:#fcfcfc; +} + +.c3 ul { + list-style-type:none; +} + +.c3 ul, +.c3 ul li { + margin:0px; + padding:0px; +} + +.c3 h2 { + font-size:1.1em; + text-indent:0.4em; +} + +.c3 ul li a { + text-decoration:none; + color:#000; +} + +.c3 ul li a:hover { + color:#000; + _color:#000; +} + +.c3 ul li a:focus { + color:#000; + outline:none; +} + +.c3 ul li.active a { + color:#fff; +} + +.c3 ul li.active a:hover { + _color:#fff; +} + +.c3 .box { + margin-top:6px; +} + +.wedge, +.c3 h2 { + position:relative; + background:#333; + color:#fff; + margin:0px; + padding:0px; + height:2.101em; + line-height:1.65em; +} + +.c3 h2 { + height:1.75em; + line-height:1.75em; +} + +.wedge { + background-color:#3399cc; +} + +.wedge-dark { + background:#333; +} + +.wedge .l, +.wedge .r { + border-top:1.75em solid #333; +} + +.c3 h2 .l, +.c3 h2 .r { + border-top:1.66em solid #333; +} + +.wedge .l, +.c3 h2 .l { + background:transparent url(../demo/_image/wedge.png) no-repeat -64px 0px; + position:absolute; + left:0px; + top:0px; + width:16px; + height:100%; + margin-left:-16px; + border-top:1.7em solid #333; +} + +.wedge .r, +.wedge-dark .r, +.c3 h2 .r { + background:transparent url(../demo/_image/wedge.png) no-repeat -48px 0px; + position:absolute; + right:0px; + top:0px; + width:16px; + height:100%; + margin-right:-16px; +} + +.wedge .l, +.wedge .r { + border-color:#3399cc; +} + +.wedge .l { + background-position:-64px -64px; +} + +.wedge .r { + margin-top:-16px; + border-top:none; + height:16px; + border-bottom:1.7em solid #3399cc; + background-position:0px -192px; +} + +.wedge-dark .l, +.wedge-dark .r { + border-color:#333; +} + +.wedge-dark .l { + background-position:-64px 0px; +} + +.wedge-dark .r { + background-position:0px -128px; +} + +.c3 h2 .r.up { + margin-top:-16px; + border-top:none; + height:16px; + border-bottom:1.66em solid #333; + background-position:0px -128px; +} + +.c3 h2 .l.flat, +.wedge .l.flat, +.c3 h2 .r.flat, +.wedge .r.flat { + background-image:none; +} + +.c3 ul { + margin:0px; + padding:0px; + margin-top:0.125em; + margin-bottom:0.25em; + list-style-type:none; +} + +.c3 ul li { + border:1px solid #f3f3f3; + border-top:none; + border-bottom:none; +} + +.c3 ul ul li { + border:none; +} + +.c3 ul li { + margin:0px; + padding:0px; +} + +.c3 ul li ul li { + font-family:monaco,"Andale Mono","VT-100","Lucida Console","Courier New",monospace,courier,system,sans-serif; + font-size:11px; + line-height:1.5em; + text-indent:0.5em; + padding:0.25em 0.25em 0.25em 0.25em; + cursor:hand; +/* + font-smooth:never; +*/ +} + +.c3 ul li ul li.alt { + background-color:#f8f8f8; +} + +.c3 ul li ul li:hover { + background-color:#ccddff; + cursor:pointer; + cursor:hand; +} + +.c3 ul li ul li.active { + background-color:#3399cc; + color:#fff; +} + +.c3 h3 { + margin:0px; + padding:0px; + background:#3399cc; + border:none; + color:#fff; + font-size:1.3em; + text-indent:0.5em; + font-size:1em; + height:1.67em; + padding:0.25em 0.5em; + padding:0px; + +} + +.c3 h4 { + font-size:1em; + margin:1em 0.25em 0.25em 0.25em; + padding:0px 0.25em; + padding:0.2em 0.2em 0.2em 0.5em; + vertical-align:middle; + margin:0px; + color:#333; + background:#eef6ff; + border-top:1px solid #fff; + border-bottom:1px solid #ddeeff; +} + +#get-satisfaction h2 a { + color:#fff; +} + +#get-satisfaction a { + color:#333; +} + +#get-satisfaction a:hover { + color:#fff; +} + +.c3 h2 a { + color:#fff; +} + +.c3 h2 a:hover { + color:#fff; + text-decoration:underline; +} + +.flash9 { + background-image:url(../demo/_image/flash9.png); + background-repeat:no-repeat; + background-position:bottom right; + _background-image:none; +} + +li.flash9 { + background-position:bottom right; +} + +.flash9.active { + background-image:url(../demo/_image/flash9-dark.png); + _background-image:none; +} + +.new { + background-image:url(../demo/_image/new.png); + background-repeat:no-repeat; + background-position:bottom right; + _background-image:none; +} + +.recent { + background-image:url(../demo/_image/new-bw.png); + background-repeat:no-repeat; + background-position:bottom right; + _background-image:none; +} + +.new.active, +.recent.active { + background-image:url(../demo/_image/new-dark.png); + _background-image:none; +} + +li.new { + background-position:top right; +} + +span.nevermind, +.removed { + text-decoration:line-through; + opacity:0.75; +} + +.padded { + padding:0.5em; +} + +.c3 p { + font-size:0.9em; + padding-left:0.5em; + padding-right:0.5em; +} + +.c1 pre code { + margin-top:0px; + font-size:xx-small; + color:#336699; + margin-left:0px; +} + +.c1 pre { + margin-top:0px; + padding-top:0px; + margin-left:0.5em; +} + +#reset-filter { + position:relative; + font-family:"Helvetica Neue Light","Helvetica Neue","Helvetica",helvetica,arial,verdana,sans-serif; + font-weight:lighter; + font-size:2.5em; + letter-spacing:-1px; +} + +.c2 .option { + font-size:small; + float:right; + display:inline; + margin-left:1em; + margin-right:0.5em; + margin-top:3px; + line-height:1em; + white-space:nowrap; +} + +.c2 .option a { + padding:0.1em 0.35em 0.1em 0.35em; + color:#3399cc; +} + +/* +.c2 .option a:hover { + background-color:#3399cc; + color:#fff; +} +*/ + +#filter-box { + position:relative; + display:none; +} + +#get-satisfaction { + position:relative; +} + +#gsfn_content { + padding:0.5em 0px 0px 0px; +} + +#gsfn_content ul { + margin-bottom:0.5em; +} + +#gsfn_content ul li { + border:none; +} + +div#gsfn_list_widget img { + border: none; +} + +div#gsfn_list_widget a { + text-decoration:none; +} + +div#gsfn_list_widget a.widget_title { + display: block; + margin-bottom: 10px; + font-weight: bold; +} + +div#gsfn_list_widget .powered_by { + font-family:verdana,arial; + margin:0px 1em 0px 1em; + padding:0.25em 0px 0px 0px; + border-top: 1px solid #ccc; + font-size:xx-small; + opacity:0.5; +} + +div#gsfn_list_widget .powered_by:hover { + opacity:1; +} + +div#gsfn_list_widget .powered_by a:hover { + color:#666; +} + +div#gsfn_list_widget div#gsfn_content { + font-size:x-small; + font-size:0.9em; + padding-left:0.5em; + padding-right:0.5em; +} + +div#gsfn_list_widget div#gsfn_content li { + text-align:left; + position: relative; + clear:right; + *zoom:1; +} + +div#gsfn_list_widget div#gsfn_content li:hover, +div#gsfn_list_widget div#gsfn_content li:hover a { + background:#3399cc; + color:#fff; +} + +div#gsfn_list_widget div#gsfn_content a.gsfn_link { + display:block; + line-height:1.2em; + padding:5px 0px 5px 5px; +} + +div#gsfn_list_widget div#gsfn_content a.gsfn_link:hover { + _color:#fff; + _background-color:#3399cc; +} + +div#gsfn_list_widget div#gsfn_content span.time { + font-size: xx-small; + color:#999; + padding-left:3px; + padding-right:3px; + text-align:right; + float:right; + display:inline; + margin-top:1px; +} + +div#gsfn_list_widget div#gsfn_content li:hover span.time { + color:#fff; +} + +div#gsfn_list_widget div#gsfn_content p.gsfn_summary { + margin-top: 2px; + position:relative; + z-index:2; +} + +.tight { + margin-top:0px; +} + +.compact { + margin-bottom:0.25em; +} + +.c2 a, +a.cta { + margin-top:-0.3em; + padding:0.2em 0.25em; + text-decoration:none; + color:#3399cc; + -khtml-border-radius:0.25em; + -moz-border-radius:0.25em; + border-radius:0.25em; + zoom:1; +} + +/* redefine for simple mp3 button demo */ +.c2 a.sm2_button { + -moz-border-radius:6px; + -webkit-border-radius:6px; + -o-border-radius:6px; + border-radius:6px; +} + +.c2 a.sm2_button.type-2 { + -moz-border-radius:9px; + -webkit-border-radius:9px; + -o-border-radius:9px; + border-radius:9px; +} + + +.c2 a { + margin-left:-0.2em; + margin-right:-0.2em; + color:#3399cc; + font-weight:bold; + text-decoration:none; +} + +.c2 a.cta { + text-decoration:none; +} + +a.cta span { + font-size:1.5em; + line-height:1em; +} + +a.cta:hover, +.c2 a:hover { + background-color:#3399cc; + border-color:#3399cc; + color:#fff; + text-decoration:none; +} + +.c2 a.sm2_button:hover { + /* arg. not specific enough, redefine here. */ + background-color:#cc3333; +} + +a.cta-more { + color:#ddeeff; + font-size:0.8em; + position:absolute; + right:0px; + margin:0px; + padding:1px; + bottom:0.9em; + line-height:1em; +} + +a.cta-more:hover { + background:#fff; + color:#3399cc; +} + +li.html5support span { + padding:0px 5px; + display:inline-block; + text-align:center; + font-weight:bold; + background:#ccc; + color:#fff; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; + margin-left:0.5em; + margin-bottom:0.25em; +} + +li.html5support em { + font-weight:bold; +} + +li.html5support span.true { + background:#669966; +} + +li.html5support span.partial { + background:#993333; +} + +li.html5support em.partial { + color:#993333; +} + +li.html5support em.true { + color:#669966; +} + +#nav ul li ul { + /* eh, why not. */ + -moz-box-shadow:2px 2px 2px rgba(51,153,204,0.2); + -khtml-box-shadow:2px 2px 2px rgba(51,153,204,0.2); + -webkit-box-shadow:2px 2px 2px rgba(51,153,204,0.2); + box-shadow:2px 2px 2px rgba(51,153,204,0.2); +} + +.newer { + vertical-align:middle; +} + +.newer a, +a.feature, +.c2 .feature-hot { + display:block; + background:#3399ff; + padding:0.3em 0.5em; + margin:-0.3em 0px 0px -0.5em; + color:#fff; + font-weight:bold; + border:3px solid #ccc; + border:3px solid rgba(255,255,255,0.66); + -moz-border-radius:8px; + -webkit-border-radius:8px; + border-radius:8px; + line-height:1em; + text-decoration:none; + font-size:small; + vertical-align:middle; +} + +a.feature { + display:inline; + margin-left:0px; +} + +.newer a, +.c2 .feature-hot { + background:#ff0000; + border-color:#ff6666; + color:#fff; + line-height:1em; +} + +.newer a:hover, +.c2 .feature-hot:hover { + background:#990000; + border-color:#cc0000; +} + +a.feature:focus, +a.feature:hover { + background:#ff0000; + border-color:#ff6666; + color:#fff; +} + +.newer p { + margin:0px; + padding:0px; +} + +h4 .scratched-out { + text-decoration:line-through; + color:#999; + /* + font-size:xx-small; + */ + font-size:0.9em; + margin-top:-0.75em; + -webkit-transform:rotate(-15deg); + -moz-transform:rotate(-15deg); +} + +.inthewild { + margin-top:1em; +} + +.inthewild a, +.inthewild a img { + border:none; +} + +.inthewild a { + margin-right:1em; +} + +.inthewild a:last-child { + margin-right:0px; +} + +.inthewild a, +.inthewild a img { + vertical-align:middle; +} + +.inthewild a { + display:inline-block; + display:-moz-inline-box; + overflow:hidden; + margin:1em 1em 0.5em 1em; + padding:0px; +} + +.inthewild a:first-child { + margin-left:0.5em; +} + +.inthewild a span { + position:absolute; + text-indent:-9999em; +} + +#favtape:hover { + background:#ff0066; + border-color:#ff0066; + color:#fff; +} + +#soundcloud { + width:83px; + height:58px; + background:transparent url(../demo/_image/soundcloud-thecloudplayer-logo.png) no-repeat 0px -59px; + margin-right:3px; +} + +#soundcloud:hover { + background-position:0px 0px; +} + +#lastfm { + width:80px; + height:28px; + background:transparent url(../demo/_image/lastfm.png) no-repeat 0px -28px; +} + +#lastfm:hover { + background-position:0px 0px; +} + +#mixcrate { + width:80px; + height:16px; + background:transparent url(../demo/_image/mixcrate.png) no-repeat 0px 0px; +} + +#mixcrate:hover { + background-position:0px -16px; +} + +#opera { + width:79px; + height:32px; + background:transparent url(../demo/_image/opera.png) no-repeat 0px 0px; +} + +#opera:hover { + background-position:0px -32px; +} + +/* homepage-specific demo shiz */ + +.sidenote { + font-size:x-small; + opacity:0.75; +} + +ul.playlist { + font-size:xx-small; +} + +ul.playlist li a { + font-size:1em; +} + +ul.playlist li a, +ul.playlist li a:hover { + background:transparent; + -khtml-border-radius:0px; + -moz-border-radius:0px; + border-radius:0px; + line-height:1em; +} + +ul.playlist li .timing { + top:0.6em; + font-size:xx-small; +} + +ul.playlist.use-peak li .peak { + /* overrides */ + height:0.61em; + margin-top:-5px; + width:0.92em; +} + +html.isSafari ul.playlist.use-peak li .peak { + margin-top:-4px; /* dumb tweak */ +} + +ul.playlist.use-peak li .timing { + right:4em; +} + +ul.playlist.use-peak li .peak-box { + height:0.66em; +} + +ul.playlist li .peak .l { + margin-right:0px; +} + +ul.playlist li .peak .l, +ul.playlist li .peak .r { + width:6px; +} + +ul.playlist li .peak .r { + left:9px; +} + +ul.playlist li a.not-supported { + /* give user a hint that the format doesn't work */ + text-decoration:line-through; + color:#666; + opacity:0.5; +} + +ul.graphic li { + line-height:1.5em; +} + +ul.graphic li a, +ul.graphic li a.sm2_link { + min-width:17.75em; + width:auto; +} + +ul.graphic li a, +ul.graphic li a.sm2_link { + background-color:#ddd; + border-color:#ddd; + color:#333; + vertical-align:middle; +} + +ul.graphic li a { + background:#ddd url(../demo/play-mp3-links/image/icon_play.png) no-repeat 3px 50%; + _background-image:url(../demo/play-mp3-links/image/icon_play.gif); +} + + +ul.graphic li a:hover, +ul.graphic li a.sm2_paused:hover, +ul.graphic li a.sm2_link:hover, +ul.graphic li a.sm2_playing, +ul.graphic li a.sm2_playing:hover { + background-color:#336699; + border-color:#336699; + color:#fff; +} + +ul.graphic li a.sm2_link { + /* Doesn't work on this page. */ + -webkit-transition-property: none; + -webkit-transition: none; +} + +.c2 ul.playlist li a { + margin:0px; + padding:0px; + letter-spacing: -0.02em; +} + +/* Flash positioning and flashblock / clicktoflash handling */ + +/* special-case for the SM2 homepage only */ + +body.home #sm2-container { + position:absolute; + width:48px; + height:48px; + margin:1px 0px 0px 1px; +} + +body.home #sm2-container.high_performance { + bottom:auto; + left:auto; + top:auto; +} + +body.home #sm2-container.swf_timedout { + border:1px solid #ff3333; + border-bottom:none; + margin:0px; + z-index:2; +} + +body.home #sm2-container.swf_unblocked { + width:1px; + height:1px; +} + +#sm2-support { + display:none; + font-size:1em; + border:1px solid #ff3333; + background:#fff6f0; + margin-top:48px; +} + +#demo-box { + position:relative; + float:right; + display:inline; + background: #fff; /* hide borders behind this box */ + padding-left:32px; + padding-right:16px; + margin-top:-1em; + width:21.25em; + /* hide from IE 6 */ + _position:absolute; + _left:-9999em; + _top:-9999em; +} + +#demo-box #without-html5 { + display:none; +} + +#demo-box #with-debug, +#demo-box #without-html5, +#demo-box #without-html5 a { + display:inline; + margin-top:-0.75em; + font-weight:normal; + font-size:x-small; + text-decoration:none; + font-weight:normal; + color:#666; +} + +#demo-box #with-debug { + margin-right:1.5em; +} + +#demo-box #without-html5 a:hover, +#demo-box #with-debug:hover { + color:#fff; +} + +#demo-box a.feature-hot { + display:inline; +} + +hr { + visibility:hidden; + margin:0px; + padding:0px; +} + +.demo-block { + position:relative; + background:#f9f9f9; + border:1px solid #e6e6e6; + padding:4px; + padding-top:0.5em; + margin-top:-0.55em; + border-top:none; +} + +#demo-header { + color:#333; + background:#f9f9f9; + border:1px solid #e6e6e6; + border-bottom:0px; + margin-bottom:0px; + padding:0.5em; +} + +#demos h3 { + padding-bottom:0px; + text-indent:0.5em; + font-weight:normal; +} + +#demos h3 a { + font-weight:normal; +} + +#revision-list > li { + margin-bottom:2em; +} + +/* seasonal decorations */ + +#lights { + position:absolute; + border-top:1px solid #006600; + left:0px; + top:0px; + width:100%; + height:100%; + overflow:hidden; + display:none; +} + +.xlsf-light { + position:absolute; + margin-top:-1px; +} + +body.fast .xlsf-light { + opacity:0.9; +} + +.xlsf-light { + opacity:0.9; +} + +.xlsf-fragment { + position:absolute; + background:transparent url(christmas-lights/image/bulbs-50x50-fragments.png) no-repeat 0px 0px; + width:50px; + height:50px; +} + +.xlsf-fragment-box { + position:absolute; + left:0px; + top:0px; + width:50px; + height:50px; + *width:100%; + *height:100%; + display:none; +} + +.xlsf-cover { + position:fixed; + left:0px; + top:0px; + width:100%; + height:100%; + background:#fff; + opacity:1; + z-index:999; + display:none; +} + +.figure { + display:inline; + display:inline-block; + border:1px solid #ddeeff; + padding:0.5em; + margin:0.5em 0px 0.5em 0px; +} + +.figure .code { +} + +.figure .code span { + padding:0.25em; + border:1px solid #f0f9ff; + background:#fff; +} + +.figure .code span.mid { + color:#666; +} + +#sm2-container.flash_debug { + /* flash movie, when soundManager.debugFlash = true */ + position:relative; + width:auto; + height:300px; + width:100%; + background:#f6f6f6; + border:1px solid #ccc; +} + +#sm2-container.flash_debug object, +#sm2-container.flash_debug embed { + width:100%; + height:100%; + left:auto; + top:auto; +} + +ul.file-structure ul { + padding-left:1.5em; +} + +ul.file-structure li { + list-style-type:square; + margin-top:0.25em; + margin-left:0px; +} + +ul.file-structure li span { + color:#999; +} + +#sm2-filesizes { + border:1px solid #ddd; +} + +#sm2-filesizes tr:nth-child(2n+1) { + background:#f9f9f9; +} + +#sm2-filesizes th { + background:#eee; + font-weight:bold; + text-align:left; +} + +#sm2-filesizes th { + padding:4px 6px; +} + +#sm2-filesizes td { + padding:0px 6px; + border:1px solid #eee; +} + +#sm2-filesizes p { + margin-top:0.5em; + margin-bottom:0px; +} + +#sm2-filesizes pre { + border-left:none; + margin-top:0.5em; + margin-bottom:0.5em; +} + +#sm2-filesizes .nw { + white-space:nowrap; +} + +#sm2-filesizes .booyaa { + /* in the words of Paris Hilton, "that's hot." (in the nerdy sense, I suppose.) */ + background:#fff9f9; + color:#990000; +} + +#history li.in > p.compact { + font-weight:bold; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/index.html b/docs/dymaxion/soundmanagerv297a-20101010/demo/index.html new file mode 100755 index 0000000..31133af --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/index.html @@ -0,0 +1,28 @@ + + + +MP3 player demo + + + + + + + + + + + + +
    + +

    SoundManager 2 Demos

    + +

    + SoundManager 2 project page +

    + +
    + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/demo/index.js b/docs/dymaxion/soundmanagerv297a-20101010/demo/index.js new file mode 100755 index 0000000..97140ee --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/demo/index.js @@ -0,0 +1,368 @@ +/* SoundManager 2 - project home utility JS */ + +function _id(sID) { + return document.getElementById(sID); +} + +getSoundByURL = function(sURL) { + return (typeof self.soundsByURL[sURL] != 'undefined'?self.soundsByURL[sURL]:null); +} + +function init() { + var o = document.getElementById('main'); + var el = o.getElementsByTagName('dt'); + for (var i=el.length; i--;) { + if ((i+1)%2==0) { + utils.addClass(el[i],'alt'); + } + } + var el = o.getElementsByTagName('dl'); + for (var i=el.length; i--;) { + if ((i+1)%2==0) { + utils.addClass(el[i],'alt'); + } + } +} + +function Utils() { + var self = this; + + this.hasClass = function(o,cStr) { + return (typeof(o.className)!='undefined'?new RegExp('(^|\\s)'+cStr+'(\\s|$)').test(o.className):false); + } + + this.addClass = function(o,cStr) { + if (!o || !cStr) return false; // safety net + if (self.hasClass(o,cStr)) return false; + o.className = (o.className?o.className+' ':'')+cStr; + } + + this.removeClass = function(o,cStr) { + if (!o || !cStr) return false; // safety net + if (!self.hasClass(o,cStr)) return false; + o.className = o.className.replace(new RegExp('( '+cStr+')|('+cStr+')','g'),''); + } + + this.toggleClass = function(o,cStr) { + var m = (self.hasClass(o,cStr)?self.removeClass:self.addClass); + m(o,cStr); + } + + this.getElementsByClassName = function(className,tagNames,oParent) { + var doc = (oParent||document); + var matches = []; + var i,j; + var nodes = []; + if (typeof(tagNames)!='undefined' && typeof(tagNames)!='string') { + for (i=tagNames.length; i--;) { + if (!nodes || !nodes[tagNames[i]]) { + nodes[tagNames[i]] = doc.getElementsByTagName(tagNames[i]); + } + } + } else if (tagNames) { + nodes = doc.getElementsByTagName(tagNames); + } else { + nodes = doc.all||doc.getElementsByTagName('*'); + } + if (typeof(tagNames)!='string') { + for (i=tagNames.length; i--;) { + for (j=nodes[tagNames[i]].length; j--;) { + if (self.hasClass(nodes[tagNames[i]][j],className)) { + matches[matches.length] = nodes[tagNames[i]][j]; + } + } + } + } else { + for (i=0; i'+o.innerHTML+''; + _id('search-results').style.display = 'block'; + _id('filter-box').style.display = 'block'; + if (isClear) { + _id('filter-box').style.paddingBottom = '0px'; + _id('filter-box').style.display = 'none'; + } else { + _id('filter-box').style.paddingBottom = '0px'; + if (!navigator.userAgent.match(/msie/i)) { + _id('filter-box').style.paddingBottom = Math.max(0,(document.documentElement.scrollTop || window.scrollY)-utils.getOffY(_id('filter-box'))-parseInt(_id('filter-box').offsetHeight)-20)+'px'; + } + _id('filter-box').style.display = 'block'; + // if ((!document.documentElement.scrollTop && !window.scrollY)) _id('filter-box').style.display = 'none'; + } + if (lastSelected) { + if (lastSelected == o) { + utils.toggleClass(lastSelected,'active'); + } else { + utils.removeClass(lastSelected,'active'); + utils.addClass(o,'active'); + } + } else { + utils.addClass(o,'active'); + } + lastSelected = o; + // cancel bubble, too? + return false; + } +} + +function getLiveData() { + getDynamicData(); + // reinvigorate.net is a handy (and free!) stats tracking service thingy. you should check it out. + var is_live = (document.domain && document.domain.match(/schillmania.com/i) && typeof re_ != 'undefined'); + loadScript('http://include.reinvigorate.net/re_.js'); + setTimeout(function(){ + if (typeof re_ != 'undefined') re_(is_live?'f6795-v062d0xv4u':'u8v2l-jvr8058c6n'); + },3000); +} + +function getDynamicData() { + // Attempt to fetch data from schillmania.com: "Get Satisfaction" topics, version updates etc. + loadScript('http://www.schillmania.com/services/soundmanager2/info/?version='+soundManager.versionNumber+'&rnd='+parseInt(Math.random()*1048576)); +} + +function loadScript(sURL,onLoad) { + var loadScriptHandler = function() { + var rs = this.readyState; + if (rs == 'loaded' || rs == 'complete') { + this.onreadystatechange = null; + this.onload = null; + window.setTimeout(onLoad,20); + } + } + function scriptOnload() { + this.onreadystatechange = null; + this.onload = null; + window.setTimeout(onLoad,20); + } + var oS = document.createElement('script'); + oS.type = 'text/javascript'; + if (onLoad) { + oS.onreadystatechange = loadScriptHandler; + oS.onload = scriptOnload; + } + oS.src = sURL; + document.getElementsByTagName('head')[0].appendChild(oS); +} + +function doAltShortcuts() { + var o = _id('shortcuts-list'); + if (!o) { + return false; + } + var oParents = []; + var oLIs = o.getElementsByTagName('li'); + var isIgnore = null; + var offset = 0; + for (var i=0; i
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    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:

    + +
    + +
    + +
    + +
    + + +
    + + + + +
    + + + +
    + + + +
    + +
    + + +
    + + +
    + + + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/index.html b/docs/dymaxion/soundmanagerv297a-20101010/index.html new file mode 100755 index 0000000..dd271ca --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/index.html @@ -0,0 +1,513 @@ + + + +SoundManager 2: JavaScript Sound For The Web + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + +
    + +
    +

    What SoundManager 2 does

    +

    Audio features, accessible from JavaScript.

    +
    + +
    + +

    About SoundManager 2, Features and Live Demos

    + +
    + + speaker icon + +

    SoundManager 2 makes it easier to play audio using JavaScript.

    + +

    By wrapping and extending HTML5 and Flash Audio APIs, SoundManager 2 brings reliable cross-platform audio to JavaScript. How it works »

    + +
     
    + +
    + +
    +
    +
    +

    Inline JavaScript Sound API Examples

    +
    +

    Basic MP3 ButtonsMore »

    +
    +

    + Change  coins.mp3 +   |  + Glass 1  glass0.mp3 +   |  2  glass1.mp3 +   |  3  glass2.mp3 +

    +
    +

    Playable MP3 linksMore »

    + +

    360° Player UIMore »

    +
    +
    + + +
    +
    +
    + +

    Muxtape-style UI (+HTML5 tests)More »

    + + +
     
    + +
    + + +debug + +
    + +
    + +
    + +

    HTML5 Audio Support (Beta-ish)

    +
      +
    • 100% Flash-free MP3 + MP4/AAC where supported. Works on iPad, iPhone iOS 4
    • +
    • Fallback to Flash for MP3/MP4 support, as needed
    • +
    • SM2 API is unchanged, transparent; HTML5/Flash switching handled internally
    • +
    • HTML5 API support approximates Flash 8 API features, minus ID3, plus buffering
    • +
    • Some other formats (WAV/OGG) supported via HTML5, depending on browser
    • +
    • See soundManager.useHTML5Audio for implementation details
    • +
    + +

    Basic API Features (Flash 8)

    +
      +
    • Load, stop, play, pause, mute, seek, pan, volume control from JavaScript
    • +
    • Events: onload(), whileloading(), whileplaying(), onfinish() and more
    • +
    • ID3V1 and ID3V2 tag support for MP3s (title, artist, genre etc.)
    • +
    + +

    Shiny Flash 9-only Features

    + +
    + + +
    Beta-ish, somewhat experimental demo
    + +
    + +
      +
    • RTMP / Flash Media Server streaming support (experimental) - see serverURL for details
    • +
    • MPEG-4 (AAC, HE-AAC, H.264) audio support
    • +
    • "MultiShot" play (layered/chorusing effects)
    • +
    • Waveform/frequency spectrum data
    • +
    • Peak (L/R channel volume) data
    • +
    • Audio buffering state/event handling
    • +
    + +

    General Tech Stuff

    + + +

    As Heard On TV The Internets

    +

    A few nifty places SoundManager 2 has been seen in use on the Wild World Web:

    + + +

    Download!

    +

    Get SoundManager 2

    + +
    + +
     
    + +
    + +
    +

    Playing MP3s with JavaScript

    +

    Play audio in one line, or get fancy with multiple options.

    +
    + +
    +

    How To Play Audio Using SoundManager 2

    +

    Simple ID / URL method:

    + soundManager.play('mySound','/path/to/an.mp3'); +

    And, setting the volume:

    + soundManager.setVolume('mySound',50); +

    More flexible method supporting option parameters as an object literal:

    +
    var mySound = soundManager.createSound({
    +  id: 'someSound',
    +  url: '/path/to/some.mp3',
    +  volume: 50,
    +  onload: soundLoadedFunction
    +});
    +mySound.play();
    +

    See API Demos

    +
    + +
    + +
    + +
    +

    Using SM2 on your site

    +

    How to include SoundManager 2 from HTML, and some basic event handlers.

    +
    + +
    +

    Include the SoundManager 2 core script, tell it where to look for the flash .SWF and provide an onload() handler.

    +
    <script type="text/javascript" src="/path/to/soundmanager2.js"></script>
    +<script type="text/javascript">
    +soundManager.url = '/path/to/swfs/';
    +soundManager.onload = function() {
    +  // SM2 is ready to go! 
    +  // soundManager.createSound(...) calls can now be made, etc.
    +}
    +</script>
    + +

    See a basic template demo

    + +
    + +
    + +
    + +
    +

    Licensing

    +

    BSD licensed.

    +
    + +
    +

    SoundManager 2 is provided under a BSD license.

    +
    + +
    + + +
    + +
    + + + + +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    + %s1 / %s2
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    + + + + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/license.txt b/docs/dymaxion/soundmanagerv297a-20101010/license.txt new file mode 100755 index 0000000..1a17182 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/license.txt @@ -0,0 +1,29 @@ +Software License Agreement (BSD License) + +Copyright (c) 2007, Scott Schiller (schillmania.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of schillmania.com nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission from schillmania.com. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2-jsmin.js b/docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2-jsmin.js new file mode 100755 index 0000000..91c77ed --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2-jsmin.js @@ -0,0 +1,96 @@ +/** @license + + SoundManager 2: Javascript Sound for the Web + -------------------------------------------- + http://schillmania.com/projects/soundmanager2/ + + Copyright (c) 2007, Scott Schiller. All rights reserved. + Code provided under the BSD License: + http://schillmania.com/projects/soundmanager2/license.txt + + V2.97a.20101010 +*/ +(function(W){function va(Ma,Na){function wa(){if(b.debugURLParam.test(G))b.debugMode=true;if(u(b.debugID))return false;var c,a,f,g;if(b.debugMode&&!u(b.debugID)&&(!fa||!b.useConsole||b.useConsole&&fa&&!b.consoleOnly)){c=l.createElement("div");c.id=b.debugID+"-toggle";a={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};c.appendChild(l.createTextNode("-")); +c.onclick=xa;c.title="Toggle SM2 debug console";if(v.match(/msie 6/i)){c.style.position="absolute";c.style.cursor="hand"}for(g in a)if(a.hasOwnProperty(g))c.style[g]=a[g];a=l.createElement("div");a.id=b.debugID;a.style.display=b.debugMode?"block":"none";if(b.debugMode&&!u(c.id)){try{f=X();f.appendChild(c)}catch(e){throw Error(q("appXHTML"));}f.appendChild(a)}}}this.flashVersion=8;this.debugMode=true;this.debugFlash=false;this.useConsole=true;this.waitForWindowLoad=this.consoleOnly=false;this.nullURL= +"about:blank";this.allowPolling=true;this.useFastPolling=false;this.useMovieStar=true;this.bgColor="#ffffff";this.useHighPerformance=false;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useHTML5Audio=this.useFlashBlock=false;this.html5Test=/^probably$/i;this.ondebuglog=false;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:true},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"', +"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:true},ogg:{type:["audio/ogg; codecs=vorbis"],required:false},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:false}};this.defaultOptions={autoLoad:false,stream:true,autoPlay:false,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,onbeforefinish:null,onbeforefinishtime:5E3,onbeforefinishcomplete:null, +onjustbeforefinish:null,onjustbeforefinishtime:200,multiShot:true,multiShotEvents:false,position:null,pan:0,type:null,usePolicyFile:false,volume:100};this.flash9Options={isMovieStar:null,usePeakData:false,useWaveformData:false,useEQData:false,onbufferchange:null,ondataerror:null,onstats:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,bufferTimes:null,duration:null};this.version=null;this.versionNumber="V2.97a.20101010";this.movieURL=null;this.url=Ma||null;this.altURL=null; +this.enabled=this.swfLoaded=false;this.o=null;this.movieID="sm2-container";this.id=Na||"sm2movie";this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.oMC=null;this.sounds={};this.soundIDs=[];this.muted=false;this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.didFlashBlock=this.specialWmodeCase=false;this.filePattern= +null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.baseMimeTypes=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.netStreamMimeTypes=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.netStreamTypes=["aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"];this.netStreamPattern=RegExp("\\.("+this.netStreamTypes.join("|")+")(\\?.*)?$","i");this.mimePattern=this.baseMimeTypes;this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false}; +this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};this.hasHTML5=null;this.html5={usingFlash:null};this.ignoreFlash=false;var ga,b=this,u,v=navigator.userAgent,G=W.location.href.toString(),p=this.flashVersion,l=document,o=W,ya,Y,H=[],ha=true,x,I= +false,P=false,s=false,z=false,ia=false,n,Oa=0,Q,w,za,J,K,ja,Z,Aa,ka,F,Ba,$,R,L,la,X,aa,ma,na,Ca,Pa=["log","info","warn","error"],Da,S,Ea,T=null,oa=null,q,pa,M,xa,ba,ca,qa,r,da=false,ra=false,Fa,Ga,N=null,Ha,ea,C=false,U,D,sa,Ia,E,A,ta=Array.prototype.slice,Ja=v.match(/pre\//i),Qa=v.match(/(ipad|iphone)/i);v.match(/mobile/i);var B=v.match(/MSIE/i),V=v.match(/safari/i)&&!v.match(/chrome/i),fa=typeof console!=="undefined"&&typeof console.log!=="undefined",ua=typeof l.hasFocus!=="undefined"?l.hasFocus(): +null,O=typeof l.hasFocus==="undefined"&&V,Ka=!O;this._use_maybe=G.match(/sm2\-useHTML5Maybe\=1/i);this._overHTTP=l.location?l.location.protocol.match(/http/i):null;this.useAltURL=!this._overHTTP;if(Qa||Ja){b.useHTML5Audio=true;b.ignoreFlash=true}if(Ja||this._use_maybe)b.html5Test=/^(probably|maybe)$/i;(function(){var c=G,a=null;if(c.indexOf("#sm2-usehtml5audio=")!==-1){a=c.substr(c.indexOf("#sm2-usehtml5audio=")+19)==="1";if(typeof console!=="undefined"&&typeof console.log!=="undefined")console.log((a? +"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter");b.useHTML5Audio=a}})();this.supported=function(){return N?s&&!z:b.useHTML5Audio&&b.hasHTML5};this.getMovie=function(c){return B?o[c]:V?u(c)||l[c]:u(c)};this.loadFromXML=function(c){try{b.o._loadFromXML(c)}catch(a){S()}return true};this.createSound=function(c){function a(){f=ba(f);b.sounds[e.id]=new ga(e);b.soundIDs.push(e.id);return b.sounds[e.id]}var f=null,g=null,e=null;if(!s||!b.supported()){qa("soundManager.createSound(): "+q(!s?"notReady": +"notOK"));return false}if(arguments.length===2)c={id:arguments[0],url:arguments[1]};e=f=w(c);e.id.toString().charAt(0).match(/^[0-9]$/)&&b._wD("soundManager.createSound(): "+q("badID",e.id),2);b._wD("soundManager.createSound(): "+e.id+" ("+e.url+")",1);if(r(e.id,true)){b._wD("soundManager.createSound(): "+e.id+" exists",1);return b.sounds[e.id]}if(ea(e)){g=a();b._wD("Loading sound "+e.id+" from HTML5");g._setup_html5(e)}else{if(p>8&&b.useMovieStar){if(e.isMovieStar===null)e.isMovieStar=e.serverURL|| +(e.type?e.type.match(b.netStreamPattern):false)||e.url.match(b.netStreamPattern)?true:false;e.isMovieStar&&b._wD("soundManager.createSound(): using MovieStar handling");if(e.isMovieStar){if(e.usePeakData){n("noPeak");e.usePeakData=false}e.loops>1&&n("noNSLoop")}}e=ca(e,"soundManager.createSound(): ");g=a();if(p===8)b.o._createSound(e.id,e.onjustbeforefinishtime,e.loops||1,e.usePolicyFile);else{b.o._createSound(e.id,e.url,e.onjustbeforefinishtime,e.usePeakData,e.useWaveformData,e.useEQData,e.isMovieStar, +e.isMovieStar?e.bufferTime:false,e.loops||1,e.serverURL,e.duration||null,e.autoPlay,true,e.bufferTimes,e.onstats?true:false,e.autoLoad,e.usePolicyFile);if(!e.serverURL){g.connected=true;e.onconnect&&e.onconnect.apply(g)}}}if(e.autoLoad||e.autoPlay)if(g)if(b.isHTML5){g.autobuffer="auto";g.preload="auto"}else g.load(e);e.autoPlay&&g.play();return g};this.destroySound=function(c,a){if(!r(c))return false;var f=b.sounds[c],g;f._iO={};f.stop();f.unload();for(g=0;g=2)e.style.fontWeight="bold";if(a===3)e.style.color="#ff3333"}g.insertBefore(e,g.firstChild)}catch(k){}return true};this._debug=function(){n("currentObj",1);for(var c=0,a=b.soundIDs.length;c0){b._wD('SMSound.play(): "'+ +a.sID+'" is resuming from paused state',1);a.resume()}else{b._wD('SMSound.play(): "'+a.sID+'" is starting to play');a.playState=1;a.paused=false;if(!a.instanceCount||a._iO.multiShotEvents||p>8&&!a.isHTML5&&!a.getAutoPlay())a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;a._iO=ca(ba(a._iO));a._iO.onplay&&h&&a._iO.onplay.apply(a);a.setVolume(a._iO.volume,true);a.setPan(a._iO.pan,true);if(a.isHTML5){k();a._setup_html5().play()}else b.o._start(a.sID, +a._iO.loops||1,p===9?a.position:a.position/1E3)}return a};this.stop=function(d){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);if(!a.isHTML5)a.playState=0;a.paused=false;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(i){a.setPosition(0);i.pause();a.playState=0;a._onTimer();e();a.unload()}}else{b.o._stop(a.sID,d);a._iO.serverURL&&a.unload()}a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(d){b._wD("sound "+a.sID+" turned autoplay "+(d?"on":"off"));a._iO.autoPlay= +d;b.o._setAutoPlay(a.sID,d);if(d)if(!a.instanceCount&&a.readyState===1){a.instanceCount++;b._wD("sound "+a.sID+" incremented instance count to "+a.instanceCount)}};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(d){if(d===undefined)d=0;a.position=a.isHTML5?Math.max(d,0):Math.min(a.duration||a._iO.duration,Math.max(d,0));a.resetOnPosition(a.position);if(a.isHTML5){if(i){b._wD("setPosition(): setting position to "+a.position/1E3);if(a.playState)try{i.currentTime=a.position/ +1E3}catch(h){b._wD("setPosition("+a.position+"): WARN: Caught exception: "+h.message,2)}else b._wD("HTML 5 warning: cannot set position while playState == 0 (not playing)",2);if(a.paused){a._onTimer(true);a._iO.useMovieStar&&a.resume()}}}else{d=p===9?a.position:a.position/1E3;a.playState===0?a.play({position:d}):b.o._setPosition(a.sID,d,a.paused||!a.playState)}return a};this.pause=function(d){if(a.paused||a.playState===0&&a.readyState!==1)return a;b._wD("SMSound.pause()");a.paused=true;if(a.isHTML5){a._setup_html5().pause(); +e()}else if(d||d===undefined)b.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;b._wD("SMSound.resume()");a.paused=false;a.playState=1;if(a.isHTML5){a._setup_html5().play();k()}else b.o._pause(a.sID);a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){b._wD("SMSound.togglePause()");if(a.playState===0){a.play({position:p===9&&!a.isHTML5?a.position:a.position/1E3});return a}a.paused?a.resume():a.pause();return a}; +this.setPan=function(d,h){if(typeof d==="undefined")d=0;if(typeof h==="undefined")h=false;a.isHTML5||b.o._setPan(a.sID,d);a._iO.pan=d;if(!h)a.pan=d;return a};this.setVolume=function(d,h){if(typeof d==="undefined")d=100;if(typeof h==="undefined")h=false;if(a.isHTML5){if(i)i.volume=d/100}else b.o._setVolume(a.sID,b.muted&&!a.muted||a.muted?0:d);a._iO.volume=d;if(!h)a.volume=d;return a};this.mute=function(){a.muted=true;if(a.isHTML5){if(i)i.muted=true}else b.o._setVolume(a.sID,0);return a};this.unmute= +function(){a.muted=false;var d=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(i)i.muted=false}else b.o._setVolume(a.sID,d?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(d,h,j){a._onPositionItems.push({position:d,method:h,scope:typeof j!=="undefined"?j:a,fired:false});return a};this.processOnPosition=function(){var d,h;d=a._onPositionItems.length;if(!d||!a.playState||a._onPositionFired>=d)return false;for(d=d;d--;){h= +a._onPositionItems[d];if(!h.fired&&a.position>=h.position){h.method.apply(h.scope,[h.position]);h.fired=true;b._onPositionFired++}}return true};this.resetOnPosition=function(d){var h,j;h=a._onPositionItems.length;if(!h)return false;for(h=h;h--;){j=a._onPositionItems[h];if(j.fired&&d<=j.position){j.fired=false;b._onPositionFired--}}return true};this._onTimer=function(d){var h={};if(a._hasTimer||d)if(i&&(d||(a.playState>0||a.readyState===1)&&!a.paused)){a.duration=m();a.durationEstimate=a.duration; +d=i.currentTime?i.currentTime*1E3:0;a._whileplaying(d,h,h,h,h);return true}else{b._wD('_onTimer: Warn for "'+a.sID+'": '+(!i?"Could not find element. ":"")+(a.playState===0?"playState bad, 0?":"playState = "+a.playState+", OK"));return false}};m=function(){var d=i?i.duration*1E3:undefined;return d&&!isNaN(d)?d:null};k=function(){a.isHTML5&&Fa(a)};e=function(){a.isHTML5&&Ga(a)};f=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._added_events=null;i=a._audio=null;a.bytesLoaded= +null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=false;a.playState=0;a.paused=false;a.readyState=0;a.muted=false;a.didBeforeFinish=false;a.didJustBeforeFinish=false;a.isBuffering=false;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};f();this._setup_html5=function(d){d=w(a._iO,d);if(i){if(a.url!==d.url){b._wD("setting new URL on existing object: "+ +d.url);i.src=d.url}}else{b._wD("creating HTML 5 audio element with URL: "+d.url);a._audio=new Audio(d.url);i=a._audio;a.isHTML5=true;g()}i.loop=d.loops>1?"loop":"";return a._audio};g=function(){function d(h,j,t){return i?i.addEventListener(h,j,t||false):null}if(a._added_events)return false;a._added_events=true;d("load",function(){b._wD("HTML5::load: "+a.sID);if(i){a._onbufferchange(0);a._whileloading(a.bytesTotal,a.bytesTotal,m());a._onload(true)}},false);d("canplay",function(){b._wD("HTML5::canplay: "+ +a.sID);a._onbufferchange(0)},false);d("waiting",function(){b._wD("HTML5::waiting: "+a.sID);a._onbufferchange(1)},false);d("progress",function(h){b._wD("HTML5::progress: "+a.sID+": loaded/total: "+(h.loaded||0)+"/"+(h.total||1));if(!a.loaded&&i){a._onbufferchange(0);a._whileloading(h.loaded||0,h.total||1,m())}},false);d("error",function(){if(i){b._wD("HTML5::error: "+i.error.code);a._onload(false)}},false);d("loadstart",function(){b._wD("HTML5::loadstart: "+a.sID);a._onbufferchange(1)},false);d("play", +function(){b._wD("HTML5::play: "+a.sID);a._onbufferchange(0)},false);d("playing",function(){b._wD("HTML5::playing: "+a.sID);a._onbufferchange(0)},false);d("timeupdate",function(){a._onTimer()},false);setTimeout(function(){a&&i&&d("ended",function(){b._wD("HTML5::ended: "+a.sID);a._onfinish()},false)},250);return true};this._whileloading=function(d,h,j,t){a.bytesLoaded=d;a.bytesTotal=h;a.duration=Math.floor(j);a.bufferLength=t;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else{a.durationEstimate= +a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10);if(a.durationEstimate===undefined)a.durationEstimate=a.duration;a.bufferLength=t}a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._onid3=function(d,h){b._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');var j=[],t,y;t=0;for(y=d.length;t0)d=0;a.position=d;a.processOnPosition();if(p>8&&!a.isHTML5){if(a._iO.usePeakData&&typeof h!=="undefined"&&h)a.peakData={left:h.leftPeak,right:h.rightPeak};if(a._iO.useWaveformData&&typeof j!=="undefined"&&j)a.waveformData={left:j.split(","),right:t.split(",")};if(a._iO.useEQData)if(typeof y!=="undefined"&&y&&y.leftEQ){d=y.leftEQ.split(",");a.eqData=d;a.eqData.left=d;if(typeof y.rightEQ!=="undefined"&&y.rightEQ)a.eqData.right=y.rightEQ.split(",")}}if(a.playState=== +1){!a.isHTML5&&b.flashVersion===8&&!a.position&&a.isBuffering&&a._onbufferchange(0);a._iO.whileplaying&&a._iO.whileplaying.apply(a);if((a.loaded||!a.loaded&&a._iO.isMovieStar)&&a._iO.onbeforefinish&&a._iO.onbeforefinishtime&&!a.didBeforeFinish&&a.duration-a.position<=a._iO.onbeforefinishtime)a._onbeforefinish()}return true};this._onconnect=function(d){d=d===1;b._wD('SMSound._onconnect(): "'+a.sID+'"'+(d?" connected.":" failed to connect? - "+a.url),d?1:2);if(a.connected=d){a.failures=0;a._iO.onconnect&& +a._iO.onconnect.apply(a,[d]);if(r(a.sID)&&(a.options.autoLoad||a.getAutoPlay()))a.play(undefined,a.getAutoPlay())}};this._onload=function(d){d=d?true:false;b._wD('SMSound._onload(): "'+a.sID+'"'+(d?" loaded.":" failed to load? - "+a.url),d?1:2);if(!d&&!a.isHTML5){b.sandbox.noRemote===true&&b._wD("SMSound._onload(): "+q("noNet"),1);b.sandbox.noLocal===true&&b._wD("SMSound._onload(): "+q("noLocal"),1)}a.loaded=d;a.readyState=d?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[d]);return true}; +this._onfailure=function(d,h,j){a.failures++;b._wD('SMSound._onfailure(): "'+a.sID+'" count '+a.failures);a._iO.onfailure&&a.failures===1?a._iO.onfailure(a,d,h,j):b._wD("SMSound._onfailure(): ignoring")};this._onbeforefinish=function(){if(!a.didBeforeFinish){a.didBeforeFinish=true;if(a._iO.onbeforefinish){b._wD('SMSound._onbeforefinish(): "'+a.sID+'"');a._iO.onbeforefinish.apply(a)}}};this._onjustbeforefinish=function(){if(!a.didJustBeforeFinish){a.didJustBeforeFinish=true;if(a._iO.onjustbeforefinish){b._wD('SMSound._onjustbeforefinish(): "'+ +a.sID+'"');a._iO.onjustbeforefinish.apply(a)}}};this._onstats=function(d){a._iO.onstats&&a._iO.onstats(a,d)};this._onfinish=function(){a._onbufferchange(0);a.resetOnPosition(0);a._iO.onbeforefinishcomplete&&a._iO.onbeforefinishcomplete.apply(a);a.didBeforeFinish=false;a.didJustBeforeFinish=false;if(a.instanceCount){a.instanceCount--;if(!a.instanceCount){a.playState=0;a.paused=false;a.instanceCount=0;a.instanceOptions={};e()}if(!a.instanceCount||a._iO.multiShotEvents)if(a._iO.onfinish){b._wD('SMSound._onfinish(): "'+ +a.sID+'"');a._iO.onfinish.apply(a)}}};this._onbufferchange=function(d){if(a.playState===0)return false;if(d&&a.isBuffering||!d&&!a.isBuffering)return false;a.isBuffering=d===1;if(a._iO.onbufferchange){b._wD("SMSound._onbufferchange(): "+d);a._iO.onbufferchange.apply(a)}return true};this._ondataerror=function(d){if(a.playState>0){b._wD("SMSound._ondataerror(): "+d);a._iO.ondataerror&&a._iO.ondataerror.apply(a)}}};X=function(){return l.body?l.body:l._docElement?l.documentElement:l.getElementsByTagName("div")[0]}; +u=function(c){return l.getElementById(c)};w=function(c,a){var f={},g,e;for(g in c)if(c.hasOwnProperty(g))f[g]=c[g];g=typeof a==="undefined"?b.defaultOptions:a;for(e in g)if(g.hasOwnProperty(e)&&typeof f[e]==="undefined")f[e]=g[e];return f};(function(){function c(e){e=ta.call(e);var k=e.length;if(f){e[1]="on"+e[1];k>3&&e.pop()}else k===3&&e.push(false);return e}function a(e,k){var m=e.shift()[g[k]];f?m(e[0],e[1]):m.apply(this,e)}var f=o.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f? +"detachEvent":"removeEventListener"};E=function(){a(c(arguments),"add")};A=function(){a(c(arguments),"remove")}})();ea=function(c){return(c.type?U({type:c.type}):false)||U(c.url)};U=function(c){if(!b.useHTML5Audio||!b.hasHTML5)return false;var a,f=b.audioFormats;if(!D){D=[];for(a in f)if(f.hasOwnProperty(a)){D.push(a);if(f[a].related)D=D.concat(f[a].related)}D=RegExp("\\.("+D.join("|")+")","i")}a=typeof c.type!=="undefined"?c.type:null;c=typeof c==="string"?c.toLowerCase().match(D):null;if(!c||!c.length){if(!a)return false}else c= +c[0].substr(1);if(c&&typeof b.html5[c]!=="undefined")return b.html5[c];else{if(!a)if(c&&b.html5[c])return b.html5[c];else a="audio/"+c;a=b.html5.canPlayType(a);return b.html5[c]=a}};Ia=function(){function c(m){var i,d,h=false;if(!a||typeof a.canPlayType!=="function")return false;if(m instanceof Array){i=0;for(d=m.length;i1&&c.stream){n("as2loop"); +c.stream=false}return c};ca=function(c,a){if(c&&!c.usePolicyFile&&(c.onid3||c.usePeakData||c.useWaveformData||c.useEQData)){b._wD((a?a+":":"")+q("policy"));c.usePolicyFile=true}return c};qa=function(c){typeof console!=="undefined"&&typeof console.warn!=="undefined"?console.warn(c):b._wD(c)};ya=function(){return false};Da=function(c){for(var a in c)if(c.hasOwnProperty(a)&&typeof c[a]==="function")c[a]=ya};S=function(c){if(typeof c==="undefined")c=false;if(z||c){n("smFail",2);b.disable(c)}};Ea=function(c){var a= +null;if(c)if(c.match(/\.swf(\?\.*)?$/i)){if(a=c.substr(c.toLowerCase().lastIndexOf(".swf?")+4))return c}else if(c.lastIndexOf("/")!==c.length-1)c+="/";return(c&&c.lastIndexOf("/")!==-1?c.substr(0,c.lastIndexOf("/")+1):"./")+b.movieURL};ka=function(){if(p!==8&&p!==9){b._wD(q("badFV",p,8));b.flashVersion=8}var c=b.debugMode||b.debugFlash?"_debug.swf":".swf";if(b.flashVersion<9&&b.useHTML5Audio&&b.audioFormats.mp4.required){b._wD(q("needfl9"));b.flashVersion=9}p=b.flashVersion;b.version=b.versionNumber+ +(C?" (HTML5-only mode)":p===9?" (AS3/Flash 9)":" (AS2/Flash 8)");if(p>8){b.defaultOptions=w(b.defaultOptions,b.flash9Options);b.features.buffering=true}if(p>8&&b.useMovieStar){b.defaultOptions=w(b.defaultOptions,b.movieStarOptions);b.filePatterns.flash9=RegExp("\\.(mp3|"+b.netStreamTypes.join("|")+")(\\?.*)?$","i");b.mimePattern=b.netStreamMimeTypes;b.features.movieStar=true}else b.features.movieStar=false;b.filePattern=b.filePatterns[p!==8?"flash9":"flash8"];b.movieURL=(p===8?"soundmanager2.swf": +"soundmanager2_flash9.swf").replace(".swf",c);b.features.peakData=b.features.waveformData=b.features.eqData=p>8};Ca=function(c,a){if(!b.o||!b.allowPolling)return false;b.o._setPolling(c,a)};(function(){function c(e){e=ta.call(e);var k=e.length;if(f){e[1]="on"+e[1];k>3&&e.pop()}else k===3&&e.push(false);return e}function a(e,k){var m=e.shift()[g[k]];f?m(e[0],e[1]):m.apply(this,e)}var f=o.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};E=function(){a(c(arguments), +"add")};A=function(){a(c(arguments),"remove")}})();na=function(){function c(){f.left=o.scrollX+"px";f.top=o.scrollY+"px"}function a(g){b._wD("mobileFlash::flash on-screen hack: "+(g?"ON":"OFF"));g=o[(g?"add":"remove")+"EventListener"];g("resize",c,false);g("scroll",c,false)}var f=null;return{check:function(g){f=b.oMC.style;if(v.match(/android/i)){if(g){if(b.flashLoadTimeout){b._wDS("mfTimeout");b.flashLoadTimeout=0}return false}b._wD("mfOn");f.position="absolute";f.left=f.top="0px";a(true);b.onready(function(){a(false); +if(f)f.left=f.top="-9999px"});c()}return true}}}();aa=function(c,a){function f(){b._wD("-- SoundManager 2 "+b.version+(!C&&b.useHTML5Audio?b.hasHTML5?" + HTML5 audio":", no HTML5 audio support":"")+(b.useMovieStar?", MovieStar mode":"")+(b.useHighPerformance?", high performance mode, ":", ")+((b.useFastPolling?"fast":"normal")+" polling")+(b.wmode?", wmode: "+b.wmode:"")+(b.debugFlash?", flash debug mode":"")+(b.useFlashBlock?", flashBlock mode":"")+" --",1)}var g=a?a:b.url,e=b.altURL?b.altURL:g, +k;k=X();var m,i,d=M(),h,j=null;j=(j=l.getElementsByTagName("html")[0])&&j.dir&&j.dir.match(/rtl/i);c=typeof c==="undefined"?b.id:c;if(I&&P)return false;if(C){ka();f();b.oMC=u(b.movieID);Y();P=I=true;return false}I=true;ka();b.url=Ea(this._overHTTP?g:e);a=b.url;b.wmode=!b.wmode&&b.useHighPerformance&&!b.useMovieStar?"transparent":b.wmode;if(b.wmode!==null&&!B&&!b.useHighPerformance&&navigator.platform.match(/win32/i)){b.specialWmodeCase=true;n("spcWmode");b.wmode=null}k={name:c,id:c,src:a,width:"100%", +height:"100%",quality:"high",allowScriptAccess:b.allowScriptAccess,bgcolor:b.bgColor,pluginspage:"http://www.macromedia.com/go/getflashplayer",type:"application/x-shockwave-flash",wmode:b.wmode};if(b.debugFlash)k.FlashVars="debug=1";b.wmode||delete k.wmode;if(B){g=l.createElement("div");i=''+(b.wmode?' ':"")+''+(b.debugFlash?'':"")+"'; + } else { + oMovie = _doc.createElement('embed'); + for (tmp in oEmbed) { + if (oEmbed.hasOwnProperty(tmp)) { + oMovie.setAttribute(tmp, oEmbed[tmp]); + } + } + } + + _initDebug(); + extraClass = _getSWFCSS(); + oTarget = _getDocument(); + + if (oTarget) { + _s.oMC = _id(_s.movieID)?_id(_s.movieID):_doc.createElement('div'); + if (!_s.oMC.id) { + _s.oMC.id = _s.movieID; + _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; + // "hide" flash movie + s = null; + oEl = null; + if (!_s.useFlashBlock) { + if (_s.useHighPerformance) { + s = { + 'position': 'fixed', + 'width': '8px', + 'height': '8px', + // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes. + 'bottom': '0px', + 'left': '0px', + 'overflow': 'hidden' + }; + } else { + s = { + 'position': 'absolute', + 'width': '6px', + 'height': '6px', + 'top': '-9999px', + 'left': '-9999px' + }; + if (isRTL) { + s.left = Math.abs(parseInt(s.left,10))+'px'; + } + } + } + if (_ua.match(/webkit/i)) { + _s.oMC.style.zIndex = 10000; // soundcloud-reported render/crash fix, safari 5 + } + if (!_s.debugFlash) { + for (x in s) { + if (s.hasOwnProperty(x)) { + _s.oMC.style[x] = s[x]; + } + } + } + try { + if (!_isIE) { + _s.oMC.appendChild(oMovie); + } + oTarget.appendChild(_s.oMC); + if (_isIE) { + oEl = _s.oMC.appendChild(_doc.createElement('div')); + oEl.className = _s.swfCSS.swfBox; + oEl.innerHTML = movieHTML; + } + _appendSuccess = true; + } catch(e) { + throw new Error(_str('appXHTML')); + } + _mobileFlash.check(); + } else { + // it's already in the document. + sClass = _s.oMC.className; + _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); + _s.oMC.appendChild(oMovie); + if (_isIE) { + oEl = _s.oMC.appendChild(_doc.createElement('div')); + oEl.className = _s.swfCSS.swfBox; + oEl.innerHTML = movieHTML; + } + _appendSuccess = true; + _mobileFlash.check(true); + } + } + + if (specialCase) { + //_s._wD(specialCase); + } + + _initMsg(); + //_s._wD('soundManager::createMovie(): Trying to load ' + smURL + (!this._overHTTP && _s.altURL?' (alternate URL)':''), 1); + + return true; + }; + + _idCheck = this.getSoundById; + + _initMovie = function() { + if (_html5Only) { + _createMovie(); + return false; + } + // attempt to get, or create, movie + if (_s.o) { + return false; // may already exist + } + _s.o = _s.getMovie(_s.id); // inline markup + if (!_s.o) { + if (!_oRemoved) { + // try to create + _createMovie(_s.id, _s.url); + } else { + // try to re-append removed movie after reboot() + if (!_isIE) { + _s.oMC.appendChild(_oRemoved); + } else { + _s.oMC.innerHTML = _oRemovedHTML; + } + _oRemoved = null; + _didAppend = true; + } + _s.o = _s.getMovie(_s.id); + } + if (_s.o) { + //_s._wD('soundManager::initMovie(): Got '+_s.o.nodeName+' element ('+(_didAppend?'created via JS':'static HTML')+')'); + //_wDS('waitEI'); + } + if (_s.oninitmovie instanceof Function) { + setTimeout(_s.oninitmovie, 1); + } + return true; + }; + + _go = function(sURL) { + // where it all begins. + if (sURL) { + _s.url = sURL; + } + _initMovie(); + }; + + _delayWaitForEI = function() { + setTimeout(_waitForEI, 500); + }; + + _waitForEI = function() { + if (_waitingForEI) { + return false; + } + _waitingForEI = true; + _removeEvt(_win, 'load', _delayWaitForEI); + if (_tryInitOnFocus && !_isFocused) { + //_wDS('waitFocus'); + return false; + } + var p; + if (!_didInit) { + p = _s.getMoviePercent(); + //_s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':'')))); + } + setTimeout(function() { + p = _s.getMoviePercent(); + if (!_didInit) { + //_s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2); + if (!this._overHTTP && p) { + //_wDS('localFail', 2); + if (!_s.debugFlash) { + //_wDS('tryDebug', 2); + } + } + if (p === 0) { + // if 0 (not null), probably a 404. + //_s._wD(_str('swf404', _s.url)); + } + //_debugTS('flashtojs', false, ': Timed out' + this._overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)'); + } + // give up / time-out, depending + if (!_didInit && _okToDisable) { + if (p === null) { + // SWF failed. Maybe blocked. + if (_s.useFlashBlock || _s.flashLoadTimeout === 0) { + if (_s.useFlashBlock) { + _flashBlockHandler(); + } + //_wDS('waitForever'); + } else { + // old SM2 behaviour, simply fail + _failSafely(true); + } + } else { + // flash loaded? Shouldn't be a blocking issue, then. + if (_s.flashLoadTimeout === 0) { + //_wDS('waitForever'); + } else { + _failSafely(true); + } + } + } + }, _s.flashLoadTimeout); + }; + + _go = function(sURL) { + // where it all begins. + if (sURL) { + _s.url = sURL; + } + _initMovie(); + }; + + /* + _wDS = function(o, errorLevel) { + if (!o) { + return ''; + } else { + return //_s._wD(_str(o), errorLevel); + } + }; + + if (_wl.indexOf('debug=alert') + 1 && _s.debugMode) { + _s._wD = function(sText) {alert(sText);}; + } + + _toggleDebug = function() { + var o = _id(_s.debugID), + oT = _id(_s.debugID + '-toggle'); + if (!o) { + return false; + } + if (_debugOpen) { + // minimize + oT.innerHTML = '+'; + o.style.display = 'none'; + } else { + oT.innerHTML = '-'; + o.style.display = 'block'; + } + _debugOpen = !_debugOpen; + }; + + _debugTS = function(sEventType, bSuccess, sMessage) { + // troubleshooter debug hooks + if (typeof sm2Debugger !== 'undefined') { + try { + sm2Debugger.handleEvent(sEventType, bSuccess, sMessage); + } catch(e) { + // oh well + } + } + return true; + }; + */ + + _getSWFCSS = function() { + var css = []; + if (_s.debugMode) { + css.push(_s.swfCSS.sm2Debug); + } + if (_s.debugFlash) { + css.push(_s.swfCSS.flashDebug); + } + if (_s.useHighPerformance) { + css.push(_s.swfCSS.highPerf); + } + return css.join(' '); + }; + + _flashBlockHandler = function() { + // *possible* flash block situation. + var name = _str('fbHandler'), p = _s.getMoviePercent(); + if (!_s.supported()) { + if (_needsFlash) { + // make the movie more visible, so user can fix + _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + ' ' + (p === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); + //_s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':'')); + } + _s.didFlashBlock = true; + _processOnReady(true); // fire onready(), complain lightly + if (_s.onerror instanceof Function) { + _s.onerror.apply(_win); + } + } else { + // SM2 loaded OK (or recovered) + if (_s.didFlashBlock) { + //_s._wD(name+': Unblocked'); + } + if (_s.oMC) { + _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + (' '+_s.swfCSS.swfUnblocked); + } + } + }; + + _handleFocus = function() { + function cleanup() { + _removeEvt(_win, 'focus', _handleFocus); + _removeEvt(_win, 'load', _handleFocus); + } + if (_isFocused || !_tryInitOnFocus) { + cleanup(); + return true; + } + _okToDisable = true; + _isFocused = true; + //_s._wD('soundManager::handleFocus()'); + if (_isSafari && _tryInitOnFocus) { + // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event + _removeEvt(_win, 'mousemove', _handleFocus); + } + // allow init to restart + _waitingForEI = false; + cleanup(); + return true; + }; + + _initComplete = function(bNoDisable) { + if (_didInit) { + return false; + } + if (_html5Only) { + // all good. + //_s._wD('-- SoundManager 2: loaded --'); + _didInit = true; + _processOnReady(); + _initUserOnload(); + return true; + } + var sClass = _s.oMC.className, + wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()); + if (!wasTimeout) { + _didInit = true; + } + //_s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1); + if (_disabled || bNoDisable) { + if (_s.useFlashBlock) { + _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); + } + _processOnReady(); + //_debugTS('onload', false); + if (_s.onerror instanceof Function) { + _s.onerror.apply(_win); + } + return false; + } else { + //_debugTS('onload', true); + } + if (_s.waitForWindowLoad && !_windowLoaded) { + //_wDS('waitOnload'); + _addEvt(_win, 'load', _initUserOnload); + return false; + } else { + if (_s.waitForWindowLoad && _windowLoaded) { + //_wDS('docLoaded'); + } + _initUserOnload(); + } + return true; + }; + + _addOnReady = function(oMethod, oScope) { + _onready.push({ + 'method': oMethod, + 'scope': (oScope || null), + 'fired': false + }); + }; + + _processOnReady = function(ignoreInit) { + if (!_didInit && !ignoreInit) { + // not ready yet. + return false; + } + var status = { + success: (ignoreInit?_s.supported():!_disabled) + }, + queue = [], i, j, + canRetry = (!_s.useFlashBlock || (_s.useFlashBlock && !_s.supported())); + for (i = 0, j = _onready.length; i < j; i++) { + if (_onready[i].fired !== true) { + queue.push(_onready[i]); + } + } + if (queue.length) { + //_s._wD(_sm + ': Firing ' + queue.length + ' onready() item' + (queue.length > 1?'s':'')); + for (i = 0, j = queue.length; i < j; i++) { + if (queue[i].scope) { + queue[i].method.apply(queue[i].scope, [status]); + } else { + queue[i].method(status); + } + if (!canRetry) { // flashblock case doesn't count here + queue[i].fired = true; + } + } + } + return true; + }; + + _initUserOnload = function() { + _win.setTimeout(function() { + if (_s.useFlashBlock) { + _flashBlockHandler(); + } + _processOnReady(); + //_wDS('onload', 1); + // call user-defined "onload", scoped to window + if (_s.onload instanceof Function) { + _s.onload.apply(_win); + } + //_wDS('onloadOK', 1); + if (_s.waitForWindowLoad) { + _addEvt(_win, 'load', _initUserOnload); + } + },1); + }; + + _featureCheck = function() { + var needsFlash, item, + isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_(3|4)/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Known Apple "radar" bug. https://bugs.webkit.org/show_bug.cgi?id=32159 + isSpecial = (_ua.match(/iphone os (1|2|3_0|3_1)/i)?true:false); // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works. + if (isSpecial) { + _s.hasHTML5 = false; // has Audio(), but is broken; let it load links directly. + _html5Only = true; // ignore flash case, however + if (_s.oMC) { + _s.oMC.style.display = 'none'; + } + return false; + } + if (_s.useHTML5Audio) { + if (!_s.html5 || !_s.html5.canPlayType) { + //_s._wD('SoundManager: No HTML5 Audio() support detected.'); + _s.hasHTML5 = false; + return true; + } else { + _s.hasHTML5 = true; + } + if (isBadSafari) { + //_s._wD('SoundManager::Note: Buggy HTML5 Audio in Safari on OS X 10.6.[3|4], see https://bugs.webkit.org/show_bug.cgi?id=32159 - disabling HTML5 audio',1); + _s.useHTML5Audio = false; + _s.hasHTML5 = false; + return true; + } + } else { + // flash required. + return true; + } + for (item in _s.audioFormats) { + if (_s.audioFormats.hasOwnProperty(item) && _s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) { + // may need flash for this format? + needsFlash = true; + } + } + // sanity check.. + if (_s.ignoreFlash) { + needsFlash = false; + } + _html5Only = (_s.useHTML5Audio && _s.hasHTML5 && !needsFlash); + return needsFlash; + }; + + _init = function() { + var item, tests = []; + //_wDS('init'); + + // called after onload() + if (_didInit) { + //_wDS('didInit'); + return false; + } + + function _cleanup() { + _removeEvt(_win, 'load', _s.beginDelayedInit); + } + + if (_s.hasHTML5) { + for (item in _s.audioFormats) { + if (_s.audioFormats.hasOwnProperty(item)) { + tests.push(item+': '+_s.html5[item]); + } + } + //_s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1); + } + + if (_html5Only) { + if (!_didInit) { + // we don't need no steenking flash! + _cleanup(); + _s.enabled = true; + _initComplete(); + } + return true; + } + + // flash path + _initMovie(); + try { + //_wDS('flashJS'); + _s.o._externalInterfaceTest(false); // attempt to talk to Flash + if (!_s.allowPolling) { + //_wDS('noPolling', 1); + } else { + _setPolling(true, _s.useFastPolling?true:false); + } + if (!_s.debugMode) { + _s.o._disableDebug(); + } + _s.enabled = true; + //_debugTS('jstoflash', true); + } catch(e) { + //_s._wD('js/flash exception: ' + e.toString()); + //_debugTS('jstoflash', false); + _failSafely(true); // don't disable, for reboot() + _initComplete(); + return false; + } + _initComplete(); + // event cleanup + _cleanup(); + return true; + }; + + _beginInit = function() { + if (_initPending) { + return false; + } + _createMovie(); + _initMovie(); + _initPending = true; + return true; + }; + + _dcLoaded = function() { + if (_didDCLoaded) { + return false; + } + _didDCLoaded = true; + _initDebug(); + _testHTML5(); + _s.html5.usingFlash = _featureCheck(); + _needsFlash = _s.html5.usingFlash; + _didDCLoaded = true; + if (_doc.removeEventListener) { + _doc.removeEventListener('DOMContentLoaded', _dcLoaded, false); + } + _go(); + return true; + }; + + _startTimer = function(oSound) { + if (!oSound._hasTimer) { + oSound._hasTimer = true; + } + }; + + _stopTimer = function(oSound) { + if (oSound._hasTimer) { + oSound._hasTimer = false; + } + }; + + _die = function() { + if (_s.onerror instanceof Function) { + _s.onerror(); + } + _s.disable(); + }; + + // pseudo-private methods called by Flash + + this._setSandboxType = function(sandboxType) { + /* + var sb = _s.sandbox; + sb.type = sandboxType; + sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')]; + //_s._wD('Flash security sandbox type: ' + sb.type); + if (sb.type === 'localWithFile') { + sb.noRemote = true; + sb.noLocal = false; + //_wDS('secNote', 2); + } else if (sb.type === 'localWithNetwork') { + sb.noRemote = false; + sb.noLocal = true; + } else if (sb.type === 'localTrusted') { + sb.noRemote = false; + sb.noLocal = false; + } + */ + }; + + this._externalInterfaceOK = function(flashDate) { + // flash callback confirming flash loaded, EI working etc. + // flashDate = approx. timing/delay info for JS/flash bridge + if (_s.swfLoaded) { + return false; + } + var eiTime = new Date().getTime(); + //_s._wD('soundManager::externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':'')); + //_debugTS('swf', true); + //_debugTS('flashtojs', true); + _s.swfLoaded = true; + _tryInitOnFocus = false; + if (_isIE) { + // IE needs a timeout OR delay until window.onload - may need TODO: investigating + setTimeout(_init, 100); + } else { + _init(); + } + }; + + _dcIE = function() { + if (_doc.readyState === 'complete') { + _dcLoaded(); + _doc.detachEvent('onreadystatechange', _dcIE); + } + return true; + }; + + // focus and window load, init + if (!_s.hasHTML5 || _needsFlash) { + // only applies to Flash mode + _addEvt(_win, 'focus', _handleFocus); + _addEvt(_win, 'load', _handleFocus); + _addEvt(_win, 'load', _delayWaitForEI); + if (_isSafari && _tryInitOnFocus) { + _addEvt(_win, 'mousemove', _handleFocus); // massive Safari focus hack + } + } + + if (_doc.addEventListener) { + _doc.addEventListener('DOMContentLoaded', _dcLoaded, false); + } else if (_doc.attachEvent) { + _doc.attachEvent('onreadystatechange', _dcIE); + } else { + // no add/attachevent support - safe to assume no JS -> Flash either + //_debugTS('onload', false); + _die(); + } + + if (_doc.readyState === 'complete') { + setTimeout(_dcLoaded,100); + } + +} // SoundManager() + +// var SM2_DEFER = true; +// details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading + +if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) { + soundManager = new SoundManager(); +} + +// public interfaces +window.SoundManager = SoundManager; // constructor +window.soundManager = soundManager; // public instance: API, Flash callbacks etc. + +}(window)); diff --git a/docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2.js b/docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2.js new file mode 100755 index 0000000..46528c9 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/script/soundmanager2.js @@ -0,0 +1,2838 @@ +/** @license + * SoundManager 2: Javascript Sound for the Web + * -------------------------------------------- + * http://schillmania.com/projects/soundmanager2/ + * + * Copyright (c) 2007, Scott Schiller. All rights reserved. + * Code provided under the BSD License: + * http://schillmania.com/projects/soundmanager2/license.txt + * + * V2.97a.20101010 + */ + +/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, regexp: true, newcap: true, immed: true, regexp: false */ +/*global window, SM2_DEFER, sm2Debugger, alert, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */ + +(function(window) { + +var soundManager = null; + +function SoundManager(smURL, smID) { + + this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9. + this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured) + this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues + this.useConsole = true; // use firebug/safari console.log()-type debug console if available + this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug + this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload() + this.nullURL = 'about:blank'; // path to "null" (empty) MP3 file, used to unload sounds (Flash 8 only) + this.allowPolling = true; // allow flash to poll for status update (required for whileplaying() events, peak, sound spectrum functions to work.) + this.useFastPolling = false; // uses lower flash timer interval for higher callback frequency, best combined with useHighPerformance + this.useMovieStar = true; // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio formats (AAC, M4V, FLV, MOV etc.) + this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000' + this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag + this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity) + this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top) + this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain' + this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable. + this.useHTML5Audio = false; // Beta feature: Use HTML 5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible. + this.html5Test = /^probably$/i; // HTML5 Audio().canPlayType() test. /^(probably|maybe)$/i if you want to be more liberal/risky. + this.ondebuglog = false; // callback made with each log message, regardless of debugMode + + this.audioFormats = { + // determines HTML5 support, flash requirements + // eg. if MP3 or MP4 required, Flash fallback is used if HTML5 can't play it + // shotgun approach to MIME testing due to browser variance + 'mp3': { + 'type': ['audio/mpeg; codecs="mp3"','audio/mpeg','audio/mp3','audio/MPA','audio/mpa-robust'], + 'required': true + }, + 'mp4': { + 'related': ['aac','m4a'], // additional formats under the MP4 container + 'type': ['audio/mp4; codecs="mp4a.40.2"','audio/aac','audio/x-m4a','audio/MP4A-LATM','audio/mpeg4-generic'], + 'required': true + }, + 'ogg': { + 'type': ['audio/ogg; codecs=vorbis'], + 'required': false + }, + 'wav': { + 'type': ['audio/wav; codecs="1"','audio/wav','audio/wave','audio/x-wav'], + 'required': false + } + }; + + this.defaultOptions = { + 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can) + 'stream': true, // allows playing before entire file has loaded (recommended) + 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true) + 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0) + 'onid3': null, // callback function for "ID3 data is added/available" + 'onload': null, // callback function for "load finished" + 'whileloading': null, // callback function for "download progress update" (X of Y bytes received) + 'onplay': null, // callback for "play" start + 'onpause': null, // callback for "pause" + 'onresume': null, // callback for "resume" (pause toggle) + 'whileplaying': null, // callback during play (position update) + 'onstop': null, // callback for "user stop" + 'onfailure': null, // callback function for when playing fails + 'onfinish': null, // callback function for "sound finished playing" + 'onbeforefinish': null, // callback for "before sound finished playing (at [time])" + 'onbeforefinishtime': 5000, // offset (milliseconds) before end of sound to trigger beforefinish (eg. 1000 msec = 1 second) + 'onbeforefinishcomplete': null,// function to call when said sound finishes playing + 'onjustbeforefinish': null, // callback for [n] msec before end of current sound + 'onjustbeforefinishtime': 200, // [n] - if not using, set to 0 (or null handler) and event will not fire. + 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time + 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled + 'position': null, // offset (milliseconds) to seek to within loaded sound data. + 'pan': 0, // "pan" settings, left-to-right, -100 to 100 + '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. + }; + + this.flash9Options = { // flash 9-only options, merged into defaultOptions if flash 9 is being used + '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: CPU-INTENSIVE: 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) + 'onstats': null // callback for when connection & play times have been measured + }; + + this.movieStarOptions = { // flash 9.0r115+ MPEG4 audio options, merged into defaultOptions if flash 9+movieStar mode is enabled + 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.) + 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants + 'onconnect': null, // rtmp: callback for connection to flash media server + 'bufferTimes': null, // array of buffer sizes to use. Size increases as buffer fills up. + 'duration': null // rtmp: song duration (msec) + }; + + this.version = null; + this.versionNumber = 'V2.97a.20101010'; + this.movieURL = null; + this.url = (smURL || null); + this.altURL = null; + this.swfLoaded = false; + this.enabled = false; + this.o = null; + this.movieID = 'sm2-container'; + this.id = (smID || 'sm2movie'); + this.swfCSS = { + 'swfBox': 'sm2-object-box', + 'swfDefault': 'movieContainer', + 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error) + 'swfTimedout': 'swf_timedout', + 'swfUnblocked': 'swf_unblocked', // or loaded OK + 'sm2Debug': 'sm2_debug', + 'highPerf': 'high_performance', + 'flashDebug': 'flash_debug' + }; + this.oMC = null; + this.sounds = {}; + this.soundIDs = []; + this.muted = false; + this.debugID = 'soundmanager-debug'; + this.debugURLParam = /([#?&])debug=1/i; + this.specialWmodeCase = false; + this.didFlashBlock = false; + + this.filePattern = null; + this.filePatterns = { + 'flash8': /\.mp3(\?.*)?$/i, + 'flash9': /\.mp3(\?.*)?$/i + }; + + this.baseMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3 + this.netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3, mp4, aac etc. + this.netStreamTypes = ['aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2']; // Flash v9.0r115+ "moviestar" formats + this.netStreamPattern = new RegExp('\\.(' + this.netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); + this.mimePattern = this.baseMimeTypes; + + this.features = { + 'buffering': false, + 'peakData': false, + 'waveformData': false, + 'eqData': false, + 'movieStar': false + }; + + this.sandbox = { + // + 'type': null, + 'types': { + 'remote': 'remote (domain-based) rules', + 'localWithFile': 'local with file access (no internet access)', + 'localWithNetwork': 'local with network (internet access only, no local access)', + 'localTrusted': 'local, trusted (local+internet access)' + }, + 'description': null, + 'noRemote': null, + 'noLocal': null + // + }; + + this.hasHTML5 = null; // switch for handling logic + this.html5 = { // stores canPlayType() results, etc. treat as read-only. + // mp3: boolean + // mp4: boolean + 'usingFlash': null // set if/when flash fallback is needed + }; + this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?) + + // --- private SM2 internals --- + + var SMSound, + _s = this, _sm = 'soundManager', _id, _ua = navigator.userAgent, _wl = window.location.href.toString(), _fV = this.flashVersion, _doc = document, _win = window, _doNothing, _init, _onready = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnReady, _processOnReady, _initUserOnload, _go, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _beginInit, _strings, _initMovie, _dcLoaded, _didDCLoaded, _getDocument, _createMovie, _die, _mobileFlash, _setPolling, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5Only = false, _html5CanPlay, _html5Ext, _dcIE, _testHTML5, _addEvt, _removeEvt, _slice = Array.prototype.slice, + _is_pre = _ua.match(/pre\//i), + _iPadOrPhone = _ua.match(/(ipad|iphone)/i), + _isMobile = (_ua.match(/mobile/i) || _is_pre || _iPadOrPhone), + _isIE = (_ua.match(/MSIE/i)), + _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), + _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), + _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), + _tryInitOnFocus = (typeof _doc.hasFocus === 'undefined' && _isSafari), + _okToDisable = !_tryInitOnFocus; + + this._use_maybe = (_wl.match(/sm2\-useHTML5Maybe\=1/i)); // temporary feature: #sm2-useHTML5Maybe=1 forces loose canPlay() check + this._overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null); + this.useAltURL = !this._overHTTP; // use altURL if not "online" + + if (_iPadOrPhone || _is_pre) { + // might as well force it on Apple + Palm, flash support unlikely + _s.useHTML5Audio = true; + _s.ignoreFlash = true; + } + + if (_is_pre || this._use_maybe) { + // less-strict canPlayType() checking option + _s.html5Test = /^(probably|maybe)$/i; + } + + // Temporary feature: allow force of HTML5 via URL: #sm2-usehtml5audio=0 or 1 + // + (function(){ + var a = '#sm2-usehtml5audio=', l = _wl, b = null; + if (l.indexOf(a) !== -1) { + b = (l.substr(l.indexOf(a)+a.length) === '1'); + if (typeof console !== 'undefined' && typeof console.log !== 'undefined') { + console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter'); + } + _s.useHTML5Audio = b; + } + }()); + // + + // --- public API methods --- + + this.supported = function() { + return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5)); + }; + + this.getMovie = function(smID) { + return _isIE?_win[smID]:(_isSafari?_id(smID) || _doc[smID]:_id(smID)); + }; + + this.loadFromXML = function(sXmlUrl) { + try { + _s.o._loadFromXML(sXmlUrl); + } catch(e) { + _failSafely(); + } + return true; + }; + + this.createSound = function(oOptions) { + var _cs = 'soundManager.createSound(): ', + thisOptions = null, oSound = null, _tO = null; + if (!_didInit || !_s.supported()) { + _complain(_cs + _str(!_didInit?'notReady':'notOK')); + return false; + } + if (arguments.length === 2) { + // function overloading in JS! :) ..assume simple createSound(id,url) use case + oOptions = { + 'id': arguments[0], + 'url': arguments[1] + }; + } + thisOptions = _mixin(oOptions); // inherit from defaultOptions + _tO = thisOptions; // alias + // + if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) { + _s._wD(_cs + _str('badID', _tO.id), 2); + } + _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1); + // + if (_idCheck(_tO.id, true)) { + _s._wD(_cs + _tO.id + ' exists', 1); + return _s.sounds[_tO.id]; + } + + function make() { + thisOptions = _loopFix(thisOptions); + _s.sounds[_tO.id] = new SMSound(_tO); + _s.soundIDs.push(_tO.id); + return _s.sounds[_tO.id]; + } + + if (_html5OK(_tO)) { + oSound = make(); + _s._wD('Loading sound '+_tO.id+' from HTML5'); + oSound._setup_html5(_tO); + } else { + if (_fV > 8 && _s.useMovieStar) { + if (_tO.isMovieStar === null) { + _tO.isMovieStar = ((_tO.serverURL || (_tO.type?_tO.type.match(_s.netStreamPattern):false)||_tO.url.match(_s.netStreamPattern))?true:false); + } + if (_tO.isMovieStar) { + _s._wD(_cs + 'using MovieStar handling'); + } + if (_tO.isMovieStar) { + if (_tO.usePeakData) { + _wDS('noPeak'); + _tO.usePeakData = false; + } + if (_tO.loops > 1) { + _wDS('noNSLoop'); + } + } + } + _tO = _policyFix(_tO, _cs); + oSound = make(); + if (_fV === 8) { + _s.o._createSound(_tO.id, _tO.onjustbeforefinishtime, _tO.loops||1, _tO.usePolicyFile); + } else { + _s.o._createSound(_tO.id, _tO.url, _tO.onjustbeforefinishtime, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.bufferTimes, _tO.onstats ? true : false, _tO.autoLoad, _tO.usePolicyFile); + if (!_tO.serverURL) { + // We are connected immediately + oSound.connected = true; + if (_tO.onconnect) { + _tO.onconnect.apply(oSound); + } + } + } + } + if (_tO.autoLoad || _tO.autoPlay) { + if (oSound) { + if (_s.isHTML5) { + oSound.autobuffer = 'auto'; // early HTML5 implementation (non-standard) + oSound.preload = 'auto'; // standard + } else { + oSound.load(_tO); + } + } + } + if (_tO.autoPlay) { + oSound.play(); + } + return oSound; + }; + + this.destroySound = function(sID, _bFromSound) { + // explicitly destroy a sound before normal page unload, etc. + if (!_idCheck(sID)) { + return false; + } + var oS = _s.sounds[sID], i; + oS._iO = {}; // Disable all callbacks while the sound is being destroyed + oS.stop(); + oS.unload(); + for (i = 0; i < _s.soundIDs.length; i++) { + if (_s.soundIDs[i] === sID) { + _s.soundIDs.splice(i, 1); + break; + } + } + if (!_bFromSound) { + // ignore if being called from SMSound instance + oS.destruct(true); + } + oS = null; + delete _s.sounds[sID]; + return true; + }; + + this.load = function(sID, oOptions) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].load(oOptions); + }; + + this.unload = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].unload(); + }; + + this.play = function(sID, oOptions) { + var fN = 'soundManager.play(): '; + if (!_didInit || !_s.supported()) { + _complain(fN + _str(!_didInit?'notReady':'notOK')); + return false; + } + if (!_idCheck(sID)) { + if (!(oOptions instanceof Object)) { + oOptions = { + url: oOptions + }; // overloading use case: play('mySound','/path/to/some.mp3'); + } + if (oOptions && oOptions.url) { + // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'}); + _s._wD(fN + 'attempting to create "' + sID + '"', 1); + oOptions.id = sID; + return _s.createSound(oOptions).play(); + } else { + return false; + } + } + return _s.sounds[sID].play(oOptions); + }; + + this.start = this.play; // just for convenience + + this.setPosition = function(sID, nMsecOffset) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].setPosition(nMsecOffset); + }; + + this.stop = function(sID) { + if (!_idCheck(sID)) { + return false; + } + _s._wD('soundManager.stop(' + sID + ')', 1); + return _s.sounds[sID].stop(); + }; + + this.stopAll = function() { + _s._wD('soundManager.stopAll()', 1); + for (var oSound in _s.sounds) { + if (_s.sounds[oSound] instanceof SMSound) { + _s.sounds[oSound].stop(); // apply only to sound objects + } + } + }; + + this.pause = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].pause(); + }; + + this.pauseAll = function() { + for (var i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].pause(); + } + }; + + this.resume = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].resume(); + }; + + this.resumeAll = function() { + for (var i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].resume(); + } + }; + + this.togglePause = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].togglePause(); + }; + + this.setPan = function(sID, nPan) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].setPan(nPan); + }; + + this.setVolume = function(sID, nVol) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].setVolume(nVol); + }; + + this.mute = function(sID) { + var fN = 'soundManager.mute(): ', + i = 0; + if (typeof sID !== 'string') { + sID = null; + } + if (!sID) { + _s._wD(fN + 'Muting all sounds'); + for (i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].mute(); + } + _s.muted = true; + } else { + if (!_idCheck(sID)) { + return false; + } + _s._wD(fN + 'Muting "' + sID + '"'); + return _s.sounds[sID].mute(); + } + return true; + }; + + this.muteAll = function() { + _s.mute(); + }; + + this.unmute = function(sID) { + var fN = 'soundManager.unmute(): ', i; + if (typeof sID !== 'string') { + sID = null; + } + if (!sID) { + _s._wD(fN + 'Unmuting all sounds'); + for (i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].unmute(); + } + _s.muted = false; + } else { + if (!_idCheck(sID)) { + return false; + } + _s._wD(fN + 'Unmuting "' + sID + '"'); + return _s.sounds[sID].unmute(); + } + return true; + }; + + this.unmuteAll = function() { + _s.unmute(); + }; + + this.toggleMute = function(sID) { + if (!_idCheck(sID)) { + return false; + } + return _s.sounds[sID].toggleMute(); + }; + + this.getMemoryUse = function() { + if (_fV === 8) { + return 0; + } + if (_s.o) { + return parseInt(_s.o._getMemoryUse(), 10); + } + }; + + this.disable = function(bNoDisable) { + // destroy all functions + if (typeof bNoDisable === 'undefined') { + bNoDisable = false; + } + if (_disabled) { + return false; + } + _disabled = true; + _wDS('shutdown', 1); + for (var i = _s.soundIDs.length; i--;) { + _disableObject(_s.sounds[_s.soundIDs[i]]); + } + _initComplete(bNoDisable); // fire "complete", despite fail + _removeEvt(_win, 'load', _initUserOnload); + return true; + }; + + this.canPlayMIME = function(sMIME) { + var result; + if (_s.hasHTML5) { + result = _html5CanPlay({type:sMIME}); + } + if (!_needsFlash || result) { + // no flash, or OK + return result; + } else { + return (sMIME?(sMIME.match(_s.mimePattern)?true:false):null); + } + }; + + this.canPlayURL = function(sURL) { + var result; + if (_s.hasHTML5) { + result = _html5CanPlay(sURL); + } + if (!_needsFlash || result) { + // no flash, or OK + return result; + } else { + return (sURL?(sURL.match(_s.filePattern)?true:false):null); + } + }; + + this.canPlayLink = function(oLink) { + if (typeof oLink.type !== 'undefined' && oLink.type) { + if (_s.canPlayMIME(oLink.type)) { + return true; + } + } + return _s.canPlayURL(oLink.href); + }; + + this.getSoundById = function(sID, suppressDebug) { + if (!sID) { + throw new Error('SoundManager.getSoundById(): sID is null/undefined'); + } + var result = _s.sounds[sID]; + if (!result && !suppressDebug) { + _s._wD('"' + sID + '" is an invalid sound ID.', 2); + } + return result; + }; + + this.onready = function(oMethod, oScope) { + if (oMethod && oMethod instanceof Function) { + if (_didInit) { + _wDS('queue'); + } + if (!oScope) { + oScope = _win; + } + _addOnReady(oMethod, oScope); + _processOnReady(); + return true; + } else { + throw _str('needFunction'); + } + }; + + this.getMoviePercent = function() { + return (_s.o && typeof _s.o.PercentLoaded !== 'undefined'?_s.o.PercentLoaded():null); + }; + + this._writeDebug = function(sText, sType, bTimestamp) { + // If the debug log callback is set, always call it, regardless of debugMode + if (_s.ondebuglog) { + _s.ondebuglog(sText, sType, bTimestamp); + } + // pseudo-private console.log()-style output + // + var sDID = 'soundmanager-debug', o, oItem, sMethod; + if (!_s.debugMode) { + return false; + } + if (typeof bTimestamp !== 'undefined' && bTimestamp) { + sText = sText + ' | ' + new Date().getTime(); + } + if (_hasConsole && _s.useConsole) { + sMethod = _debugLevels[sType]; + if (typeof console[sMethod] !== 'undefined') { + console[sMethod](sText); + } else { + console.log(sText); + } + if (_s.useConsoleOnly) { + return true; + } + } + try { + o = _id(sDID); + if (!o) { + return false; + } + oItem = _doc.createElement('div'); + if (++_wdCount % 2 === 0) { + oItem.className = 'sm2-alt'; + } + if (typeof sType === 'undefined') { + sType = 0; + } else { + sType = parseInt(sType, 10); + } + oItem.appendChild(_doc.createTextNode(sText)); + if (sType) { + if (sType >= 2) { + oItem.style.fontWeight = 'bold'; + } + if (sType === 3) { + oItem.style.color = '#ff3333'; + } + } + // o.appendChild(oItem); // top-to-bottom + o.insertBefore(oItem, o.firstChild); // bottom-to-top + } catch(e) { + // oh well + } + o = null; + // + return true; + }; + this._wD = this._writeDebug; // alias + + this._debug = function() { + // + _wDS('currentObj', 1); + for (var i = 0, j = _s.soundIDs.length; i < j; i++) { + _s.sounds[_s.soundIDs[i]]._debug(); + } + // + }; + + this.reboot = function() { + // attempt to reset and init SM2 + _s._wD('soundManager.reboot()'); + if (_s.soundIDs.length) { + _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...'); + } + for (var i = _s.soundIDs.length; i--;) { + _s.sounds[_s.soundIDs[i]].destruct(); + } + // trash ze flash + try { + if (_isIE) { + _oRemovedHTML = _s.o.innerHTML; + } + _oRemoved = _s.o.parentNode.removeChild(_s.o); + _s._wD('Flash movie removed.'); + } catch(e) { + // uh-oh. + _wDS('badRemove', 2); + } + // actually, force recreate of movie. + _oRemovedHTML = _oRemoved = null; + _s.enabled = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false; + _s.soundIDs = _s.sounds = []; + _s.o = null; + for (i = _onready.length; i--;) { + _onready[i].fired = false; + } + _s._wD(_sm + ': Rebooting...'); + _win.setTimeout(function() { + _s.beginDelayedInit(); + }, 20); + }; + + this.destruct = function() { + _s._wD('soundManager.destruct()'); + _s.disable(true); + }; + + this.beginDelayedInit = function() { + // _s._wD('soundManager.beginDelayedInit()'); + _windowLoaded = true; + _dcLoaded(); + setTimeout(_beginInit, 20); + _delayWaitForEI(); + }; + + // --- SMSound (sound object) instance --- + + SMSound = function(oOptions) { + var _t = this, _resetProperties, _add_html5_events, _stop_html5_timer, _start_html5_timer, _get_html5_duration, _a; + this.sID = oOptions.id; + this.url = oOptions.url; + this.options = _mixin(oOptions); + this.instanceOptions = this.options; // per-play-instance-specific options + this._iO = this.instanceOptions; // short alias + // assign property defaults + this.pan = this.options.pan; + this.volume = this.options.volume; + this._lastURL = null; + this.isHTML5 = false; + + // --- public methods --- + + this.id3 = {}; + + this._debug = function() { + // + // pseudo-private console.log()-style output + if (_s.debugMode) { + var stuff = null, msg = [], sF, sfBracket, maxLength = 64; + for (stuff in _t.options) { + if (_t.options[stuff] !== null) { + if (_t.options[stuff] instanceof Function) { + // handle functions specially + sF = _t.options[stuff].toString(); + sF = sF.replace(/\s\s+/g, ' '); // normalize spaces + sfBracket = sF.indexOf('{'); + msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }'); + } else { + msg.push(' ' + stuff + ': ' + _t.options[stuff]); + } + } + } + _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}'); + } + // + }; + + this._debug(); + + this.load = function(oOptions) { + var oS = null; + if (typeof oOptions !== 'undefined') { + _t._iO = _mixin(oOptions); + _t.instanceOptions = _t._iO; + } else { + oOptions = _t.options; + _t._iO = oOptions; + _t.instanceOptions = _t._iO; + if (_t._lastURL && _t._lastURL !== _t.url) { + _wDS('manURL'); + _t._iO.url = _t.url; + _t.url = null; + } + } + _s._wD('soundManager.load(): ' + _t._iO.url, 1); + if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) { + _wDS('onURL', 1); + return _t; + } + _t._lastURL = _t.url; + _t.loaded = false; + _t.readyState = 1; + _t.playState = 0; + if (_html5OK(_t._iO)) { + _s._wD('HTML 5 load: '+_t._iO.url); + oS = _t._setup_html5(_t._iO); + oS.load(); + if (_t._iO.autoPlay) { + _t.play(); + } + } else { + try { + _t.isHTML5 = false; + _t._iO = _policyFix(_loopFix(_t._iO)); + if (_fV === 8) { + _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile); + } else { + _s.o._load(_t.sID, _t._iO.url, _t._iO.stream?true:false, _t._iO.autoPlay?true:false, _t._iO.loops||1, _t._iO.autoLoad?true:false, _t._iO.usePolicyFile); + } + } catch(e) { + _wDS('smError', 2); + _debugTS('onload', false); + _die(); + } + } + return _t; + }; + + this.unload = function() { + // Flash 8/AS2 can't "close" a stream - fake it by loading an empty MP3 + // Flash 9/AS3: Close stream, preventing further load + if (_t.readyState !== 0) { + _s._wD('SMSound.unload(): "' + _t.sID + '"'); + if (!_t.isHTML5) { + if (_fV === 8) { + _s.o._unload(_t.sID, _s.nullURL); + } else { + _s.o._unload(_t.sID); + } + } else { + _stop_html5_timer(); + if (_a) { + // abort()-style method here, stop loading? (doesn't exist?) + _a.pause(); + _a.src = _s.nullURL; // needed? does nulling object work? any better way to cancel/unload/abort? + _a.load(); + _t._audio = null; + _a = null; + // delete _t._audio; + } + } + // reset load/status flags + _resetProperties(); + } + return _t; + }; + + this.destruct = function(_bFromSM) { + _s._wD('SMSound.destruct(): "' + _t.sID + '"'); + if (!_t.isHTML5) { + // kill sound within Flash + // Disable the onfailure handler + _t._iO.onfailure = null; + _s.o._destroySound(_t.sID); + } else { + _stop_html5_timer(); + if (_a) { + _a.pause(); + _a.src = 'about:blank'; + _a.load(); + _t._audio = null; + _a = null; + // delete _t._audio; + } + } + if (!_bFromSM) { + _s.destroySound(_t.sID, true); // ensure deletion from controller + } + }; + + this.play = function(oOptions, _updatePlayState) { + var fN = 'SMSound.play(): ', allowMulti; + _updatePlayState = (typeof _updatePlayState === 'undefined' ? true : _updatePlayState); + if (!oOptions) { + oOptions = {}; + } + _t._iO = _mixin(oOptions, _t._iO); + _t._iO = _mixin(_t._iO, _t.options); + _t.instanceOptions = _t._iO; + if (_t._iO.serverURL) { + if (!_t.connected) { + if (!_t.getAutoPlay()) { + _s._wD(fN+' Netstream not connected yet - setting autoPlay'); + _t.setAutoPlay(true); + } + return _t; + } + } + if (_html5OK(_t._iO)) { + _t._setup_html5(_t._iO); + _start_html5_timer(); + } + // KJV paused sounds have playState 1. We want these sounds to play. + if (_t.playState === 1 && !_t.paused) { + allowMulti = _t._iO.multiShot; + if (!allowMulti) { + _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1); + return _t; + } else { + _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1); + if (_t.isHTML5) { + // TODO: BUG? + _t.setPosition(_t._iO.position); + } + } + } + if (!_t.loaded) { + if (_t.readyState === 0) { + _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1); + // try to get this sound playing ASAP + if (!_t.isHTML5) { + if (!_t._iO.serverURL) { + _t._iO.autoPlay = true; + _t.load(_t._iO); + } + } else { + _t.load(_t._iO); + _t.readyState = 1; + } + } else if (_t.readyState === 2) { + _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2); + return _t; + } else { + _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1); + } + } else { + _s._wD(fN + '"' + _t.sID + '"'); + } + // Streams will pause when their buffer is full if they are not auto-playing. + // In this case paused is true, but the song hasn't started playing yet. If + // we just call resume() the onplay() callback will never be called. + + // Also, if we just call resume() in this case and the sound has been muted + // (volume is 0), it will never have its volume set so sound will be heard + // when it shouldn't. + if (_t.paused && _t.position && _t.position > 0) { // https://gist.github.com/37b17df75cc4d7a90bf6 + _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1); + _t.resume(); + } else { + _s._wD(fN+'"'+ _t.sID+'" is starting to play'); + _t.playState = 1; + _t.paused = false; + if (!_t.instanceCount || _t._iO.multiShotEvents || (_fV > 8 && !_t.isHTML5 && !_t.getAutoPlay())) { + _t.instanceCount++; + } + _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0); + _t._iO = _policyFix(_loopFix(_t._iO)); + if (_t._iO.onplay && _updatePlayState) { + _t._iO.onplay.apply(_t); + } + _t.setVolume(_t._iO.volume, true); + _t.setPan(_t._iO.pan, true); + if (!_t.isHTML5) { + _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t.position:_t.position / 1000)); + } else { + _start_html5_timer(); + _t._setup_html5().play(); + } + } + return _t; + }; + + this.start = this.play; // just for convenience + + this.stop = function(bAll) { + if (_t.playState === 1) { + _t._onbufferchange(0); + _t.resetOnPosition(0); + if (!_t.isHTML5) { + _t.playState = 0; + } + _t.paused = false; + if (_t._iO.onstop) { + _t._iO.onstop.apply(_t); + } + if (!_t.isHTML5) { + _s.o._stop(_t.sID, bAll); + // hack for netStream: just unload + if (_t._iO.serverURL) { + _t.unload(); + } + } else { + if (_a) { + _t.setPosition(0); // act like Flash, though + _a.pause(); // html5 has no stop() + _t.playState = 0; + _t._onTimer(); // and update UI + _stop_html5_timer(); + _t.unload(); + } + } + _t.instanceCount = 0; + _t._iO = {}; + } + return _t; + }; + + this.setAutoPlay = function(autoPlay) { + _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off')); + _t._iO.autoPlay = autoPlay; + _s.o._setAutoPlay(_t.sID, autoPlay); + if (autoPlay) { + // KJV Only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP) + if (!_t.instanceCount && _t.readyState === 1) { + _t.instanceCount++; + _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount); + } + } + }; + + this.getAutoPlay = function() { + return _t._iO.autoPlay; + }; + + this.setPosition = function(nMsecOffset, bNoDebug) { + if (nMsecOffset === undefined) { + nMsecOffset = 0; + } + // KJV Use the duration from the instance options, if we don't have a track duration yet. + // Auto-loading streams with a starting position in their options will start playing + // as soon as they connect. In the start() call we set the position on the stream, + // but because the stream hasn't played _t.duration won't have been set (that is + // done in whileloading()). So if we don't have a duration yet, use the duration + // from the instance options, if available. + var position, offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); // position >= 0 and <= current available (loaded) duration + _t.position = offset; + _t.resetOnPosition(_t.position); + if (!_t.isHTML5) { + position = _fV === 9 ? _t.position : _t.position / 1000; + // KJV We want our sounds to play on seek. A progressive download that + // is loaded has paused = false so resume() does nothing and the sound + // doesn't play. Handle that case here. + if (_t.playState === 0) { + _t.play({ position: position }); + } else { + _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); // if paused or not playing, will not resume (by playing) + // if (_t.paused) { + // _t.resume(); + // } + } + } else if (_a) { + _s._wD('setPosition(): setting position to '+(_t.position / 1000)); + if (_t.playState) { + // DOM/JS errors/exceptions to watch out for: + // if seek is beyond (loaded?) position, "DOM exception 11" + // "INDEX_SIZE_ERR": DOM exception 1 + try { + _a.currentTime = _t.position / 1000; + } catch(e) { + _s._wD('setPosition('+_t.position+'): WARN: Caught exception: '+e.message, 2); + } + } else { + _s._wD('HTML 5 warning: cannot set position while playState == 0 (not playing)',2); + } + if (_t.paused) { // if paused, refresh UI right away + _t._onTimer(true); // force update + if (_t._iO.useMovieStar) { + _t.resume(); + } + } + } + return _t; + }; + + this.pause = function(bCallFlash) { + if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) { + return _t; + } + _s._wD('SMSound.pause()'); + _t.paused = true; + if (!_t.isHTML5) { + if (bCallFlash || bCallFlash === undefined) { + _s.o._pause(_t.sID); + } + } else { + _t._setup_html5().pause(); + _stop_html5_timer(); + } + if (_t._iO.onpause) { + _t._iO.onpause.apply(_t); + } + return _t; + }; + + this.resume = function() { + // When auto-loaded streams pause on buffer full they have a playState of 0. + // We need to make sure that the playState is set to 1 when these streams "resume". + if (!_t.paused) { + return _t; + } + _s._wD('SMSound.resume()'); + _t.paused = false; + _t.playState = 1; // TODO: verify that this is needed. + if (!_t.isHTML5) { + _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume) + } else { + _t._setup_html5().play(); + _start_html5_timer(); + } + if (_t._iO.onresume) { + _t._iO.onresume.apply(_t); + } + return _t; + }; + + this.togglePause = function() { + _s._wD('SMSound.togglePause()'); + if (_t.playState === 0) { + _t.play({ + position: (_fV === 9 && !_t.isHTML5 ? _t.position:_t.position / 1000) + }); + return _t; + } + if (_t.paused) { + _t.resume(); + } else { + _t.pause(); + } + return _t; + }; + + this.setPan = function(nPan, bInstanceOnly) { + if (typeof nPan === 'undefined') { + nPan = 0; + } + if (typeof bInstanceOnly === 'undefined') { + bInstanceOnly = false; + } + if (!_t.isHTML5) { + _s.o._setPan(_t.sID, nPan); + } // else { no HTML5 pan? } + _t._iO.pan = nPan; + if (!bInstanceOnly) { + _t.pan = nPan; + } + return _t; + }; + + this.setVolume = function(nVol, bInstanceOnly) { + if (typeof nVol === 'undefined') { + nVol = 100; + } + if (typeof bInstanceOnly === 'undefined') { + bInstanceOnly = false; + } + if (!_t.isHTML5) { + _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); + } else if (_a) { + _a.volume = nVol/100; + } + _t._iO.volume = nVol; + if (!bInstanceOnly) { + _t.volume = nVol; + } + return _t; + }; + + this.mute = function() { + _t.muted = true; + if (!_t.isHTML5) { + _s.o._setVolume(_t.sID, 0); + } else if (_a) { + _a.muted = true; + } + return _t; + }; + + this.unmute = function() { + _t.muted = false; + var hasIO = typeof _t._iO.volume !== 'undefined'; + if (!_t.isHTML5) { + _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); + } else if (_a) { + _a.muted = false; + } + return _t; + }; + + this.toggleMute = function() { + return (_t.muted?_t.unmute():_t.mute()); + }; + + this.onposition = function(nPosition, oMethod, oScope) { + // TODO: allow for ranges, too? eg. (nPosition instanceof Array) + _t._onPositionItems.push({ + position: nPosition, + method: oMethod, + scope: (typeof oScope !== 'undefined'?oScope:_t), + fired: false + }); + return _t; + }; + + this.processOnPosition = function() { + var i, item, j = _t._onPositionItems.length; + if (!j || !_t.playState || _t._onPositionFired >= j) { + return false; + } + for (i=j; i--;) { + item = _t._onPositionItems[i]; + if (!item.fired && _t.position >= item.position) { + item.method.apply(item.scope,[item.position]); + item.fired = true; + _s._onPositionFired++; + } + } + return true; + }; + + this.resetOnPosition = function(nPosition) { + // reset "fired" for items interested in this position + var i, item, j = _t._onPositionItems.length; + if (!j) { + return false; + } + for (i=j; i--;) { + item = _t._onPositionItems[i]; + if (item.fired && nPosition <= item.position) { + item.fired = false; + _s._onPositionFired--; + } + } + return true; + }; + + // pseudo-private soundManager reference + + this._onTimer = function(bForce) { + // HTML 5-only _whileplaying() etc. + var time, x = {}; + if (_t._hasTimer || bForce) { + if (_a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { // TODO: May not need to track readyState (1 = loading) + _t.duration = _get_html5_duration(); + _t.durationEstimate = _t.duration; + time = _a.currentTime?_a.currentTime*1000:0; + _t._whileplaying(time,x,x,x,x); + return true; + } else { + _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK')); + return false; + } + } + }; + + // --- private internals --- + + _get_html5_duration = function() { + var d = (_a?_a.duration*1000:undefined); + return (d && !isNaN(d)?d:null); + }; + + _start_html5_timer = function() { + if (_t.isHTML5) { + _startTimer(_t); + } + }; + + _stop_html5_timer = function() { + if (_t.isHTML5) { + _stopTimer(_t); + } + }; + + _resetProperties = function(bLoaded) { + _t._onPositionItems = []; + _t._onPositionFired = 0; + _t._hasTimer = null; + _t._added_events = null; + _t._audio = null; + _a = null; + _t.bytesLoaded = null; + _t.bytesTotal = null; + _t.position = null; + _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null); + _t.durationEstimate = null; + _t.failures = 0; + _t.loaded = false; + _t.playState = 0; + _t.paused = false; + _t.readyState = 0; // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success + _t.muted = false; + _t.didBeforeFinish = false; + _t.didJustBeforeFinish = false; + _t.isBuffering = false; + _t.instanceOptions = {}; + _t.instanceCount = 0; + _t.peakData = { + left: 0, + right: 0 + }; + _t.waveformData = { + left: [], + right: [] + }; + _t.eqData = []; // legacy: 1D array + _t.eqData.left = []; + _t.eqData.right = []; + }; + + _resetProperties(); + + // pseudo-private methods used by soundManager + + this._setup_html5 = function(oOptions) { + var _iO = _mixin(_t._iO, oOptions); + if (_a) { + if (_t.url !== _iO.url) { + _s._wD('setting new URL on existing object: '+_iO.url); + _a.src = _iO.url; + } + } else { + _s._wD('creating HTML 5 audio element with URL: '+_iO.url); + _t._audio = new Audio(_iO.url); + _a = _t._audio; + _t.isHTML5 = true; + _add_html5_events(); + } + _a.loop = (_iO.loops>1?'loop':''); + return _t._audio; + }; + + // related private methods + + _add_html5_events = function() { + if (_t._added_events) { + return false; + } + _t._added_events = true; + + function _add(oEvt, oFn, bCapture) { + return (_a ? _a.addEventListener(oEvt, oFn, bCapture||false) : null); + } + + _add('load', function(e) { + _s._wD('HTML5::load: '+_t.sID); + if (_a) { + _t._onbufferchange(0); + _t._whileloading(_t.bytesTotal, _t.bytesTotal, _get_html5_duration()); + _t._onload(true); + } + }, false); + + _add('canplay', function(e) { + _s._wD('HTML5::canplay: '+_t.sID); + // enough has loaded to play + _t._onbufferchange(0); + },false); + + _add('waiting', function(e) { + _s._wD('HTML5::waiting: '+_t.sID); + // playback faster than download rate, etc. + _t._onbufferchange(1); + },false); + + _add('progress', function(e) { // not supported everywhere yet.. + _s._wD('HTML5::progress: '+_t.sID+': loaded/total: '+(e.loaded||0)+'/'+(e.total||1)); + if (!_t.loaded && _a) { + _t._onbufferchange(0); // if progress, likely not buffering + _t._whileloading(e.loaded||0, e.total||1, _get_html5_duration()); + } + }, false); + + _add('error', function(e) { + if (_a) { + _s._wD('HTML5::error: '+_a.error.code); + // call load with error state? + _t._onload(false); + } + }, false); + + _add('loadstart', function(e) { + _s._wD('HTML5::loadstart: '+_t.sID); + // assume buffering at first + _t._onbufferchange(1); + }, false); + + _add('play', function(e) { + _s._wD('HTML5::play: '+_t.sID); + // once play starts, no buffering + _t._onbufferchange(0); + }, false); + + // TODO: verify if this is actually implemented anywhere yet. + _add('playing', function(e) { + _s._wD('HTML5::playing: '+_t.sID); + // once play starts, no buffering + _t._onbufferchange(0); + }, false); + + _add('timeupdate', function(e) { + _t._onTimer(); + }, false); + + // avoid stupid premature event-firing bug in Safari(?) + setTimeout(function(){ + if (_t && _a) { + _add('ended',function(e) { + _s._wD('HTML5::ended: '+_t.sID); + _t._onfinish(); + }, false); + } + }, 250); + return true; + }; + + // --- "private" methods called by Flash --- + + this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) { + _t.bytesLoaded = nBytesLoaded; + _t.bytesTotal = nBytesTotal; + _t.duration = Math.floor(nDuration); + _t.bufferLength = nBufferLength; + if (!_t._iO.isMovieStar) { + if (_t._iO.duration) { + // use options, if specified and larger + _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration; + } else { + _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10); + } + if (_t.durationEstimate === undefined) { + _t.durationEstimate = _t.duration; + } + _t.bufferLength = nBufferLength; + if (_t.readyState !== 3 && _t._iO.whileloading) { + _t._iO.whileloading.apply(_t); + } + } else { + _t.durationEstimate = _t.duration; + if (_t.readyState !== 3 && _t._iO.whileloading) { + _t._iO.whileloading.apply(_t); + } + } + }; + + this._onid3 = function(oID3PropNames, oID3Data) { + // oID3PropNames: string array (names) + // ID3Data: string array (data) + _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.'); + var oData = [], i, j; + for (i = 0, j = oID3PropNames.length; i < j; i++) { + oData[oID3PropNames[i]] = oID3Data[i]; + } + _t.id3 = _mixin(_t.id3, oData); + if (_t._iO.onid3) { + _t._iO.onid3.apply(_t); + } + }; + + this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) { + if (isNaN(nPosition) || nPosition === null) { + return false; // Flash may return NaN at times + } + if (_t.playState === 0 && nPosition > 0) { + // invalid position edge case for end/stop + nPosition = 0; + } + _t.position = nPosition; + _t.processOnPosition(); + if (_fV > 8 && !_t.isHTML5) { + if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { + _t.peakData = { + left: oPeakData.leftPeak, + right: oPeakData.rightPeak + }; + } + if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { + _t.waveformData = { + left: oWaveformDataLeft.split(','), + right: oWaveformDataRight.split(',') + }; + } + if (_t._iO.useEQData) { + if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) { + var eqLeft = oEQData.leftEQ.split(','); + _t.eqData = eqLeft; + _t.eqData.left = eqLeft; + if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) { + _t.eqData.right = oEQData.rightEQ.split(','); + } + } + } + } + if (_t.playState === 1) { + // special case/hack: ensure buffering is false if loading from cache (and not yet started) + if (!_t.isHTML5 && _s.flashVersion === 8 && !_t.position && _t.isBuffering) { + _t._onbufferchange(0); + } + if (_t._iO.whileplaying) { + _t._iO.whileplaying.apply(_t); // flash may call after actual finish + } + if ((_t.loaded || (!_t.loaded && _t._iO.isMovieStar)) && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration - _t.position <= _t._iO.onbeforefinishtime) { + _t._onbeforefinish(); + } + } + return true; + }; + + this._onconnect = function(bSuccess) { + var fN = 'SMSound._onconnect(): '; + bSuccess = (bSuccess === 1); + _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2)); + _t.connected = bSuccess; + if (bSuccess) { + _t.failures = 0; + if (_t._iO.onconnect) { + _t._iO.onconnect.apply(_t,[bSuccess]); + } + // don't play if the sound is being destroyed + if (_idCheck(_t.sID) && (_t.options.autoLoad || _t.getAutoPlay())) { + _t.play(undefined, _t.getAutoPlay()); // only update the play state if auto playing + } + } + }; + + this._onload = function(nSuccess) { + var fN = 'SMSound._onload(): ', loadOK = (nSuccess?true:false); + _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2)); + // + if (!loadOK && !_t.isHTML5) { + if (_s.sandbox.noRemote === true) { + _s._wD(fN + _str('noNet'), 1); + } + if (_s.sandbox.noLocal === true) { + _s._wD(fN + _str('noLocal'), 1); + } + } + // + _t.loaded = loadOK; + _t.readyState = loadOK?3:2; + _t._onbufferchange(0); + if (_t._iO.onload) { + _t._iO.onload.apply(_t, [loadOK]); + } + return true; + }; + + // fire onfailure() only once at most + // at this point we just recreate failed sounds rather than trying to reconnect. + this._onfailure = function(msg, level, code) { + _t.failures++; + _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures); + if (_t._iO.onfailure && _t.failures === 1) { + _t._iO.onfailure(_t, msg, level, code); + } else { + _s._wD('SMSound._onfailure(): ignoring'); + } + }; + + this._onbeforefinish = function() { + if (!_t.didBeforeFinish) { + _t.didBeforeFinish = true; + if (_t._iO.onbeforefinish) { + _s._wD('SMSound._onbeforefinish(): "' + _t.sID + '"'); + _t._iO.onbeforefinish.apply(_t); + } + } + }; + + this._onjustbeforefinish = function(msOffset) { + if (!_t.didJustBeforeFinish) { + _t.didJustBeforeFinish = true; + if (_t._iO.onjustbeforefinish) { + _s._wD('SMSound._onjustbeforefinish(): "' + _t.sID + '"'); + _t._iO.onjustbeforefinish.apply(_t); + } + } + }; + + // KJV - connect & play time callback from Flash + this._onstats = function(stats) { + if (_t._iO.onstats) { + _t._iO.onstats(_t, stats); + } + }; + + this._onfinish = function() { + // _s._wD('SMSound._onfinish(): "' + _t.sID + '" got instanceCount '+_t.instanceCount); + _t._onbufferchange(0); + _t.resetOnPosition(0); + if (_t._iO.onbeforefinishcomplete) { + _t._iO.onbeforefinishcomplete.apply(_t); + } + // reset some state items + _t.didBeforeFinish = false; + _t.didJustBeforeFinish = false; + if (_t.instanceCount) { + _t.instanceCount--; + if (!_t.instanceCount) { + // reset instance options + _t.playState = 0; + _t.paused = false; + _t.instanceCount = 0; + _t.instanceOptions = {}; + _stop_html5_timer(); + } + if (!_t.instanceCount || _t._iO.multiShotEvents) { + // fire onfinish for last, or every instance + if (_t._iO.onfinish) { + _s._wD('SMSound._onfinish(): "' + _t.sID + '"'); + _t._iO.onfinish.apply(_t); + } + } + } + }; + + this._onbufferchange = function(nIsBuffering) { + var fN = 'SMSound._onbufferchange()'; + if (_t.playState === 0) { + // ignore if not playing + return false; + } + if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) { + return false; + } + _t.isBuffering = (nIsBuffering === 1); + if (_t._iO.onbufferchange) { + _s._wD(fN + ': ' + nIsBuffering); + _t._iO.onbufferchange.apply(_t); + } + return true; + }; + + this._ondataerror = function(sError) { + // flash 9 wave/eq data handler + if (_t.playState > 0) { // hack: called at start, and end from flash at/after onfinish() + _s._wD('SMSound._ondataerror(): ' + sError); + if (_t._iO.ondataerror) { + _t._iO.ondataerror.apply(_t); + } + } + }; + + }; // SMSound() + + // --- private SM2 internals --- + + _getDocument = function() { + return (_doc.body?_doc.body:(_doc._docElement?_doc.documentElement:_doc.getElementsByTagName('div')[0])); + }; + + _id = function(sID) { + return _doc.getElementById(sID); + }; + + _mixin = function(oMain, oAdd) { + // non-destructive merge + var o1 = {}, i, o2, o; + for (i in oMain) { // clone c1 + if (oMain.hasOwnProperty(i)) { + o1[i] = oMain[i]; + } + } + o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd); + for (o in o2) { + if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') { + o1[o] = o2[o]; + } + } + return o1; + }; + + (function() { + var old = (_win.attachEvent), + evt = { + add: (old?'attachEvent':'addEventListener'), + remove: (old?'detachEvent':'removeEventListener') + }; + + function getArgs(oArgs) { + var args = _slice.call(oArgs), len = args.length; + if (old) { + args[1] = 'on' + args[1]; // prefix + if (len > 3) { + args.pop(); // no capture + } + } else if (len === 3) { + args.push(false); + } + return args; + } + + function apply(args, sType) { + var oFunc = args.shift()[evt[sType]]; + if (old) { + oFunc(args[0], args[1]); + } else { + oFunc.apply(this, args); + } + } + + _addEvt = function() { + apply(getArgs(arguments), 'add'); + }; + + _removeEvt = function() { + apply(getArgs(arguments), 'remove'); + }; + }()); + + _html5OK = function(iO) { + return ((iO.type?_html5CanPlay({type:iO.type}):false)||_html5CanPlay(iO.url)); + }; + + _html5CanPlay = function(sURL) { + // try to find MIME, test and return truthiness + if (!_s.useHTML5Audio || !_s.hasHTML5) { + return false; + } + var result, mime, fileExt, item, aF = _s.audioFormats; + if (!_html5Ext) { + _html5Ext = []; + for (item in aF) { + if (aF.hasOwnProperty(item)) { + _html5Ext.push(item); + if (aF[item].related) { + _html5Ext = _html5Ext.concat(aF[item].related); + } + } + } + _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')','i'); + } + mime = (typeof sURL.type !== 'undefined'?sURL.type:null); + fileExt = (typeof sURL === 'string'?sURL.toLowerCase().match(_html5Ext):null); // TODO: Strip URL queries, etc. + if (!fileExt || !fileExt.length) { + if (!mime) { + return false; + } + } else { + fileExt = fileExt[0].substr(1); // "mp3", for example + } + if (fileExt && typeof _s.html5[fileExt] !== 'undefined') { + // result known + return _s.html5[fileExt]; + } else { + if (!mime) { + if (fileExt && _s.html5[fileExt]) { + return _s.html5[fileExt]; + } else { + // best-case guess, audio/whatever-dot-filename-format-you're-playing + mime = 'audio/'+fileExt; + } + } + result = _s.html5.canPlayType(mime); + _s.html5[fileExt] = result; + // _s._wD('canPlayType, found result: '+result); + return result; + } + }; + + _testHTML5 = function() { + if (!_s.useHTML5Audio || typeof Audio === 'undefined') { + return false; + } + var a = (typeof Audio !== 'undefined' ? new Audio():null), item, support = {}, aF, i; + function _cp(m) { + var canPlay, i, j, isOK = false; + if (!a || typeof a.canPlayType !== 'function') { + return false; + } + if (m instanceof Array) { + // iterate through all mime types, return any successes + for (i=0, j=m.length; i + notReady: 'Not loaded yet - wait for soundManager.onload()/onready()', + notOK: 'Audio support is not available.', + appXHTML: _sm + '::createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.', + spcWmode: _sm + '::createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue', + swf404: _sm + ': Verify that %s is a valid path.', + tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)', + checkSWF: 'See SWF output for more debug info.', + localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/', + waitFocus: _sm + ': Special case: Waiting for focus-related event..', + waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...', + waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...', + needFunction: _sm + '.onready(): Function object expected', + badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character', + noMS: 'MovieStar mode not enabled. Exiting.', + currentObj: '--- ' + _sm + '._debug(): Current sound objects ---', + waitEI: _sm + '::initMovie(): Waiting for ExternalInterface call from Flash..', + waitOnload: _sm + ': Waiting for window.onload()', + docLoaded: _sm + ': Document already loaded', + onload: _sm + '::initComplete(): calling soundManager.onload()', + onloadOK: _sm + '.onload() complete', + init: '-- ' + _sm + '::init() --', + didInit: _sm + '::init(): Already called?', + flashJS: _sm + ': Attempting to call Flash from JS..', + noPolling: _sm + ': Polling (whileloading()/whileplaying() support) is disabled.', + secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html', + badRemove: 'Warning: Failed to remove flash movie.', + noPeak: 'Warning: peakData features unsupported for movieStar formats', + shutdown: _sm + '.disable(): Shutting down', + queue: _sm + '.onready(): Queueing handler', + smFail: _sm + ': Failed to initialise.', + smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.', + fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..', + fbLoaded: 'Flash loaded', + fbHandler: 'soundManager::flashBlockHandler()', + manURL: 'SMSound.load(): Using manually-assigned URL', + onURL: _sm + '.load(): current URL already assigned.', + badFV: 'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.', + as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)', + noNSLoop: 'Note: Looping not implemented for MovieStar formats', + needfl9: 'Note: Switching to flash 9, required for MP4 formats.', + mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case', + mfOn: 'mobileFlash::enabling on-screen flash repositioning', + policy: 'Enabling usePolicyFile for data access' + // + }; + + _id = function(sID) { + return _doc.getElementById(sID); + }; + + _str = function() { // o [,items to replace] + // + var args = _slice.call(arguments), // real array, please + o = args.shift(), // first arg + str = (_strings && _strings[o]?_strings[o]:''), i, j; + if (str && args && args.length) { + for (i = 0, j = args.length; i < j; i++) { + str = str.replace('%s', args[i]); + } + } + return str; + // + }; + + _loopFix = function(sOpt) { + // flash 8 requires stream = false for looping to work + if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) { + _wDS('as2loop'); + sOpt.stream = false; + } + return sOpt; + }; + + _policyFix = function(sOpt, sPre) { + if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) { + _s._wD((sPre?sPre+':':'') + _str('policy')); + sOpt.usePolicyFile = true; + } + return sOpt; + }; + + _complain = function(sMsg) { + if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') { + console.warn(sMsg); + } else { + _s._wD(sMsg); + } + }; + + _doNothing = function() { + return false; + }; + + _disableObject = function(o) { + for (var oProp in o) { + if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') { + o[oProp] = _doNothing; + } + } + oProp = null; + }; + + _failSafely = function(bNoDisable) { + // general failure exception handler + if (typeof bNoDisable === 'undefined') { + bNoDisable = false; + } + if (_disabled || bNoDisable) { + _wDS('smFail', 2); + _s.disable(bNoDisable); + } + }; + + _normalizeMovieURL = function(smURL) { + var urlParams = null; + if (smURL) { + if (smURL.match(/\.swf(\?\.*)?$/i)) { + urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4); + if (urlParams) { + return smURL; // assume user knows what they're doing + } + } else if (smURL.lastIndexOf('/') !== smURL.length - 1) { + smURL = smURL + '/'; + } + } + return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL; + }; + + _setVersionInfo = function() { + if (_fV !== 8 && _fV !== 9) { + _s._wD(_str('badFV', _fV, _defaultFlashVersion)); + _s.flashVersion = _defaultFlashVersion; + } + var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); // debug flash movie, if applicable + if (_s.flashVersion < 9 && _s.useHTML5Audio && _s.audioFormats.mp4.required) { + _s._wD(_str('needfl9')); + _s.flashVersion = 9; + } + _fV = _s.flashVersion; // short-hand for internal use + _s.version = _s.versionNumber + (_html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)')); + // set up default options + if (_fV > 8) { + _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options); + _s.features.buffering = true; + } + if (_fV > 8 && _s.useMovieStar) { + // flash 9+ support for movieStar formats as well as MP3 + _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions); + _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _s.netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); + _s.mimePattern = _s.netStreamMimeTypes; + _s.features.movieStar = true; + } else { + _s.features.movieStar = false; + } + _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')]; + _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf',isDebug); + _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8); + }; + + _setPolling = function(bPolling, bHighPerformance) { + if (!_s.o || !_s.allowPolling) { + return false; + } + _s.o._setPolling(bPolling, bHighPerformance); + }; + + (function() { + var old = (_win.attachEvent), + evt = { + add: (old?'attachEvent':'addEventListener'), + remove: (old?'detachEvent':'removeEventListener') + }; + + function getArgs(oArgs) { + var args = _slice.call(oArgs), len = args.length; + if (old) { + args[1] = 'on' + args[1]; // prefix + if (len > 3) { + args.pop(); // no capture + } + } else if (len === 3) { + args.push(false); + } + return args; + } + + function apply(args, sType) { + var oFunc = args.shift()[evt[sType]]; + if (old) { + oFunc(args[0], args[1]); + } else { + oFunc.apply(this, args); + } + } + + _addEvt = function() { + apply(getArgs(arguments), 'add'); + }; + + _removeEvt = function() { + apply(getArgs(arguments), 'remove'); + }; + }()); + + function _initDebug() { + if (_s.debugURLParam.test(_wl)) { + _s.debugMode = true; // allow force of debug mode via URL + } + // + if (_id(_s.debugID)) { + return false; + } + var oD, oDebug, oTarget, oToggle, tmp; + if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) { + oD = _doc.createElement('div'); + oD.id = _s.debugID + '-toggle'; + oToggle = { + 'position': 'fixed', + 'bottom': '0px', + 'right': '0px', + 'width': '1.2em', + 'height': '1.2em', + 'lineHeight': '1.2em', + 'margin': '2px', + 'textAlign': 'center', + 'border': '1px solid #999', + 'cursor': 'pointer', + 'background': '#fff', + 'color': '#333', + 'zIndex': 10001 + }; + oD.appendChild(_doc.createTextNode('-')); + oD.onclick = _toggleDebug; + oD.title = 'Toggle SM2 debug console'; + if (_ua.match(/msie 6/i)) { + oD.style.position = 'absolute'; + oD.style.cursor = 'hand'; + } + for (tmp in oToggle) { + if (oToggle.hasOwnProperty(tmp)) { + oD.style[tmp] = oToggle[tmp]; + } + } + oDebug = _doc.createElement('div'); + oDebug.id = _s.debugID; + oDebug.style.display = (_s.debugMode?'block':'none'); + if (_s.debugMode && !_id(oD.id)) { + try { + oTarget = _getDocument(); + oTarget.appendChild(oD); + } catch(e2) { + throw new Error(_str('appXHTML')); + } + oTarget.appendChild(oDebug); + } + } + oTarget = null; + // + } + + _mobileFlash = (function(){ + + var oM = null; + + function resetPosition() { + if (oM) { + oM.left = oM.top = '-9999px'; + } + } + + function reposition() { + oM.left = _win.scrollX+'px'; + oM.top = _win.scrollY+'px'; + } + + function setReposition(bOn) { + _s._wD('mobileFlash::flash on-screen hack: '+(bOn?'ON':'OFF')); + var f = _win[(bOn?'add':'remove')+'EventListener']; + f('resize', reposition, false); + f('scroll', reposition, false); + } + + function check(inDoc) { + // mobile flash (Android for starters) check + oM = _s.oMC.style; + if (_ua.match(/android/i)) { + if (inDoc) { + if (_s.flashLoadTimeout) { + _s._wDS('mfTimeout'); + _s.flashLoadTimeout = 0; + } + return false; + } + _s._wD('mfOn'); + oM.position = 'absolute'; + oM.left = oM.top = '0px'; + setReposition(true); + _s.onready(function(){ + setReposition(false); // detach + resetPosition(); // restore when OK/timed out + }); + reposition(); + } + return true; + } + + return { + 'check': check + }; + + }()); + + _createMovie = function(smID, smURL) { + + var specialCase = null, + remoteURL = (smURL?smURL:_s.url), + localURL = (_s.altURL?_s.altURL:remoteURL), + oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), s, x, sClass, side = '100%', isRTL = null, html = _doc.getElementsByTagName('html')[0]; + isRTL = (html && html.dir && html.dir.match(/rtl/i)); + smID = (typeof smID === 'undefined'?_s.id:smID); + + if (_didAppend && _appendSuccess) { + return false; // ignore if already succeeded + } + + function _initMsg() { + _s._wD('-- SoundManager 2 ' + _s.version + (!_html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (_s.useMovieStar?', MovieStar mode':'') + (_s.useHighPerformance?', high performance mode, ':', ') + ((_s.useFastPolling?'fast':'normal') + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') + ' --', 1); + } + + if (_html5Only) { + _setVersionInfo(); + _initMsg(); + _s.oMC = _id(_s.movieID); + _init(); + // prevent multiple init attempts + _didAppend = true; + _appendSuccess = true; + return false; + } + + _didAppend = true; + + // safety check for legacy (change to Flash 9 URL) + _setVersionInfo(); + _s.url = _normalizeMovieURL(this._overHTTP?remoteURL:localURL); + smURL = _s.url; + + _s.wmode = (!_s.wmode && _s.useHighPerformance && !_s.useMovieStar?'transparent':_s.wmode); + + if (_s.wmode !== null && !_isIE && !_s.useHighPerformance && navigator.platform.match(/win32/i)) { + _s.specialWmodeCase = true; + // extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here + // does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout + _wDS('spcWmode'); + _s.wmode = null; + } + + oEmbed = { + 'name': smID, + 'id': smID, + 'src': smURL, + 'width': side, + 'height': side, + 'quality': 'high', + 'allowScriptAccess': _s.allowScriptAccess, + 'bgcolor': _s.bgColor, + 'pluginspage': 'http://www.macromedia.com/go/getflashplayer', + 'type': 'application/x-shockwave-flash', + 'wmode': _s.wmode + }; + + if (_s.debugFlash) { + oEmbed.FlashVars = 'debug=1'; + } + + if (!_s.wmode) { + delete oEmbed.wmode; // don't write empty attribute + } + + if (_isIE) { + // IE is "special". + oMovie = _doc.createElement('div'); + movieHTML = '' + (_s.wmode?' ':'') + '' + (_s.debugFlash?'':'') + ''; + } else { + oMovie = _doc.createElement('embed'); + for (tmp in oEmbed) { + if (oEmbed.hasOwnProperty(tmp)) { + oMovie.setAttribute(tmp, oEmbed[tmp]); + } + } + } + + _initDebug(); + extraClass = _getSWFCSS(); + oTarget = _getDocument(); + + if (oTarget) { + _s.oMC = _id(_s.movieID)?_id(_s.movieID):_doc.createElement('div'); + if (!_s.oMC.id) { + _s.oMC.id = _s.movieID; + _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; + // "hide" flash movie + s = null; + oEl = null; + if (!_s.useFlashBlock) { + if (_s.useHighPerformance) { + s = { + 'position': 'fixed', + 'width': '8px', + 'height': '8px', + // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes. + 'bottom': '0px', + 'left': '0px', + 'overflow': 'hidden' + }; + } else { + s = { + 'position': 'absolute', + 'width': '6px', + 'height': '6px', + 'top': '-9999px', + 'left': '-9999px' + }; + if (isRTL) { + s.left = Math.abs(parseInt(s.left,10))+'px'; + } + } + } + if (_ua.match(/webkit/i)) { + _s.oMC.style.zIndex = 10000; // soundcloud-reported render/crash fix, safari 5 + } + if (!_s.debugFlash) { + for (x in s) { + if (s.hasOwnProperty(x)) { + _s.oMC.style[x] = s[x]; + } + } + } + try { + if (!_isIE) { + _s.oMC.appendChild(oMovie); + } + oTarget.appendChild(_s.oMC); + if (_isIE) { + oEl = _s.oMC.appendChild(_doc.createElement('div')); + oEl.className = _s.swfCSS.swfBox; + oEl.innerHTML = movieHTML; + } + _appendSuccess = true; + } catch(e) { + throw new Error(_str('appXHTML')); + } + _mobileFlash.check(); + } else { + // it's already in the document. + sClass = _s.oMC.className; + _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); + _s.oMC.appendChild(oMovie); + if (_isIE) { + oEl = _s.oMC.appendChild(_doc.createElement('div')); + oEl.className = _s.swfCSS.swfBox; + oEl.innerHTML = movieHTML; + } + _appendSuccess = true; + _mobileFlash.check(true); + } + } + + if (specialCase) { + _s._wD(specialCase); + } + + _initMsg(); + _s._wD('soundManager::createMovie(): Trying to load ' + smURL + (!this._overHTTP && _s.altURL?' (alternate URL)':''), 1); + + return true; + }; + + _idCheck = this.getSoundById; + + _initMovie = function() { + if (_html5Only) { + _createMovie(); + return false; + } + // attempt to get, or create, movie + if (_s.o) { + return false; // may already exist + } + _s.o = _s.getMovie(_s.id); // inline markup + if (!_s.o) { + if (!_oRemoved) { + // try to create + _createMovie(_s.id, _s.url); + } else { + // try to re-append removed movie after reboot() + if (!_isIE) { + _s.oMC.appendChild(_oRemoved); + } else { + _s.oMC.innerHTML = _oRemovedHTML; + } + _oRemoved = null; + _didAppend = true; + } + _s.o = _s.getMovie(_s.id); + } + if (_s.o) { + _s._wD('soundManager::initMovie(): Got '+_s.o.nodeName+' element ('+(_didAppend?'created via JS':'static HTML')+')'); + _wDS('waitEI'); + } + if (_s.oninitmovie instanceof Function) { + setTimeout(_s.oninitmovie, 1); + } + return true; + }; + + _go = function(sURL) { + // where it all begins. + if (sURL) { + _s.url = sURL; + } + _initMovie(); + }; + + _delayWaitForEI = function() { + setTimeout(_waitForEI, 500); + }; + + _waitForEI = function() { + if (_waitingForEI) { + return false; + } + _waitingForEI = true; + _removeEvt(_win, 'load', _delayWaitForEI); + if (_tryInitOnFocus && !_isFocused) { + _wDS('waitFocus'); + return false; + } + var p; + if (!_didInit) { + p = _s.getMoviePercent(); + _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':'')))); + } + setTimeout(function() { + p = _s.getMoviePercent(); + if (!_didInit) { + _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2); + if (!this._overHTTP && p) { + _wDS('localFail', 2); + if (!_s.debugFlash) { + _wDS('tryDebug', 2); + } + } + if (p === 0) { + // if 0 (not null), probably a 404. + _s._wD(_str('swf404', _s.url)); + } + _debugTS('flashtojs', false, ': Timed out' + this._overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)'); + } + // give up / time-out, depending + if (!_didInit && _okToDisable) { + if (p === null) { + // SWF failed. Maybe blocked. + if (_s.useFlashBlock || _s.flashLoadTimeout === 0) { + if (_s.useFlashBlock) { + _flashBlockHandler(); + } + _wDS('waitForever'); + } else { + // old SM2 behaviour, simply fail + _failSafely(true); + } + } else { + // flash loaded? Shouldn't be a blocking issue, then. + if (_s.flashLoadTimeout === 0) { + _wDS('waitForever'); + } else { + _failSafely(true); + } + } + } + }, _s.flashLoadTimeout); + }; + + _go = function(sURL) { + // where it all begins. + if (sURL) { + _s.url = sURL; + } + _initMovie(); + }; + + // + _wDS = function(o, errorLevel) { + if (!o) { + return ''; + } else { + return _s._wD(_str(o), errorLevel); + } + }; + + if (_wl.indexOf('debug=alert') + 1 && _s.debugMode) { + _s._wD = function(sText) {alert(sText);}; + } + + _toggleDebug = function() { + var o = _id(_s.debugID), + oT = _id(_s.debugID + '-toggle'); + if (!o) { + return false; + } + if (_debugOpen) { + // minimize + oT.innerHTML = '+'; + o.style.display = 'none'; + } else { + oT.innerHTML = '-'; + o.style.display = 'block'; + } + _debugOpen = !_debugOpen; + }; + + _debugTS = function(sEventType, bSuccess, sMessage) { + // troubleshooter debug hooks + if (typeof sm2Debugger !== 'undefined') { + try { + sm2Debugger.handleEvent(sEventType, bSuccess, sMessage); + } catch(e) { + // oh well + } + } + return true; + }; + // + + _getSWFCSS = function() { + var css = []; + if (_s.debugMode) { + css.push(_s.swfCSS.sm2Debug); + } + if (_s.debugFlash) { + css.push(_s.swfCSS.flashDebug); + } + if (_s.useHighPerformance) { + css.push(_s.swfCSS.highPerf); + } + return css.join(' '); + }; + + _flashBlockHandler = function() { + // *possible* flash block situation. + var name = _str('fbHandler'), p = _s.getMoviePercent(); + if (!_s.supported()) { + if (_needsFlash) { + // make the movie more visible, so user can fix + _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + ' ' + (p === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); + _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':'')); + } + _s.didFlashBlock = true; + _processOnReady(true); // fire onready(), complain lightly + if (_s.onerror instanceof Function) { + _s.onerror.apply(_win); + } + } else { + // SM2 loaded OK (or recovered) + if (_s.didFlashBlock) { + _s._wD(name+': Unblocked'); + } + if (_s.oMC) { + _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + (' '+_s.swfCSS.swfUnblocked); + } + } + }; + + _handleFocus = function() { + function cleanup() { + _removeEvt(_win, 'focus', _handleFocus); + _removeEvt(_win, 'load', _handleFocus); + } + if (_isFocused || !_tryInitOnFocus) { + cleanup(); + return true; + } + _okToDisable = true; + _isFocused = true; + _s._wD('soundManager::handleFocus()'); + if (_isSafari && _tryInitOnFocus) { + // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event + _removeEvt(_win, 'mousemove', _handleFocus); + } + // allow init to restart + _waitingForEI = false; + cleanup(); + return true; + }; + + _initComplete = function(bNoDisable) { + if (_didInit) { + return false; + } + if (_html5Only) { + // all good. + _s._wD('-- SoundManager 2: loaded --'); + _didInit = true; + _processOnReady(); + _initUserOnload(); + return true; + } + var sClass = _s.oMC.className, + wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()); + if (!wasTimeout) { + _didInit = true; + } + _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1); + if (_disabled || bNoDisable) { + if (_s.useFlashBlock) { + _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); + } + _processOnReady(); + _debugTS('onload', false); + if (_s.onerror instanceof Function) { + _s.onerror.apply(_win); + } + return false; + } else { + _debugTS('onload', true); + } + if (_s.waitForWindowLoad && !_windowLoaded) { + _wDS('waitOnload'); + _addEvt(_win, 'load', _initUserOnload); + return false; + } else { + if (_s.waitForWindowLoad && _windowLoaded) { + _wDS('docLoaded'); + } + _initUserOnload(); + } + return true; + }; + + _addOnReady = function(oMethod, oScope) { + _onready.push({ + 'method': oMethod, + 'scope': (oScope || null), + 'fired': false + }); + }; + + _processOnReady = function(ignoreInit) { + if (!_didInit && !ignoreInit) { + // not ready yet. + return false; + } + var status = { + success: (ignoreInit?_s.supported():!_disabled) + }, + queue = [], i, j, + canRetry = (!_s.useFlashBlock || (_s.useFlashBlock && !_s.supported())); + for (i = 0, j = _onready.length; i < j; i++) { + if (_onready[i].fired !== true) { + queue.push(_onready[i]); + } + } + if (queue.length) { + _s._wD(_sm + ': Firing ' + queue.length + ' onready() item' + (queue.length > 1?'s':'')); + for (i = 0, j = queue.length; i < j; i++) { + if (queue[i].scope) { + queue[i].method.apply(queue[i].scope, [status]); + } else { + queue[i].method(status); + } + if (!canRetry) { // flashblock case doesn't count here + queue[i].fired = true; + } + } + } + return true; + }; + + _initUserOnload = function() { + _win.setTimeout(function() { + if (_s.useFlashBlock) { + _flashBlockHandler(); + } + _processOnReady(); + _wDS('onload', 1); + // call user-defined "onload", scoped to window + if (_s.onload instanceof Function) { + _s.onload.apply(_win); + } + _wDS('onloadOK', 1); + if (_s.waitForWindowLoad) { + _addEvt(_win, 'load', _initUserOnload); + } + },1); + }; + + _featureCheck = function() { + var needsFlash, item, + isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_(3|4)/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Known Apple "radar" bug. https://bugs.webkit.org/show_bug.cgi?id=32159 + isSpecial = (_ua.match(/iphone os (1|2|3_0|3_1)/i)?true:false); // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works. + if (isSpecial) { + _s.hasHTML5 = false; // has Audio(), but is broken; let it load links directly. + _html5Only = true; // ignore flash case, however + if (_s.oMC) { + _s.oMC.style.display = 'none'; + } + return false; + } + if (_s.useHTML5Audio) { + if (!_s.html5 || !_s.html5.canPlayType) { + _s._wD('SoundManager: No HTML5 Audio() support detected.'); + _s.hasHTML5 = false; + return true; + } else { + _s.hasHTML5 = true; + } + if (isBadSafari) { + _s._wD('SoundManager::Note: Buggy HTML5 Audio in Safari on OS X 10.6.[3|4], see https://bugs.webkit.org/show_bug.cgi?id=32159 - disabling HTML5 audio',1); + _s.useHTML5Audio = false; + _s.hasHTML5 = false; + return true; + } + } else { + // flash required. + return true; + } + for (item in _s.audioFormats) { + if (_s.audioFormats.hasOwnProperty(item) && _s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) { + // may need flash for this format? + needsFlash = true; + } + } + // sanity check.. + if (_s.ignoreFlash) { + needsFlash = false; + } + _html5Only = (_s.useHTML5Audio && _s.hasHTML5 && !needsFlash); + return needsFlash; + }; + + _init = function() { + var item, tests = []; + _wDS('init'); + + // called after onload() + if (_didInit) { + _wDS('didInit'); + return false; + } + + function _cleanup() { + _removeEvt(_win, 'load', _s.beginDelayedInit); + } + + if (_s.hasHTML5) { + for (item in _s.audioFormats) { + if (_s.audioFormats.hasOwnProperty(item)) { + tests.push(item+': '+_s.html5[item]); + } + } + _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1); + } + + if (_html5Only) { + if (!_didInit) { + // we don't need no steenking flash! + _cleanup(); + _s.enabled = true; + _initComplete(); + } + return true; + } + + // flash path + _initMovie(); + try { + _wDS('flashJS'); + _s.o._externalInterfaceTest(false); // attempt to talk to Flash + if (!_s.allowPolling) { + _wDS('noPolling', 1); + } else { + _setPolling(true, _s.useFastPolling?true:false); + } + if (!_s.debugMode) { + _s.o._disableDebug(); + } + _s.enabled = true; + _debugTS('jstoflash', true); + } catch(e) { + _s._wD('js/flash exception: ' + e.toString()); + _debugTS('jstoflash', false); + _failSafely(true); // don't disable, for reboot() + _initComplete(); + return false; + } + _initComplete(); + // event cleanup + _cleanup(); + return true; + }; + + _beginInit = function() { + if (_initPending) { + return false; + } + _createMovie(); + _initMovie(); + _initPending = true; + return true; + }; + + _dcLoaded = function() { + if (_didDCLoaded) { + return false; + } + _didDCLoaded = true; + _initDebug(); + _testHTML5(); + _s.html5.usingFlash = _featureCheck(); + _needsFlash = _s.html5.usingFlash; + _didDCLoaded = true; + if (_doc.removeEventListener) { + _doc.removeEventListener('DOMContentLoaded', _dcLoaded, false); + } + _go(); + return true; + }; + + _startTimer = function(oSound) { + if (!oSound._hasTimer) { + oSound._hasTimer = true; + } + }; + + _stopTimer = function(oSound) { + if (oSound._hasTimer) { + oSound._hasTimer = false; + } + }; + + _die = function() { + if (_s.onerror instanceof Function) { + _s.onerror(); + } + _s.disable(); + }; + + // pseudo-private methods called by Flash + + this._setSandboxType = function(sandboxType) { + // + var sb = _s.sandbox; + sb.type = sandboxType; + sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')]; + _s._wD('Flash security sandbox type: ' + sb.type); + if (sb.type === 'localWithFile') { + sb.noRemote = true; + sb.noLocal = false; + _wDS('secNote', 2); + } else if (sb.type === 'localWithNetwork') { + sb.noRemote = false; + sb.noLocal = true; + } else if (sb.type === 'localTrusted') { + sb.noRemote = false; + sb.noLocal = false; + } + // + }; + + this._externalInterfaceOK = function(flashDate) { + // flash callback confirming flash loaded, EI working etc. + // flashDate = approx. timing/delay info for JS/flash bridge + if (_s.swfLoaded) { + return false; + } + var eiTime = new Date().getTime(); + _s._wD('soundManager::externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':'')); + _debugTS('swf', true); + _debugTS('flashtojs', true); + _s.swfLoaded = true; + _tryInitOnFocus = false; + if (_isIE) { + // IE needs a timeout OR delay until window.onload - may need TODO: investigating + setTimeout(_init, 100); + } else { + _init(); + } + }; + + _dcIE = function() { + if (_doc.readyState === 'complete') { + _dcLoaded(); + _doc.detachEvent('onreadystatechange', _dcIE); + } + return true; + }; + + // focus and window load, init + if (!_s.hasHTML5 || _needsFlash) { + // only applies to Flash mode + _addEvt(_win, 'focus', _handleFocus); + _addEvt(_win, 'load', _handleFocus); + _addEvt(_win, 'load', _delayWaitForEI); + if (_isSafari && _tryInitOnFocus) { + _addEvt(_win, 'mousemove', _handleFocus); // massive Safari focus hack + } + } + + if (_doc.addEventListener) { + _doc.addEventListener('DOMContentLoaded', _dcLoaded, false); + } else if (_doc.attachEvent) { + _doc.attachEvent('onreadystatechange', _dcIE); + } else { + // no add/attachevent support - safe to assume no JS -> Flash either + _debugTS('onload', false); + _die(); + } + + if (_doc.readyState === 'complete') { + setTimeout(_dcLoaded,100); + } + +} // SoundManager() + +// var SM2_DEFER = true; +// details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading + +if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) { + soundManager = new SoundManager(); +} + +// public interfaces +window.SoundManager = SoundManager; // constructor +window.soundManager = soundManager; // public instance: API, Flash callbacks etc. + +}(window)); diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2.as b/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2.as new file mode 100755 index 0000000..e9d4011 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2.as @@ -0,0 +1,452 @@ +/* + SoundManager 2: Javascript Sound for the Web + ---------------------------------------------- + http://schillmania.com/projects/soundmanager2/ + + Copyright (c) 2007, Scott Schiller. All rights reserved. + Code licensed under the BSD License: + http://www.schillmania.com/projects/soundmanager2/license.txt + + Flash 8 / ActionScript 2 version + + Compiling AS to Flash 8 SWF using MTASC (free compiler - http://www.mtasc.org/): + mtasc -swf soundmanager2.swf -main -header 16:16:30 SoundManager2.as -version 8 + + ActionScript Sound class reference (Macromedia), documentation download: + http://livedocs.macromedia.com/flash/8/ + Previously-live URL: + http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002668.html + + *** NOTE ON LOCAL FILE SYSTEM ACCESS *** + + Flash security allows local OR network access, but not both + unless explicitly whitelisted/allowed by the flash player's + security settings. + + To enable in-flash messaging for troubleshooting, pass debug=1 in FlashVars (within object/embed code) + SM2 will do this by default when soundManager.debugFlash = true. + +*/ + +import flash.external.ExternalInterface; // woo + +class SoundManager2 { + + static var app: SoundManager2; + + function SoundManager2() { + + var version = "V2.97a.20101010"; + var version_as = "(AS2/Flash 8)"; + + /* + * Cross-domain security options + * HTML on foo.com loading .swf hosted on bar.com? Define your "HTML domain" here to allow JS+Flash communication to work. + * // allow_xdomain_scripting = true; + * // xdomain = "foo.com"; + * For all domains (possible security risk?), use xdomain = "*"; which ends up as System.security.allowDomain("*"); + * When loading from HTTPS, use System.security.allowInsecureDomain(); + * See "allowDomain (security.allowDomain method)" in Flash 8/AS2 liveDocs documentation (AS2 reference -> classes -> security) + * download from http://livedocs.macromedia.com/flash/8/ + * Related AS3 documentation: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html#allowDomain%28%29 + */ + var allow_xdomain_scripting = false; + var xdomain = "*"; + + if (allow_xdomain_scripting && xdomain) { + System.security.allowDomain(xdomain); + version_as += ' - cross-domain enabled'; + } + + // externalInterface references (for Javascript callbacks) + var baseJSController = "soundManager"; + var baseJSObject = baseJSController + ".sounds"; + + // internal objects + var sounds = []; // indexed string array + var soundObjects = []; // associative Sound() object array + var timer = null; + var timerInterval = 50; + var pollingEnabled = false; // polling (timer) flag - disabled by default, enabled by JS->Flash call + var debugEnabled = true; // Flash debug output enabled by default, disabled by JS call + var flashDebugEnabled = false; // debug output to flash movie, off by default + var didSandboxMessage = false; + var caughtFatal = false; + + // for flash text output, debugging etc. + var _messages = []; + var _messageObj = null; + flashDebugEnabled = (_root.debug == 1); + + // display stuffs + Stage.scaleMode = 'noScale'; + Stage.align = 'TL'; + + // context menu item with version info + + var doNothing = function() {} + + var sm2Menu:ContextMenu = new ContextMenu(); + var sm2MenuItem:ContextMenuItem = new ContextMenuItem('SoundManager ' + version + ' ' + version_as, doNothing); + sm2MenuItem.enabled = false; + sm2Menu.customItems.push(sm2MenuItem); + _root.menu = sm2Menu; + + var writeDebug = function(s) { + // + if (!debugEnabled) return false; + ExternalInterface.call(baseJSController + "['_writeDebug']", "(Flash): " + s); + // + } + + var flashDebug = function(messageText) { + // + _messages.push(messageText); + if (!flashDebugEnabled) { + return false; + } + var sans = new TextFormat(); + sans.size = 12; + sans.font = "Arial"; + + // 320x240 if no stage dimensions (happens in IE, apparently 0 before stage resize event fires.) + var w = Stage.width?Stage.width:320; + var h = Stage.height?Stage.height:240; + if (!_messageObj) { + _messageObj = _root.createTextField("_messageObj", 0, 0, 0, w, h); + _messageObj.x = 0; + _messageObj.y = 0; + _messageObj.multiline = true; + _messageObj.html = true; + _messageObj.wordWrap = true; + _messageObj.align = 'left'; + _messageObj.autoSize = false; + } + _messageObj.htmlText = _messages.join('\n'); + _messageObj.setTextFormat(sans); + _messageObj.width = w; + _messageObj.height = h; + // + } + + var _externalInterfaceTest = function(isFirstCall) { + var sandboxType = System.security['sandboxType']; + try { + if (isFirstCall) { + flashDebug('Testing Flash -> JS...') + if (!didSandboxMessage && sandboxType != 'remote' && sandboxType != 'localTrusted') { + didSandboxMessage = true; + flashDebug('
    Fatal: Security sandbox error: Got "' + sandboxType + '", expected "remote" or "localTrusted".
    Additional security permissions need to be granted.
    See flash security settings panel for non-HTTP, eg. file:// use.

    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html'); + } + var d = new Date(); + ExternalInterface.call(baseJSController + "._externalInterfaceOK", d.getTime()); + if (!didSandboxMessage) { + flashDebug('Flash -> JS OK'); + } + } else { + writeDebug('SM2 SWF ' + version + ' ' + version_as); + flashDebug('JS -> Flash OK'); + writeDebug('JS to/from Flash OK'); + ExternalInterface.call(baseJSController + "._setSandboxType", sandboxType); + } + } catch(e) { + flashDebug(e.toString()); + if (!caughtFatal) { + caughtFatal = true; + } + return false; + } + return true; // to verify that a call from JS to here, works. (eg. JS receives "true", thus OK.) + } + + var _disableDebug = function() { + // prevent future debug calls from Flash going to client (maybe improve performance) + writeDebug('_disableDebug()'); + debugEnabled = false; + } + + var checkProgress = function() { + var bL = 0; + var bT = 0; + var nD = 0; + var nP = 0; + var oSound = null; + for (var i = 0, j = sounds.length; i < j; i++) { + oSound = soundObjects[sounds[i]]; + bL = oSound.getBytesLoaded(); + bT = oSound.getBytesTotal(); + nD = oSound.duration || 0; // can sometimes be null with short MP3s? Wack. + nP = oSound.position; + if (bL && bT && bL != oSound.lastValues.bytes) { + oSound.lastValues.bytes = bL; + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._whileloading", bL, bT, nD); + } + if (typeof nP != 'undefined' && nP != oSound.lastValues.position) { + oSound.lastValues.position = nP; + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._whileplaying", nP); + // if position changed, check for near-end + if (oSound.didJustBeforeFinish != true && oSound.loaded == true && oSound.justBeforeFinishOffset > 0 && nD - nP <= oSound.justBeforeFinishOffset) { + // fully-loaded, near end and haven't done this yet.. + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._onjustbeforefinish", (nD - nP)); + oSound.didJustBeforeFinish = true; + } + } + } + } + + var onLoad = function(bSuccess) { + checkProgress(); // ensure progress stats are up-to-date + // force duration update (doesn't seem to be always accurate) + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._whileloading", this.getBytesLoaded(), this.getBytesTotal(), this.duration); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onload", this.duration > 0 ? 1 : 0); // bSuccess doesn't always seem to work, so check MP3 duration instead. + } + + var onID3 = function() { + // --- NOTE: BUGGY? --- + // -------------------- + // TODO: Investigate holes in ID3 parsing - for some reason, Album will be populated with Date if empty and date is provided. (?) + // ID3V1 seem to parse OK, but "holes" / blanks in ID3V2 data seem to get messed up (eg. missing album gets filled with date.) + // iTunes issues: onID3 was not called with a test MP3 encoded with iTunes 7.01, and what appeared to be valid ID3V2 data. + // May be related to thumbnails for album art included in MP3 file by iTunes. See http://mabblog.com/blog/?p=33 + var id3Data = []; + var id3Props = []; + for (var prop in this.id3) { + id3Props.push(prop); + id3Data.push(this.id3[prop]); + // writeDebug('id3['+prop+']: '+this.id3[prop]); + } + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onid3", id3Props, id3Data); + // unhook own event handler, prevent second call (can fire twice as data is received - ID3V2 at beginning, ID3V1 at end.) + // Therefore if ID3V2 data is received, ID3V1 is ignored. + soundObjects[this.sID].onID3 = null; + } + + var registerOnComplete = function(sID) { + soundObjects[sID].onSoundComplete = function() { + checkProgress(); + this.didJustBeforeFinish = false; // reset + ExternalInterface.call(baseJSObject + "['" + sID + "']._onfinish"); + } + } + + var _setPosition = function(sID, nSecOffset, isPaused) { + var s = soundObjects[sID]; + // writeDebug('_setPosition()'); + s.lastValues.position = s.position; + if (s.lastValues.loops > 1 && nSecOffset != 0) { + writeDebug('Warning: Looping functionality being disabled due to Flash limitation.'); + s.lastValues.loops = 1; + } + s.start(nSecOffset, s.lastValues.nLoops || 1); // start playing at new position + if (isPaused) s.stop(); + } + + var _load = function(sID, sURL, bStream, bAutoPlay, bCheckPolicyFile) { + // writeDebug('_load(): '+sID+', '+sURL+', '+bStream+', '+bAutoPlay); + if (typeof bAutoPlay == 'undefined') bAutoPlay = false; + if (typeof bStream == 'undefined') bStream = true; + if (typeof bCheckPolicyFile == 'undefined') bCheckPolicyFile = false; + // writeDebug('bStream: '+bStream); + // writeDebug('bAutoPlay: '+bAutoPlay); + // checkProgress(); + var s = soundObjects[sID]; + s.onID3 = onID3; + s.onLoad = onLoad; + s.loaded = true; + s.checkPolicyFile = bCheckPolicyFile; + s.loadSound(sURL, bStream); + s.didJustBeforeFinish = false; + if (bAutoPlay != true) { + s.stop(); // prevent default auto-play behaviour + } else { + writeDebug('auto-play allowed'); + } + registerOnComplete(sID); + } + + var _unload = function(sID, sURL) { + // effectively "stop" loading by loading a tiny MP3 + // writeDebug('_unload()'); + var s = soundObjects[sID]; + s.onID3 = null; + s.onLoad = null; + s.loaded = false; + s.loadSound(sURL, true); + s.stop(); // prevent auto-play + s.didJustBeforeFinish = false; + } + + var _createSound = function(sID, justBeforeFinishOffset, loops, checkPolicyFile) { + var s = new Sound(); + if (!soundObjects[sID]) { + sounds.push(sID); + } + soundObjects[sID] = s; + s.setVolume(100); + s.didJustBeforeFinish = false; + s.sID = sID; + s.paused = false; + s.loaded = false; + s.justBeforeFinishOffset = justBeforeFinishOffset || 0; + s.checkPolicyFile = checkPolicyFile; + s.lastValues = { + bytes: 0, + position: 0, + nLoops: loops||1 + }; + } + + var _destroySound = function(sID) { + // for the power of garbage collection! .. er, Greyskull! + var s = (soundObjects[sID] || null); + if (!s) return false; + for (var i = 0; i < sounds.length; i++) { + if (sounds[i] == sID) { + sounds.splice(i, 1); + break; + } + } + s = null; + delete soundObjects[sID]; + } + + var _stop = function(sID, bStopAll) { + // stop this particular instance (or "all", based on parameter) + if (bStopAll) { + _root.stop(); + } else { + soundObjects[sID].stop(); + soundObjects[sID].paused = false; + soundObjects[sID].didJustBeforeFinish = false; + } + } + + var _start = function(sID, nLoops, nMsecOffset) { + // writeDebug('_start: ' + sID + ', loops: ' + nLoops + ', nMsecOffset: ' + nMsecOffset); + registerOnComplete(); + var s = soundObjects[sID]; + s.lastValues.paused = false; // reset pause if applicable + s.lastValues.nLoops = (nLoops || 1); + s.start(nMsecOffset, nLoops); + } + + var _pause = function(sID) { + // writeDebug('_pause()'); + var s = soundObjects[sID]; + if (!s.paused) { + // reference current position, stop sound + s.paused = true; + s.lastValues.position = s.position; + // writeDebug('_pause(): position: '+s.lastValues.position); + s.stop(); + } else { + // resume playing from last position + // writeDebug('resuming - playing at '+s.lastValues.position+', '+s.lastValues.nLoops+' times'); + s.paused = false; + s.start(s.lastValues.position / 1000, s.lastValues.nLoops); + } + } + + var _setPan = function(sID, nPan) { + soundObjects[sID].setPan(nPan); + } + + var _setVolume = function(sID, nVol) { + soundObjects[sID].setVolume(nVol); + } + + var _setPolling = function(bPolling) { + pollingEnabled = bPolling; + if (timer == null && pollingEnabled) { + writeDebug('Enabling polling, ' + timerInterval + ' ms interval'); + timer = setInterval(checkProgress, timerInterval); + } else if (timer && !pollingEnabled) { + writeDebug('Disabling polling'); + clearInterval(timer); + timer = null; + } + } + + // XML handler stuff + var parseXML = function(oXML) { + var xmlRoot = oXML.firstChild; + var xmlAttr = xmlRoot.attributes; + var oOptions = {}; + for (var i = 0, j = xmlRoot.childNodes.length; i < j; i++) { + xmlAttr = xmlRoot.childNodes[i].attributes; + oOptions = { + id: xmlAttr.id, + url: xmlRoot.attributes.baseHref + xmlAttr.href, + stream: xmlAttr.stream + } + ExternalInterface.call(baseJSController + ".createSound", oOptions); + } + } + + var xmlOnloadHandler = function(ok) { + if (ok) { + writeDebug("XML loaded"); + parseXML(this); + } else { + writeDebug('XML load failed'); + } + } + + // --- + var _loadFromXML = function(sXmlUrl) { + writeDebug("_loadFromXML(" + sXmlUrl + ")"); + // ExternalInterface.call(baseJSController+"._writeDebug","_loadFromXML("+sXmlUrl+")"); + // var oXmlHandler = new XMLHandler(sXmlUrl); + var oXML = new XML(); + oXML.ignoreWhite = true; + oXML.onLoad = xmlOnloadHandler; + writeDebug("Attempting to load XML: " + sXmlUrl); + oXML.load(sXmlUrl); + } + + var _init = function() { + + // OK now stuff should be available + try { + flashDebug('Adding ExternalInterface callbacks...'); + ExternalInterface.addCallback('_load', this, _load); + ExternalInterface.addCallback('_unload', this, _unload); + ExternalInterface.addCallback('_stop', this, _stop); + ExternalInterface.addCallback('_start', this, _start); + ExternalInterface.addCallback('_pause', this, _pause); + ExternalInterface.addCallback('_setPosition', this, _setPosition); + ExternalInterface.addCallback('_setPan', this, _setPan); + ExternalInterface.addCallback('_setVolume', this, _setVolume); + ExternalInterface.addCallback('_setPolling', this, _setPolling); + ExternalInterface.addCallback('_externalInterfaceTest', this, _externalInterfaceTest); + ExternalInterface.addCallback('_disableDebug', this, _disableDebug); + ExternalInterface.addCallback('_loadFromXML', null, _loadFromXML); + ExternalInterface.addCallback('_createSound', this, _createSound); + ExternalInterface.addCallback('_destroySound', this, _destroySound); + } catch(e) { + flashDebug('Fatal: ExternalInterface error: ' + e.toString()); + } + // try to talk to JS, do init etc. + _externalInterfaceTest(true); + // flashDebug('Init OK'); + } + + flashDebug('SM2 SWF ' + version + ' ' + version_as); + + if (ExternalInterface.available) { + flashDebug('ExternalInterface available'); + _init(); + } else { + // d'oh! - may be from a corrupt install, ancient (pre-Netscape 6?) browser etc. + flashDebug('Fatal: ExternalInterface (Flash <-> JS) not available'); + } + + + } // SoundManager2() + + // entry point + static function main(mc) { + app = new SoundManager2(); + } + +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_AS3.as b/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_AS3.as new file mode 100755 index 0000000..445de48 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_AS3.as @@ -0,0 +1,970 @@ +/* + SoundManager 2: Javascript Sound for the Web + ---------------------------------------------- + http://schillmania.com/projects/soundmanager2/ + + Copyright (c) 2007, Scott Schiller. All rights reserved. + Code licensed under the BSD License: + http://www.schillmania.com/projects/soundmanager2/license.txt + + Flash 9 / ActionScript 3 version +*/ + +package { + + import flash.display.Sprite; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.events.MouseEvent; + import flash.events.SecurityErrorEvent; + import flash.events.AsyncErrorEvent; + import flash.events.NetStatusEvent; + import flash.events.TimerEvent; + import flash.external.ExternalInterface; // woo + import flash.media.Sound; + import flash.media.SoundChannel; + import flash.media.SoundMixer; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.system.Security; + import flash.system.System; + import flash.text.TextField; + import flash.text.TextFormat; + import flash.text.TextFieldAutoSize; + import flash.ui.ContextMenu; + import flash.ui.ContextMenuItem; + import flash.utils.setInterval; + import flash.utils.clearInterval; + import flash.utils.Dictionary; + import flash.utils.Timer; + import flash.xml.XMLDocument; + import flash.xml.XMLNode; + + public class SoundManager2_AS3 extends Sprite { + + public var version:String = "V2.97a.20101010"; + public var version_as:String = "(AS3/Flash 9)"; + + /* + * Cross-domain security options + * HTML on foo.com loading .swf hosted on bar.com? Define your "HTML domain" here to allow JS+Flash communication to work. + * // allow_xdomain_scripting = true; + * // xdomain = "foo.com"; + * For all domains (possible security risk?), use xdomain = "*"; which ends up as System.security.allowDomain("*"); + * When loading from HTTPS, use System.security.allowInsecureDomain(); + * See http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html#allowDomain() + */ + public var allow_xdomain_scripting:Boolean = false; + public var xdomain:String = "*"; + + // externalInterface references (for Javascript callbacks) + public var baseJSController:String = "soundManager"; + public var baseJSObject:String = baseJSController + ".sounds"; + + // internal objects + public var sounds:Array = []; // indexed string array + public var soundObjects: Dictionary = new Dictionary(); // associative Sound() object Dictionary type + public var timerInterval: uint = 50; + public var timerIntervalHighPerformance: uint = 10; // ~30fps (in Safari on OSX, anyway..) + public var timer: Timer = null; + public var pollingEnabled: Boolean = false; // polling (timer) flag - disabled by default, enabled by JS->Flash call + public var debugEnabled: Boolean = true; // Flash debug output enabled by default, disabled by JS call + public var flashDebugEnabled: Boolean = false; // Flash internal debug output (write to visible SWF in browser) + public var loaded: Boolean = false; + public var currentObject: SoundManager2_SMSound_AS3 = null; + public var paramList:Object = null; + public var messages:Array = []; + public var textField: TextField = null; + public var textStyle: TextFormat = new TextFormat(); + public var didSandboxMessage: Boolean = false; + public var caughtFatal: Boolean = false; + + public function SoundManager2_AS3() { + + if (allow_xdomain_scripting && xdomain) { + Security.allowDomain(xdomain); + version_as += ' - cross-domain enabled'; + } + + this.paramList = this.root.loaderInfo.parameters; + + // + if (this.paramList['debug'] == 1) { + this.flashDebugEnabled = true; + } + + if (this.flashDebugEnabled) { + var canvas: Sprite = new Sprite(); + canvas.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); + addChild(canvas); + } + // + + flashDebug('SM2 SWF ' + version + ' ' + version_as); + + // context menu item with version info + + var sm2Menu:ContextMenu = new ContextMenu(); + var sm2MenuItem:ContextMenuItem = new ContextMenuItem('SoundManager ' + version + ' ' + version_as); + sm2MenuItem.enabled = false; + sm2Menu.customItems.push(sm2MenuItem); + contextMenu = sm2Menu; + + if (ExternalInterface.available) { + flashDebug('ExternalInterface available'); + try { + flashDebug('Adding ExternalInterface callbacks...'); + ExternalInterface.addCallback('_load', _load); + ExternalInterface.addCallback('_unload', _unload); + ExternalInterface.addCallback('_stop', _stop); + ExternalInterface.addCallback('_start', _start); + ExternalInterface.addCallback('_pause', _pause); + ExternalInterface.addCallback('_setPosition', _setPosition); + ExternalInterface.addCallback('_setPan', _setPan); + ExternalInterface.addCallback('_setVolume', _setVolume); + ExternalInterface.addCallback('_setPolling', _setPolling); + ExternalInterface.addCallback('_externalInterfaceTest', _externalInterfaceTest); + ExternalInterface.addCallback('_disableDebug', _disableDebug); + ExternalInterface.addCallback('_getMemoryUse', _getMemoryUse); + ExternalInterface.addCallback('_loadFromXML', _loadFromXML); + ExternalInterface.addCallback('_createSound', _createSound); + ExternalInterface.addCallback('_destroySound', _destroySound); + ExternalInterface.addCallback('_setAutoPlay', _setAutoPlay); + } catch(e: Error) { + flashDebug('Fatal: ExternalInterface error: ' + e.toString()); + } + } else { + flashDebug('Fatal: ExternalInterface (Flash <-> JS) not available'); + }; + + // call after delay, to be safe (ensure callbacks are registered by the time JS is called below) + var timer: Timer = new Timer(20, 0); + timer.addEventListener(TimerEvent.TIMER, function() : void { + timer.reset(); + _externalInterfaceTest(true); + // timer.reset(); + // flashDebug('Init OK'); + }); + timer.start(); + // delayed, see above + // _externalInterfaceTest(true); + } // SoundManager2() + + public function flashDebug (txt:String) : void { + // + messages.push(txt); + if (this.flashDebugEnabled) { + var didCreate: Boolean = false; + textStyle.font = 'Arial'; + textStyle.size = 12; + // 320x240 if no stage dimensions (happens in IE, apparently 0 before stage resize event fires.) + var w:Number = this.stage.width?this.stage.width:320; + var h:Number = this.stage.height?this.stage.height:240; + if (textField == null) { + didCreate = true; + textField = new TextField(); + textField.autoSize = TextFieldAutoSize.LEFT; + textField.x = 0; + textField.y = 0; + textField.multiline = true; + textField.textColor = 0; + textField.wordWrap = true; + } + textField.htmlText = messages.join('\n'); + textField.setTextFormat(textStyle); + textField.width = w; + textField.height = h; + if (didCreate) { + this.addChild(textField); + } + } + // + } + + public function _setAutoPlay(sID:String, autoPlay:Boolean) : void { + var s: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (s) { + s.setAutoPlay(autoPlay); + } + } + + // methods + // ----------------------------------- + + public function writeDebug (s:String, bTimestamp: Boolean = false) : Boolean { + if (!debugEnabled) return false; + // + ExternalInterface.call(baseJSController + "['_writeDebug']", "(Flash): " + s, null, bTimestamp); + // + return true; + } + + public function _externalInterfaceTest(isFirstCall: Boolean) : Boolean { + var sandboxType:String = flash.system.Security['sandboxType']; + if (!didSandboxMessage && sandboxType != 'localTrusted' && sandboxType != 'remote') { + didSandboxMessage = true; + flashDebug('
    Fatal: Security sandbox error: Got "' + sandboxType + '", expected "remote" or "localTrusted".
    Additional security permissions need to be granted.
    See flash security settings panel for non-HTTP, eg., file:// use.

    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html'); + } + try { + if (isFirstCall == true) { + flashDebug('Testing Flash -> JS...'); + var d: Date = new Date(); + ExternalInterface.call(baseJSController + "._externalInterfaceOK", d.getTime()); + flashDebug('Flash -> JS OK'); + } else { + writeDebug('SM2 SWF ' + version + ' ' + version_as); + flashDebug('JS -> Flash OK'); + ExternalInterface.call(baseJSController + "._setSandboxType", sandboxType); + writeDebug('JS to/from Flash OK'); + } + } catch(e: Error) { + flashDebug('Fatal: Flash <-> JS error: ' + e.toString()); + writeDebug('_externalInterfaceTest: Error: ' + e.toString()); + if (!caughtFatal) { + caughtFatal = true; + } + return false; + } + return true; // to verify that a call from JS to here, works. (eg. JS receives "true", thus OK.) + } + + public function _disableDebug() : void { + // prevent future debug calls from Flash going to client (maybe improve performance) + writeDebug('_disableDebug()'); + debugEnabled = false; + } + + public function checkLoadProgress(e: Event) : void { + try { + var oSound:Object = e.target; + var bL: int = oSound.bytesLoaded; + var bT: int = oSound.bytesTotal; + var nD: int = oSound.length || oSound.duration || 0; + var sMethod:String = baseJSObject + "['" + oSound.sID + "']._whileloading"; + ExternalInterface.call(sMethod, bL, bT, nD); + if (bL && bT && bL != oSound.lastValues.bytes) { + oSound.lastValues.bytes = bL; + ExternalInterface.call(sMethod, bL, bT, nD); + } + } catch(e: Error) { + writeDebug('checkLoadProgress(): ' + e.toString()); + } + } + + public function checkProgress() : void { + var bL: int = 0; + var bT: int = 0; + var nD: int = 0; + var nP: int = 0; + var bufferLength: int = 0; + var lP:Number = 0; + var rP:Number = 0; + var isBuffering:Object = null; + var oSound: SoundManager2_SMSound_AS3 = null; + var oSoundChannel: flash.media.SoundChannel = null; + var sMethod:String = null; + var newPeakData: Boolean = false; + var newWaveformData: Boolean = false; + var newEQData: Boolean = false; + var areSoundsInaccessible: Boolean = SoundMixer.areSoundsInaccessible(); + var isPlaying: Boolean = true; // special case for NetStream when ending + var hasNew:Boolean = false; + var hasNewLoaded:Boolean = false; + + for (var i: int = 0, j: int = sounds.length; i < j; i++) { + oSound = soundObjects[sounds[i]]; + sMethod = baseJSObject + "['" + sounds[i] + "']._whileloading"; + + if (!oSound || !oSound.useEvents || oSound.failed || !oSound.connected) { + // various cases for ignoring + continue; // if sounds are destructed within event handlers while this loop is running, may be null + } + + if (oSound.useNetstream) { + + // Don't do anything if there is no NetStream object yet + if (!oSound.ns) { + continue; + } + + // stream + bufferLength = oSound.ns.bufferLength; + bL = oSound.ns.bytesLoaded; + bT = oSound.ns.bytesTotal; + nD = int(oSound.duration || 0); // can sometimes be null with short MP3s? Wack. + nP = oSound.ns.time * 1000; + + if (nP != oSound.lastValues.position) { + oSound.lastValues.position = nP; + hasNew = true; + } + if (nD > oSound.lastValues.duration) { + oSound.lastValues.duration = nD; + hasNew = true; + } + if (bL > oSound.lastValues.bytesLoaded) { + oSound.lastValues.bytesLoaded = bL; + hasNew = true; + } + if (bT > oSound.lastValues.bytes) { + oSound.lastValues.bytes = bT; + hasNew = true; + } + if (bufferLength != oSound.lastValues.bufferLength) { + oSound.lastValues.bufferLength = bufferLength; + hasNew = true; + } + + // Don't set loaded for streams because bytesLoaded and bytesTotal are always 0 + // writeDebug('ns: time/duration, bytesloaded/total: '+nP+'/'+nD+', '+bL+'/'+bT); + if (oSound.loaded != true && nD > 0 && bL == bT && bL != 0 && bT != 0) { + // non-MP3 has loaded + oSound.loaded = true; + try { + ExternalInterface.call(sMethod, bL, bT, nD, bufferLength); + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._onload", oSound.duration > 0 ? 1 : 0); + } catch(e: Error) { + writeDebug('_whileLoading/_onload error: ' + e.toString()); + } + } else if (oSound.loaded != true && hasNew) { + ExternalInterface.call(sMethod, bL, bT, nD, bufferLength); + } + + } else { + + // MP3 sound + oSoundChannel = oSound.soundChannel; + bL = oSound.bytesLoaded; + bT = oSound.bytesTotal; + nD = int(oSound.length || 0); // can sometimes be null with short MP3s? Wack. + isBuffering = oSound.isBuffering; + + if (oSoundChannel) { + nP = (oSoundChannel.position || 0); + if (oSound.lastValues.loops > 1 && nP > oSound.length) { + // round down to nearest loop + var playedLoops:Number = Math.floor(nP/oSound.length); + nP = nP - (oSound.length*playedLoops); + } + if (oSound.usePeakData) { + lP = int((oSoundChannel.leftPeak) * 1000) / 1000; + rP = int((oSoundChannel.rightPeak) * 1000) / 1000; + } else { + lP = 0; + rP = 0; + } + } else { + // stopped, not loaded or feature not used + nP = 0; + } + + if (nP != oSound.lastValues.position) { + oSound.lastValues.position = nP; + hasNew = true; + } + + if (nD > oSound.lastValues.duration) { // original sound duration * number of sound loops + oSound.lastValues.duration = nD; + hasNew = true; + } + if (bL > oSound.lastValues.bytesLoaded) { + oSound.lastValues.bytesLoaded = bL; + hasNew = true; + } + if (bT > oSound.lastValues.bytes) { + oSound.lastValues.bytes = bT; + hasNew = true; + hasNewLoaded = true; + } + + // loading progress + if (hasNewLoaded) { + oSound.lastValues.bytes = bL; + ExternalInterface.call(sMethod, bL, bT, nD); + } + } + // peak data + if (oSoundChannel && oSound.usePeakData) { + if (lP != oSound.lastValues.leftPeak) { + oSound.lastValues.leftPeak = lP; + newPeakData = true; + } + if (rP != oSound.lastValues.rightPeak) { + oSound.lastValues.rightPeak = rP; + newPeakData = true; + } + } + + var newDataError:Boolean = false; + var dataErrors:Array = []; + + // special case: Netstream may try to fire whileplaying() after finishing. check that stop hasn't fired. + isPlaying = (oSound.didLoad && !oSound.paused && (!oSound.useNetstream || (oSound.useNetstream && oSound.lastNetStatus != "NetStream.Play.Stop"))); // don't update if stream has ended + + // raw waveform + EQ spectrum data + if (isPlaying && oSoundChannel || oSound.useNetstream) { + if (oSound.useWaveformData) { + if (areSoundsInaccessible == false) { + try { + oSound.getWaveformData(); + } catch(e: Error) { + // this shouldn't happen, but does seem to fire from time to time. + writeDebug('getWaveformData() warning: ' + e.toString()); + } + } else if (oSound.handledDataError != true && oSound.ignoreDataError != true) { + try { + oSound.getWaveformData(); + } catch(e: Error) { + writeDebug('getWaveformData() (waveform data) '+e.toString()); + // oSound.useWaveformData = false; + newDataError = true; + dataErrors.push(e.toString()); + oSound.handledDataError = true; + } + } + } + if (oSound.useEQData) { + if (areSoundsInaccessible == false) { + try { + oSound.getEQData(); + } catch(e: Error) { + writeDebug('getEQData() warning: ' + e.toString()); + newDataError = true; + dataErrors.push(e.toString()); + oSound.handledDataError = true; + } + } else if (oSound.handledDataError != true && oSound.ignoreDataError != true) { + try { + oSound.getEQData(); + } catch(e: Error) { + // writeDebug('computeSpectrum() (EQ data) '+e.toString()); + // oSound.useEQData = false; + newDataError = true; + dataErrors.push(e.toString()); + oSound.handledDataError = true; + } + } + } + if (oSound.waveformDataArray != oSound.lastValues.waveformDataArray) { + oSound.lastValues.waveformDataArray = oSound.waveformDataArray; + newWaveformData = true; + } + if (oSound.eqDataArray != oSound.lastValues.eqDataArray) { + oSound.lastValues.eqDataArray = oSound.eqDataArray; + newEQData = true; + } + } + + if (newDataError) { + sMethod = baseJSObject + "['" + sounds[i] + "']._ondataerror"; + var errors:String = dataErrors.join('
    \n'); + ExternalInterface.call(sMethod, 'data unavailable: ' + errors); + } + + if (typeof nP != 'undefined' && hasNew) { // && isPlaying - removed to allow updates while paused, eg. from setPosition() calls + + // oSound.lastValues.position = nP; + sMethod = baseJSObject + "['" + sounds[i] + "']._whileplaying"; + var waveDataLeft:String = (newWaveformData ? oSound.waveformDataArray.slice(0, 256).join(',') : null); + var waveDataRight:String = (newWaveformData ? oSound.waveformDataArray.slice(256).join(',') : null); + var eqDataLeft:String = (newEQData ? oSound.eqDataArray.slice(0, 256).join(',') : null); + var eqDataRight:String = (newEQData ? oSound.eqDataArray.slice(256).join(',') : null); + ExternalInterface.call(sMethod, nP, (newPeakData ? { + leftPeak: lP, + rightPeak: rP + } : null), waveDataLeft, waveDataRight, (newEQData ? { + leftEQ: eqDataLeft, + rightEQ: eqDataRight + } : null)); + // if position changed, check for near-end + if (oSound.didJustBeforeFinish != true && oSound.loaded == true && oSound.justBeforeFinishOffset > 0 && nD - nP <= oSound.justBeforeFinishOffset) { + // fully-loaded, near end and haven't done this yet.. + sMethod = baseJSObject + "['" + sounds[i] + "']._onjustbeforefinish"; + ExternalInterface.call(sMethod, (nD - nP)); + oSound.didJustBeforeFinish = true; + } + } + + // check isBuffering + if (!oSound.useNetstream && oSound.isBuffering != oSound.lastValues.isBuffering) { + // property has changed + oSound.lastValues.isBuffering = oSound.isBuffering; + sMethod = baseJSObject + "['" + sounds[i] + "']._onbufferchange"; + ExternalInterface.call(sMethod, oSound.isBuffering ? 1 : 0); + } + + } + + } + + public function onLoadError(oSound:Object) : void { + // something went wrong. 404, bad format etc. + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._onload", 0); + } + + public function onLoad(e: Event) : void { + checkProgress(); // ensure progress stats are up-to-date + var oSound:Object = e.target; + if (!oSound.useNetstream) { // FLV must also have metadata + oSound.loaded = true; + // force duration update (doesn't seem to be always accurate) + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._whileloading", oSound.bytesLoaded, oSound.bytesTotal, oSound.length || oSound.duration); + // TODO: Determine if loaded or failed - bSuccess? + // ExternalInterface.call(baseJSObject+"['"+oSound.sID+"']._onload",bSuccess?1:0); + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._onload", 1); + } + } + + public function onID3(e: Event) : void { + + // --- NOTE: BUGGY (Flash 8 only? Haven't really checked 9 + 10.) --- + // TODO: Investigate holes in ID3 parsing - for some reason, Album will be populated with Date if empty and date is provided. (?) + // ID3V1 seem to parse OK, but "holes" / blanks in ID3V2 data seem to get messed up (eg. missing album gets filled with date.) + // iTunes issues: onID3 was not called with a test MP3 encoded with iTunes 7.01, and what appeared to be valid ID3V2 data. + // May be related to thumbnails for album art included in MP3 file by iTunes. See http://mabblog.com/blog/?p=33 + try { + var oSound:Object = e.target; + + var id3Data:Array = []; + var id3Props:Array = []; + for (var prop:String in oSound.id3) { + id3Props.push(prop); + id3Data.push(oSound.id3[prop]); + // writeDebug('id3['+prop+']: '+oSound.id3[prop]); + } + ExternalInterface.call(baseJSObject + "['" + oSound.sID + "']._onid3", id3Props, id3Data); + // unhook own event handler, prevent second call (can fire twice as data is received - ID3V2 at beginning, ID3V1 at end.) + // Therefore if ID3V2 data is received, ID3V1 is ignored. + // soundObjects[oSound.sID].onID3 = null; + } catch(e: Error) { + writeDebug('onID3(): Unable to get ID3 info for ' + oSound.sID + '.'); + } + oSound.removeEventListener(Event.ID3, onID3); + } + + public function registerOnComplete(sID:String) : void { + var oSound: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (oSound && oSound.soundChannel) { + oSound.soundChannel.addEventListener(Event.SOUND_COMPLETE, function() : void { + if (oSound) { + oSound.didJustBeforeFinish = false; // reset + checkProgress(); + try { + oSound.ignoreDataError = true; // workaround: avoid data error handling for this manual step.. + oSound.start(0, 1); // go back to 0 + oSound.soundChannel.stop(); + } catch(e: Error) { + writeDebug('Could not set position on ' + sID + ': ' + e.toString()); + } + oSound.ignoreDataError = false; // ..and reset + oSound.handledDataError = false; // reset this flag + } + // checkProgress(); + ExternalInterface.call(baseJSObject + "['" + sID + "']._onfinish"); + }); + } + } + + public function doSecurityError(oSound: SoundManager2_SMSound_AS3, e: SecurityErrorEvent) : void { + writeDebug('securityError: ' + e.text); + // when this happens, you don't have security rights on the server containing the FLV file + // a crossdomain.xml file would fix the problem easily + } + + public function _setPosition(sID:String, nSecOffset:Number, isPaused: Boolean) : void { + var s: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (!s) return void; + // writeDebug('_setPosition()'); + + // stop current channel, start new one. + if (s.lastValues) { + s.lastValues.position = nSecOffset; // s.soundChannel.position; + } + if (s.useNetstream) { + // Minimize the buffer so playback starts ASAP + s.setBuffer(s.getStartBuffer()); + writeDebug('setPosition: setting buffer to '+s.ns.bufferTime+' secs'); + + nSecOffset = nSecOffset > 0 ? nSecOffset / 1000 : 0; + writeDebug('setPosition: ' + nSecOffset); + s.ns.seek(nSecOffset); + checkProgress(); // force UI update + } else { + if (s.soundChannel) { + s.soundChannel.stop(); + } + writeDebug('setPosition: ' + nSecOffset); // +', '+(s.lastValues.loops?s.lastValues.loops:1)); + if (s.lastValues.loops > 1 && nSecOffset != 0) { + writeDebug('Warning: Looping functionality being disabled due to Flash limitation.'); + s.lastValues.loops = 1; + } + try { + s.start(nSecOffset, s.lastValues.loops || 1); // start playing at new position + } catch(e: Error) { + writeDebug('Warning: Could not set position on ' + sID + ': ' + e.toString()); + } + checkProgress(); // force UI update + try { + registerOnComplete(sID); + } catch(e: Error) { + writeDebug('_setPosition(): Could not register onComplete'); + } + if (isPaused && s.soundChannel) { + // writeDebug('_setPosition: stopping (paused) sound'); + // writeDebug('last position: '+s.lastValues.position+' vs '+s.soundChannel.position); + s.soundChannel.stop(); + } + } + } + + public function _load(sID:String, sURL:String, bStream: Boolean, bAutoPlay: Boolean, nLoops: Number, bAutoLoad: Boolean, bCheckPolicyFile: Boolean) : void { + // writeDebug('_load()'); + if (typeof bAutoPlay == 'undefined') bAutoPlay = false; + var s: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (!s) return void; + var didRecreate: Boolean = false; + if (s.didLoad == true) { + // need to recreate sound + didRecreate = true; + writeDebug('recreating sound ' + sID + ' in order to load ' + sURL); + var ns:Object = new Object(); + ns.sID = s.sID; + ns.loops = nLoops||1; + ns.justBeforeFinishOffset = s.justBeforeFinishOffset; + ns.usePeakData = s.usePeakData; + ns.useWaveformData = s.useWaveformData; + ns.useEQData = s.useEQData; + ns.useNetstream = s.useNetstream; + ns.bufferTime = s.bufferTime; + ns.bufferTimes = s.bufferTimes; + ns.serverUrl = s.serverUrl; + ns.duration = s.duration; + ns.recordStats = s.recordStats; + ns.checkPolicyFile = s.checkPolicyFile; + ns.useEvents = true; + _destroySound(s.sID); + _createSound(ns.sID, sURL, ns.justBeforeFinishOffset, ns.usePeakData, ns.useWaveformData, ns.useEQData, ns.useNetstream, ns.bufferTime, ns.loops, ns.serverUrl, ns.duration, bAutoPlay, ns.useEvents, ns.bufferTimes, ns.recordStats, bAutoLoad, ns.checkPolicyFile); + s = soundObjects[sID]; + // writeDebug('Sound object replaced'); + } + checkProgress(); + + if (!s.didLoad) { + try { + s.addEventListener(Event.ID3, onID3); + s.addEventListener(Event.COMPLETE, onLoad); + } catch(e: Error) { + writeDebug('_load(): could not assign ID3/complete event handlers'); + } + } + + // don't try to load if same request already made + s.sURL = sURL; + + if (s.useNetstream) { + try { + s.useEvents = true; + s.ns.play(sURL); + } catch(e: Error) { + writeDebug('_load(): error: ' + e.toString()); + } + } else { + try { + s.addEventListener(IOErrorEvent.IO_ERROR, function(e: IOErrorEvent) : void { + s.doIOError(e); + }); + s.loadSound(sURL, bStream); + } catch(e: Error) { + // oh well + writeDebug('_load: Error loading ' + sURL + '. Flash error detail: ' + e.toString()); + } + } + + s.didJustBeforeFinish = false; + } + + public function _unload(sID:String) : void { + var s: SoundManager2_SMSound_AS3 = (soundObjects[sID] || null); + if (!s) return void; + var sURL:String = s.sURL; // save existing sound URL for object recreation + try { + removeEventListener(Event.ID3, onID3); + removeEventListener(Event.COMPLETE, onLoad); + } catch(e: Error) { + writeDebug('_unload() warn: Could not remove ID3/complete events'); + } + s.paused = false; + if (s.soundChannel) { + s.soundChannel.stop(); + } + try { + if (s.didLoad && !s.loaded && !s.useNetstream) { + s.close(); // close stream only if still loading? + } + } catch(e: Error) { + // stream may already have closed if sound loaded, etc. + writeDebug(sID + '._unload(): Note: Unable to close stream: ' + e.toString()); + // oh well + } + // destroy and recreate Flash sound object, try to reclaim memory + // writeDebug('sound._unload(): recreating sound '+sID+' to free memory'); + if (s.useNetstream) { + // writeDebug('_unload(): closing netStream stuff'); + try { + s.removeNetstreamEvents(); + s.ns.close(); + s.nc.close(); + // s.nc = null; + // s.ns = null; + } catch(e: Error) { + // oh well + writeDebug('_unload(): caught exception during netConnection/netStream close'); + } + } + var ns:Object = new Object(); + ns.sID = s.sID; + ns.loops = s.loops; + ns.justBeforeFinishOffset = s.justBeforeFinishOffset; + ns.usePeakData = s.usePeakData; + ns.useWaveformData = s.useWaveformData; + ns.useEQData = s.useEQData; + ns.useNetstream = s.useNetstream; + ns.bufferTime = s.bufferTime; + ns.bufferTimes = s.bufferTimes; + ns.serverUrl = s.serverUrl; + ns.duration = s.duration; + ns.autoPlay = s.autoPlay; + ns.recordStats = s.recordStats; + ns.autoLoad = s.autoLoad; + ns.checkPolicyFile = s.checkPolicyFile; + _destroySound(s.sID); + _createSound(ns.sID, sURL, ns.justBeforeFinishOffset, ns.usePeakData, ns.useWaveformData, ns.useEQData, ns.useNetstream, ns.bufferTime, ns.loops, ns.serverUrl, ns.duration, ns.autoPlay, false, ns.bufferTimes, ns.recordStats, ns.autoLoad, ns.checkPolicyFile); // false: don't allow events just yet + soundObjects[sID].connected = true; // fake it? + writeDebug(s.sID + '.unload(): ok'); + } + + public function _createSound(sID:String, sURL:String, justBeforeFinishOffset: int, usePeakData: Boolean, useWaveformData: Boolean, useEQData: Boolean, useNetstream: Boolean, bufferTime:Number, loops:Number, serverUrl:String, duration:Number, autoPlay:Boolean, useEvents:Boolean, bufferTimes:Array, recordStats:Boolean, autoLoad:Boolean, checkPolicyFile:Boolean) : void { + var s: SoundManager2_SMSound_AS3 = new SoundManager2_SMSound_AS3(this, sID, sURL, usePeakData, useWaveformData, useEQData, useNetstream, bufferTime, serverUrl, duration, autoPlay, useEvents, bufferTimes, recordStats, autoLoad, checkPolicyFile); + if (!soundObjects[sID]) { + sounds.push(sID); + } + soundObjects[sID] = s; + this.currentObject = s; + s.didJustBeforeFinish = false; + s.sID = sID; + s.sURL = sURL; + s.paused = false; + s.loaded = false; + s.justBeforeFinishOffset = justBeforeFinishOffset || 0; + s.checkPolicyFile = checkPolicyFile; + s.lastValues = { + bytes: 0, + position: 0, + loops: loops||1, + leftPeak: 0, + rightPeak: 0, + bufferLength: 0 + }; + } + + public function _destroySound(sID:String) : void { + // for the power of garbage collection! .. er, Greyskull! + var s: SoundManager2_SMSound_AS3 = (soundObjects[sID] || null); + if (!s) return void; + // try to unload the sound + for (var i: int = 0, j: int = sounds.length; i < j; i++) { + if (sounds[i] == sID) { + sounds.splice(i, 1); + break; + } + } + if (s.soundChannel) { + s.soundChannel.stop(); + } + // if is a movie, remove that as well. + if (s.useNetstream) { + // s.nc.client = null; + try { + s.removeNetstreamEvents(); + // s.nc.removeEventListener(NetStatusEvent.NET_STATUS, s.doNetStatus); + } catch(e: Error) { + writeDebug('_destroySound(): Events already removed from netStream/netConnection?'); + } + if (s.didLoad) { + // TODO: figure out if stream is still open first, can't close an already-closed stream. + try { + s.ns.close(); + s.nc.close(); + } catch(e: Error) { + // oh well + writeDebug('_destroySound(): caught exception: '+e.toString()); + } + } + } else if (s.didLoad) { + // non-netstream case + try { + s.close(); // close stream only if still loading? + } catch(e: Error) { + // oh well + } + } + s = null; + soundObjects[sID] = null; + delete soundObjects[sID]; + } + + public function _stop(sID:String, bStopAll: Boolean) : void { + // stop this particular instance (or "all", based on parameter) + if (bStopAll) { + SoundMixer.stopAll(); + } else { + var s: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (!s) return void; + if (s.useNetstream && s.ns) { + s.ns.pause(); + } else if (s.soundChannel) { + s.soundChannel.stop(); + } + s.paused = false; + s.didJustBeforeFinish = false; + } + } + + public function _start(sID:String, nLoops: int, nMsecOffset: int) : void { + var s: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (!s) return void; + writeDebug('start: ' + nMsecOffset+(nLoops?', loops: '+nLoops:'')); + s.lastValues.paused = false; // reset pause if applicable + s.lastValues.loops = (nLoops || 1); + if (!s.useNetstream) { + s.lastValues.position = nMsecOffset; + } + s.handledDataError = false; // reset this flag + try { + s.start(nMsecOffset, nLoops); + } catch(e: Error) { + writeDebug('Could not start ' + sID + ': ' + e.toString()); + } + try { + registerOnComplete(sID); + } catch(e: Error) { + writeDebug('_start(): registerOnComplete failed'); + } + } + + public function _pause(sID:String) : void { + // writeDebug('_pause()'); + var s: SoundManager2_SMSound_AS3 = soundObjects[sID]; + if (!s) return void; + // writeDebug('s.paused: '+s.paused); + if (!s.paused) { + // reference current position, stop sound + s.paused = true; + // writeDebug('_pause(): position: '+s.lastValues.position); + if (s.useNetstream) { + if (s.ns) { + s.lastValues.position = s.ns.time; + s.ns.pause(); + } else if (s.autoPlay) { + s.setAutoPlay(false); + } + } else { + if (s.soundChannel) { + s.lastValues.position = s.soundChannel.position; + s.soundChannel.stop(); + } + } + } else { + // resume playing from last position + // writeDebug('resuming - playing at '+s.lastValues.position+', '+s.lastValues.loops+' times'); + s.paused = false; + if (s.useNetstream) { + s.ns.resume(); + } else { + s.start(s.lastValues.position, s.lastValues.loops); + } + try { + registerOnComplete(sID); + } catch(e: Error) { + writeDebug('_pause(): registerOnComplete() failed'); + } + } + } + + public function _setPan(sID:String, nPan:Number) : void { + if (soundObjects[sID]) { + soundObjects[sID].setPan(nPan); + } + } + + public function _setVolume(sID:String, nVol:Number) : void { + // writeDebug('_setVolume: '+nVol); + if (soundObjects[sID]) { + soundObjects[sID].setVolume(nVol); + } + } + + public function _setPolling(bPolling: Boolean = false, bUseHighPerformanceTimer: Boolean = false) : void { + pollingEnabled = bPolling; + if (timer == null && pollingEnabled) { + var nTimerInterval: uint = (bUseHighPerformanceTimer ? timerIntervalHighPerformance : timerInterval); + writeDebug('Enabling polling, ' + nTimerInterval + ' ms interval'); + timer = new Timer(nTimerInterval, 0); + timer.addEventListener(TimerEvent.TIMER, function() : void { + checkProgress(); + }); // direct reference eg. checkProgress doesn't work? .. odd. + timer.start(); + } else if (timer && !pollingEnabled) { + writeDebug('Disabling polling'); + // flash.utils.clearInterval(timer); + timer.reset(); + } + } + + public function _getMemoryUse() : String { + return System.totalMemory.toString(); + } + + // XML handler stuff + public function _loadFromXML(sURL:String) : void { + var loader: URLLoader = new URLLoader(); + loader.addEventListener(Event.COMPLETE, parseXML); + writeDebug('Attempting to load XML: ' + sURL); + try { + loader.load(new URLRequest(sURL)); + } catch(e: Error) { + writeDebug('Error loading XML: ' + e.toString()); + } + } + + public function parseXML(e: Event) : void { + try { + var oXML: XMLDocument = new XMLDocument(); + oXML.ignoreWhite = true; + oXML.parseXML(e.target.data); + var xmlRoot: XMLNode = oXML.firstChild; + var xmlAttr:Object = xmlRoot.attributes; + var oOptions:Object = {}; + var i: int = 0; + var j: int = 0; + for (i = 0, j = xmlRoot.childNodes.length; i < j; i++) { + xmlAttr = xmlRoot.childNodes[i].attributes; + oOptions = { + id: xmlAttr.id, + url: xmlRoot.attributes.baseHref + xmlAttr.href, + stream: xmlAttr.stream + } + ExternalInterface.call(baseJSController + ".createSound", oOptions); + } + } catch(e: Error) { + writeDebug('Error parsing XML: ' + e.toString()); + } + } + + // ----------------------------------- + // end methods + } + + // package + +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_SMSound_AS3.as b/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_SMSound_AS3.as new file mode 100755 index 0000000..f9a8c35 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/SoundManager2_SMSound_AS3.as @@ -0,0 +1,597 @@ +/* + SoundManager 2: Javascript Sound for the Web + ---------------------------------------------- + http://schillmania.com/projects/soundmanager2/ + + Copyright (c) 2007, Scott Schiller. All rights reserved. + Code licensed under the BSD License: + http://www.schillmania.com/projects/soundmanager2/license.txt + + Flash 9 / ActionScript 3 version +*/ + +package { + + import flash.external.*; + import flash.events.*; + import flash.media.Sound; + import flash.media.SoundChannel; + import flash.media.SoundLoaderContext; + import flash.media.SoundTransform; + import flash.media.SoundMixer; + import flash.net.URLRequest; + import flash.utils.ByteArray; + import flash.utils.getTimer; + import flash.net.NetConnection; + import flash.net.NetStream; + + public class SoundManager2_SMSound_AS3 extends Sound { + + public var sm: SoundManager2_AS3 = null; + // externalInterface references (for Javascript callbacks) + public var baseJSController: String = "soundManager"; + public var baseJSObject: String = baseJSController + ".sounds"; + public var soundChannel: SoundChannel = new SoundChannel(); + public var urlRequest: URLRequest; + public var soundLoaderContext: SoundLoaderContext; + public var waveformData: ByteArray = new ByteArray(); + public var waveformDataArray: Array = []; + public var eqData: ByteArray = new ByteArray(); + public var eqDataArray: Array = []; + public var usePeakData: Boolean = false; + public var useWaveformData: Boolean = false; + public var useEQData: Boolean = false; + public var sID: String; + public var sURL: String; + public var justBeforeFinishOffset: int; + public var didJustBeforeFinish: Boolean; + public var didFinish: Boolean; + public var loaded: Boolean; + public var connected: Boolean; + public var failed: Boolean; + public var paused: Boolean; + public var finished: Boolean; + public var duration: Number; + public var handledDataError: Boolean = false; + public var ignoreDataError: Boolean = false; + public var autoPlay: Boolean = false; + public var autoLoad: Boolean = false; + public var pauseOnBufferFull: Boolean = true; + public var loops: Number = 1; + public var lastValues: Object = { + bytes: 0, + position: 0, + volume: 100, + pan: 0, + loops: 1, + leftPeak: 0, + rightPeak: 0, + waveformDataArray: null, + eqDataArray: null, + isBuffering: null, + bufferLength: 0 + }; + public var didLoad: Boolean = false; + public var useEvents: Boolean = false; + public var sound: Sound = new Sound(); + + public var cc: Object; + public var nc: NetConnection; + public var ns: NetStream = null; + public var st: SoundTransform; + public var useNetstream: Boolean; + public var bufferTime: Number = 3; // previously 0.1 + public var bufferTimes: Array; // an array of integers (for specifying multiple buffers) + public var lastNetStatus: String = null; + public var serverUrl: String = null; + + public var start_time: Number; + public var connect_time: Number; + public var play_time: Number; + public var recordStats: Boolean = false; + public var checkPolicyFile:Boolean = false; + + public function SoundManager2_SMSound_AS3(oSoundManager: SoundManager2_AS3, sIDArg: String = null, sURLArg: String = null, usePeakData: Boolean = false, useWaveformData: Boolean = false, useEQData: Boolean = false, useNetstreamArg: Boolean = false, netStreamBufferTime: Number = 1, serverUrl: String = null, duration: Number = 0, autoPlay: Boolean = false, useEvents: Boolean = false, bufferTimes: Array = null, recordStats: Boolean = false, autoLoad: Boolean = false, checkPolicyFile: Boolean = false) { + this.sm = oSoundManager; + this.sID = sIDArg; + this.sURL = sURLArg; + this.usePeakData = usePeakData; + this.useWaveformData = useWaveformData; + this.useEQData = useEQData; + this.urlRequest = new URLRequest(sURLArg); + this.justBeforeFinishOffset = 0; + this.didJustBeforeFinish = false; + this.didFinish = false; // non-MP3 formats only + this.loaded = false; + this.connected = false; + this.failed = false; + this.finished = false; + this.soundChannel = null; + this.lastNetStatus = null; + this.useNetstream = useNetstreamArg; + this.serverUrl = serverUrl; + this.duration = duration; + this.recordStats = recordStats; + this.useEvents = useEvents; + this.autoLoad = autoLoad; + if (netStreamBufferTime) { + this.bufferTime = netStreamBufferTime; + } + // Use bufferTimes instead of bufferTime + if (bufferTimes !== null) { + this.bufferTimes = bufferTimes; + } else { + this.bufferTimes = [this.bufferTime]; + } + setAutoPlay(autoPlay); + if (recordStats) { + this.start_time = getTimer(); + } + this.checkPolicyFile = checkPolicyFile; + + writeDebug('SoundManager2_SMSound_AS3: Got duration: '+duration+', autoPlay: '+autoPlay); + + if (this.useNetstream) { + + this.cc = new Object(); + this.nc = new NetConnection(); + + // Handle FMS bandwidth check callback. + // @see onBWDone + // @see http://www.adobe.com/devnet/flashmediaserver/articles/dynamic_stream_switching_04.html + // @see http://www.johncblandii.com/index.php/2007/12/fms-a-quick-fix-for-missing-onbwdone-onfcsubscribe-etc.html + this.nc.client = this; + + // TODO: security/IO error handling + // this.nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, doSecurityError); + nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + + if (this.serverUrl != null) { + writeDebug('SoundManager2_SMSound_AS3: NetConnection: connecting to server ' + this.serverUrl + '...'); + } + this.nc.connect(serverUrl); + } else { + this.connect_time = this.start_time; + this.connected = true; + } + + } + + public function netStatusHandler(event:NetStatusEvent):void { + + if (this.useEvents) { + writeDebug('netStatusHandler: '+event.info.code); + } + + switch (event.info.code) { + + case "NetConnection.Connect.Success": + writeDebug('NetConnection: connected'); + try { + this.ns = new NetStream(this.nc); + this.ns.checkPolicyFile = this.checkPolicyFile; + // bufferTime reference: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetStream.html#bufferTime + this.ns.bufferTime = getStartBuffer(); // set to 0.1 or higher. 0 is reported to cause playback issues with static files. + this.st = new SoundTransform(); + this.cc.onMetaData = this.metaDataHandler; + this.ns.client = this.cc; + this.ns.receiveAudio(true); + this.addNetstreamEvents(); + + this.connected = true; + if (recordStats) { + this.recordConnectTime(); + } + if (this.useEvents) { + writeDebug('firing _onconnect for '+this.sID); + ExternalInterface.call(this.sm.baseJSObject + "['" + this.sID + "']._onconnect", 1); + } + } catch(e: Error) { + this.failed = true; + writeDebug('netStream error: ' + e.toString()); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", 'Connection failed!', event.info.level, event.info.code); + } + break; + + case "NetStream.Play.StreamNotFound": + this.failed = true; + writeDebug("NetConnection: Stream not found!"); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", 'Stream not found!', event.info.level, event.info.code); + break; + + // This is triggered when the sound loses the connection with the server. + // In some cases one could just try to reconnect to the server and resume playback. + // However for streams protected by expiring tokens, I don't think that will work. + // + // Flash says that this is not an error code, but a status code... + // should this call the onFailure handler? + case "NetConnection.Connect.Closed": + this.failed = true; + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", 'Connection closed!', event.info.level, event.info.code); + writeDebug("NetConnection: Connection closed!"); + break; + + // Couldn't establish a connection with the server. Attempts to connect to the server + // can also fail if the permissible number of socket connections on either the client + // or the server computer is at its limit. This also happens when the internet + // connection is lost. + case "NetConnection.Connect.Failed": + this.failed = true; + writeDebug("NetConnection: Connection failed! Lost internet connection? Try again... Description: " + event.info.description); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", 'Connection failed!', event.info.level, event.info.code); + break; + + // A change has occurred to the network status. This could mean that the network + // connection is back, or it could mean that it has been lost...just try to resume + // playback. + + // KJV: Can't use this yet because by the time you get your connection back the + // song has reached it's maximum retries, so it doesn't retry again. We need + // a new _ondisconnect handler. + //case "NetConnection.Connect.NetworkChange": + // this.failed = true; + // writeDebug("NetConnection: Network connection status changed"); + // ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", 'Reconnecting...'); + // break; + + // Consider everything else a failure... + default: + this.failed = true; + writeDebug("NetConnection: got unhandled code '" + event.info.code + "'! Description: " + event.info.description); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", '', event.info.level, event.info.code); + break; + } + + } + + // Set the buffer size on the current NetSream instance to buffer secs + // Only set the buffer if it's different to the current buffer. + public function setBuffer(buffer: int) : void { + if (buffer != this.ns.bufferTime) { + this.ns.bufferTime = buffer; + writeDebug('set buffer to '+this.ns.bufferTime+' secs'); + } + } + + // Return the size of the starting buffer. + public function getStartBuffer() : int { + return this.bufferTimes[0]; + } + + // Return the size of the next buffer, given the size of the current buffer. + // If there are no more buffers, returns the current buffer size. + public function getNextBuffer(current_buffer: int) : int { + var i: int = bufferTimes.indexOf(current_buffer); + if (i == -1) { + // Couldn't find the buffer, start from the start buffer size + return getStartBuffer(); + } else if (i + 1 >= bufferTimes.length) { + // Last (or only) buffer, keep the current buffer + return current_buffer; + } else { + return this.bufferTimes[i+1]; + } + } + + public function writeDebug (s: String, bTimestamp: Boolean = false) : Boolean { + return this.sm.writeDebug (s, bTimestamp); // defined in main SM object + } + + public function metaDataHandler(infoObject: Object) : void { + /* + var data:String = new String(); + for (var prop:* in infoObject) { + data += prop+': '+infoObject[prop]+' '; + } + ExternalInterface.call('soundManager._writeDebug','Metadata: '+data); + */ + if (!this.loaded) { + // writeDebug('not loaded yet: '+this.ns.bytesLoaded+', '+this.ns.bytesTotal+', '+infoObject.duration*1000); + // TODO: investigate loaded/total values + // ExternalInterface.call(baseJSObject + "['" + this.sID + "']._whileloading", this.ns.bytesLoaded, this.ns.bytesTotal, infoObject.duration*1000); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._whileloading", this.bytesLoaded, this.bytesTotal, (infoObject.duration || this.duration)) + } + this.duration = infoObject.duration * 1000; + // null this out for the duration of this object's existence. + // it may be called multiple times. + this.cc.onMetaData = function(infoObject: Object) : void {} + + } + + public function getWaveformData() : void { + // http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundMixer.html#computeSpectrum() + SoundMixer.computeSpectrum(this.waveformData, false, 0); // sample wave data at 44.1 KHz + this.waveformDataArray = []; + for (var i: int = 0, j: int = this.waveformData.length / 4; i < j; i++) { // get all 512 values (256 per channel) + this.waveformDataArray.push(int(this.waveformData.readFloat() * 1000) / 1000); + } + } + + public function getEQData() : void { + // http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundMixer.html#computeSpectrum() + SoundMixer.computeSpectrum(this.eqData, true, 0); // sample EQ data at 44.1 KHz + this.eqDataArray = []; + for (var i: int = 0, j: int = this.eqData.length / 4; i < j; i++) { // get all 512 values (256 per channel) + this.eqDataArray.push(int(this.eqData.readFloat() * 1000) / 1000); + } + } + + public function start(nMsecOffset: int, nLoops: int) : void { + this.useEvents = true; + if (this.useNetstream) { + + writeDebug("SMSound::start nMsecOffset "+ nMsecOffset+ ' nLoops '+nLoops + ' current bufferTime '+this.ns.bufferTime+' current bufferLength '+this.ns.bufferLength+ ' this.lastValues.position '+this.lastValues.position); + + this.cc.onMetaData = this.metaDataHandler; + + // Don't seek if we don't have to because it destroys the buffer + var set_position:Boolean = this.lastValues.position != null && this.lastValues.position != nMsecOffset; + if (set_position) { + // Minimize the buffer so playback starts ASAP + this.setBuffer(this.getStartBuffer()); + } + + if (this.paused) { + writeDebug('start: resuming from paused state'); + this.ns.resume(); // get the sound going again + if (!this.didLoad) { + this.didLoad = true; + } + this.paused = false; + } else if (!this.didLoad) { + writeDebug('start: !didLoad - playing '+this.sURL); + this.ns.play(this.sURL); + this.didLoad = true; + this.paused = false; + } else { + // previously loaded, perhaps stopped/finished. play again? + writeDebug('playing again (not paused, didLoad = true)'); + this.ns.play(this.sURL); + } + + // KJV seek after calling play otherwise some streams get a NetStream.Seek.Failed + // Should only apply to the !didLoad case, but do it for all for simplicity. + // nMsecOffset is in milliseconds for streams but in seconds for progressive + // download. + if (set_position) { + this.ns.seek(this.serverUrl ? nMsecOffset / 1000 : nMsecOffset); + this.lastValues.position = nMsecOffset; // https://gist.github.com/1de8a3113cf33d0cff67 + } + + // this.ns.addEventListener(Event.SOUND_COMPLETE, _onfinish); + this.applyTransform(); + + } else { + // writeDebug('start: seeking to '+nMsecOffset+', '+nLoops+(nLoops==1?' loop':' loops')); + this.soundChannel = this.play(nMsecOffset, nLoops); + this.addEventListener(Event.SOUND_COMPLETE, _onfinish); + this.applyTransform(); + } + + } + + private function _onfinish() : void { + this.removeEventListener(Event.SOUND_COMPLETE, _onfinish); + } + + public function loadSound(sURL: String, bStream: Boolean) : void { + if (this.useNetstream) { + this.useEvents = true; + if (this.didLoad != true) { + ExternalInterface.call('loadSound(): loading ' + this.sURL); + this.ns.play(this.sURL); + this.didLoad = true; + } + // this.addEventListener(Event.SOUND_COMPLETE, _onfinish); + this.applyTransform(); + } else { + try { + this.didLoad = true; + this.urlRequest = new URLRequest(sURL); + this.soundLoaderContext = new SoundLoaderContext(1000, this.checkPolicyFile); // check for policy (crossdomain.xml) file on remote domains - http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundLoaderContext.html + this.load(this.urlRequest, this.soundLoaderContext); + } catch(e: Error) { + writeDebug('error during loadSound(): ' + e.toString()); + } + } + } + + public function setAutoPlay(autoPlay: Boolean) : void { + if (!this.serverUrl) { + // don't apply to non-RTMP, netstream stuff. + this.autoPlay = true; + this.pauseOnBufferFull = false; + } else { + this.autoPlay = autoPlay; + if (this.autoPlay) { + this.pauseOnBufferFull = false; + // writeDebug('ignoring pauseOnBufferFull because autoPlay is on'); + } else if (!this.autoPlay) { + this.pauseOnBufferFull = true; + // writeDebug('pausing on buffer full because autoPlay is off'); + } + } + } + + public function setVolume(nVolume: Number) : void { + this.lastValues.volume = nVolume / 100; + this.applyTransform(); + } + + public function setPan(nPan: Number) : void { + this.lastValues.pan = nPan / 100; + this.applyTransform(); + } + + public function applyTransform() : void { + var st: SoundTransform = new SoundTransform(this.lastValues.volume, this.lastValues.pan); + if (this.useNetstream) { + if (this.ns) { + this.ns.soundTransform = st; + } else { + // writeDebug('applyTransform(): Note: No active netStream'); + } + } else if (this.soundChannel) { + this.soundChannel.soundTransform = st; // new SoundTransform(this.lastValues.volume, this.lastValues.pan); + } + } + + public function recordPlayTime() : void { + this.play_time = Math.round(getTimer() - (this.start_time + this.connect_time)); + writeDebug('Play took '+ this.play_time + ' ms'); + // We must now have both stats, call the onstats callback + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onstats", { + play_time: this.play_time, + connect_time: this.connect_time + }); + // Stop tracking any stats for this object + this.recordStats = false; + } + + public function recordConnectTime() : void { + this.connect_time = Math.round(getTimer() - this.start_time); + writeDebug('Connect took '+ this.connect_time + ' ms'); + } + + // Handle FMS bandwidth check callback. + // @see http://www.adobe.com/devnet/flashmediaserver/articles/dynamic_stream_switching_04.html + // @see http://www.johncblandii.com/index.php/2007/12/fms-a-quick-fix-for-missing-onbwdone-onfcsubscribe-etc.html + public function onBWDone() : void { + // writeDebug('onBWDone: called and ignored'); + } + + // NetStream client callback. Invoked when the song is complete. + public function onPlayStatus(info:Object):void { + writeDebug('onPlayStatus called with '+info); + switch(info.code) { + case "NetStream.Play.Complete": + writeDebug('Song has finished!'); + break; + } + } + + public function doIOError(e: IOErrorEvent) : void { + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onload", 0); // call onload, assume it failed. + // there was a connection drop, a loss of internet connection, or something else wrong. 404 error too. + } + + public function doAsyncError(e: AsyncErrorEvent) : void { + writeDebug('asyncError: ' + e.text); + } + + public function doNetStatus(e: NetStatusEvent) : void { + + // Handle failures + if (e.info.code == "NetStream.Failed" + || e.info.code == "NetStream.Play.FileStructureInvalid" + || e.info.code == "NetStream.Play.StreamNotFound") { + + this.lastNetStatus = e.info.code; + writeDebug('netStatusEvent: ' + e.info.code); + this.failed = true; + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfailure", '', e.info.level, e.info.code); + return; + } + + writeDebug('netStatusEvent: ' + e.info.code); // KJV we like to see all events + + // When streaming, Stop is called when buffering stops, not when the stream is actually finished. + // @see http://www.actionscript.org/forums/archive/index.php3/t-159194.html + if (e.info.code == "NetStream.Play.Stop") { + + if (!this.useNetstream) { + // finished playing + // this.didFinish = true; // will be reset via JS callback + this.didJustBeforeFinish = false; // reset + writeDebug('calling onfinish for a sound'); + // reset the sound? Move back to position 0? + this.sm.checkProgress(); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfinish"); + } + + } else if (e.info.code == "NetStream.Play.Start" || e.info.code == "NetStream.Buffer.Empty" || e.info.code == "NetStream.Buffer.Full") { + + // First time buffer has filled. Print debugging output. + if (this.recordStats && !this.play_time) { + this.recordPlayTime(); + } + + // RTMP case.. + // We wait for the buffer to fill up before pausing the just-loaded song because only if the + // buffer is full will the song continue to buffer until the user hits play. + if (this.serverUrl && e.info.code == "NetStream.Buffer.Full" && this.pauseOnBufferFull) { + this.ns.pause(); + this.paused = true; + this.pauseOnBufferFull = false; + // Call pause in JS. This will call back to us to pause again, but + // that should be harmless. + writeDebug('Pausing song because buffer is full'); + ExternalInterface.call(baseJSObject + "['" + this.sID + "'].pause", false); + } + + // The buffer is full. Increase its size if possible. + // Double buffering has not been shown to cause false starts, so this is safe. + if (e.info.code == "NetStream.Buffer.Full") { + var next_buffer: int = this.getNextBuffer(this.ns.bufferTime); + if (next_buffer != this.ns.bufferTime) { + this.setBuffer(next_buffer); + } + } + + var isNetstreamBuffering: Boolean = (e.info.code == "NetStream.Buffer.Empty" || e.info.code == "NetStream.Play.Start"); + // assume buffering when we start playing, eg. initial load. + if (isNetstreamBuffering != this.lastValues.isBuffering) { + this.lastValues.isBuffering = isNetstreamBuffering; + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onbufferchange", this.lastValues.isBuffering ? 1 : 0); + } + + // We can detect the end of the stream when Play.Stop is called followed by Buffer.Empty. + // However, if you pause and let the whole song buffer, Buffer.Flush is called followed by + // Buffer.Empty, so handle that case too. + // + // Ignore this event if we are more than 5 seconds from the end of the song. + if (e.info.code == "NetStream.Buffer.Empty" && (this.lastNetStatus == 'NetStream.Play.Stop' || this.lastNetStatus == 'NetStream.Buffer.Flush')) { + if (this.duration && (this.ns.time * 1000) < (this.duration - 5000)) { + writeDebug('Ignoring Buffer.Empty because this is too early to be the end of the stream! (sID: '+this.sID+', time: '+(this.ns.time*1000)+', duration: '+this.duration+')'); + } else { + this.didJustBeforeFinish = false; // reset + this.finished = true; + writeDebug('calling onfinish for sound '+this.sID); + this.sm.checkProgress(); + ExternalInterface.call(baseJSObject + "['" + this.sID + "']._onfinish"); + } + + } else if (e.info.code == "NetStream.Buffer.Empty") { + + // The buffer is empty. Start from the smallest buffer again. + this.setBuffer(this.getStartBuffer()); + } + } + + // Remember the last NetStatus event + this.lastNetStatus = e.info.code; + } + + // KJV The sound adds some of its own netstatus handlers so we don't need to do it here. + public function addNetstreamEvents() : void { + ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, doAsyncError); + ns.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus); + ns.addEventListener(IOErrorEvent.IO_ERROR, doIOError); + } + + public function removeNetstreamEvents() : void { + ns.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, doAsyncError); + ns.removeEventListener(NetStatusEvent.NET_STATUS, doNetStatus); + ns.addEventListener(NetStatusEvent.NET_STATUS, dummyNetStatusHandler); + ns.removeEventListener(IOErrorEvent.IO_ERROR, doIOError); + // KJV Stop listening for NetConnection events on the sound + nc.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + } + + // Prevents possible 'Unhandled NetStatusEvent' condition if a sound is being + // destroyed and interacted with at the same time. + public function dummyNetStatusHandler(e: NetStatusEvent) : void { + // Don't do anything + } + } +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.bat b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.bat new file mode 100755 index 0000000..fcab423 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.bat @@ -0,0 +1,5 @@ +@REM this builds the soundmanager 2 SWF from source + +mtasc -swf ../swf/soundmanager2_debug.swf -main -header 16:16:30 SoundManager2.as -version 8 +@pause + diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.sh b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.sh new file mode 100755 index 0000000..8857d15 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash8.sh @@ -0,0 +1,2 @@ +#!/bin/bash +/Applications/mtasc/mtasc -swf ../swf/soundmanager2_debug.swf -main -header 16:16:30 SoundManager2.as -version 8 diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.bat b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.bat new file mode 100755 index 0000000..ed63934 --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.bat @@ -0,0 +1,4 @@ +@REM this builds the soundmanager 2 SWF from source +@REM using mxmlc from the Adobe open-source Flex SDK + +c:\progra~1\flexsdk\bin\mxmlc -debug=true -use-network=false -static-link-runtime-shared-libraries=true -optimize=true -o ../swf/soundmanager2_flash9_debug.swf -file-specs SoundManager2_AS3.as diff --git a/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.sh b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.sh new file mode 100755 index 0000000..ec6041c --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/src/make-flash9.sh @@ -0,0 +1,2 @@ +#!/bin/bash +/Applications/flexsdk/bin/mxmlc -debug=true -static-link-runtime-shared-libraries=true -optimize=true -o ../swf/soundmanager2_flash9_debug.swf -file-specs SoundManager2_AS3.as diff --git a/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2.swf b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2.swf new file mode 100755 index 0000000..4d2dc23 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2.swf differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_debug.swf b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_debug.swf new file mode 100755 index 0000000..01ce0ea Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_debug.swf differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9.swf b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9.swf new file mode 100755 index 0000000..dad27ea Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9.swf differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9_debug.swf b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9_debug.swf new file mode 100755 index 0000000..cdffb46 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash9_debug.swf differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash_xdomain.zip b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash_xdomain.zip new file mode 100755 index 0000000..2ac8781 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/swf/soundmanager2_flash_xdomain.zip differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.css b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.css new file mode 100755 index 0000000..2b0b8ae --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.css @@ -0,0 +1,120 @@ +/* SM2 troubleshooting CSS */ + +#sm2-test { + position:relative; + background:#f6f6f6; + border:1px solid #eee; + padding:3px; +} + +#sm2-test, +#sm2-test ul.items { + -moz-border-radius:3px; + -khtml-border-radius:3px; + -webkit-border-radius:3px; +} + +#sm2-test ul.items { + position:relative; + background:#fff; + list-style-type:none; + margin:0px; + padding:0px; + border:1px solid #ccc; +} + +#sm2-test ul.items li { + position:relative; + margin-left:0.5em; + padding-left:0.5em; + margin-right:0.5em; + padding-right:0.5em; +} + +#sm2-test ul.items li h3 { + padding-top:0.3em; + margin-top:0px; + border-bottom:1px solid #ccc; +} + +#sm2-test ul.items li:last-child h3 { + border-bottom:none; +} + +#sm2-test ul.items li div.details { + border-bottom:1px solid #ccc; +} + +#sm2-test ul.items li:hover div.details { + border-bottom:1px solid #ccc; +} + +#sm2-test ul.items li.open:last-child h3, +#sm2-test ul.items li.fail:last-child h3, +#sm2-test ul.items li:last-child div.details:last-child { + border-bottom:1px solid #fff; +} + +#sm2-test ul.items li div.details { + display:none; +} + +#sm2-test ul.items li.open div.details, +#sm2-test ul.items li.unknown div.details, +#sm2-test ul.items li.fail div.details { + display:block; +} + +#sm2-test ul.items li span.yay, +#sm2-test ul.items li span.boo, +#sm2-test ul.items li span.default, +#sm2-test ul.items li span.unknown { + display:none; +} + +#sm2-test ul.items li span.yay, +#sm2-test ul.items li.pass span.msg { + color:green; +} + +#sm2-test ul.items li span.boo, +#sm2-test ul.items li.fail span.msg { + color:red; +} + +#sm2-test ul.items li span.default, +#sm2-test ul.items li.default span.msg { + color:#ccc; +} + +#sm2-test ul.items li span.unknown, +#sm2-test ul.items li.unknown span.msg { + color:#666; +} + +#sm2-test ul.items li.default span.msg { + display:none; /* hide messages in the event a reset occurs */ +} + +#sm2-test ul.items li.pass span.yay, +#sm2-test ul.items li.fail span.boo, +#sm2-test ul.items li.default span.default, +#sm2-test ul.items li.unknown span.unknown { + float:right; + display:inline; +} + +#sm2-container.flash_debug { + /* flash movie, when soundManager.debugFlash = true */ + position:relative; + width:auto; + height:300px; + width:100%; + background:#f6f6f6; + border:1px solid #ccc; +} + +#sm2-container.flash_debug object, +#sm2-container.flash_debug embed { + border:1px solid #fff; +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.js b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.js new file mode 100755 index 0000000..052955a --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/debug.js @@ -0,0 +1,173 @@ +// SoundManager 2 start-up troubleshooting tool + +// FlashDetect, by Carl Yestrau +// http://www.featureblend.com/license.txt +var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){} +return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){} +return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){} +return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i'+soundManager.url+''; + if (soundManager.getMoviePercent() == 100) { + // SWF may have already loaded + fOnComplete(true,msg); + } else { + try { + xhr.open("HEAD",sURL,true); + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + if (xhr.status == '200') { + fOnComplete(true,msg); + } else if (xhr.status == '404') { + fOnComplete(false,msg); + } else { + // some other response + fOnComplete('unknown',(xhr.status != '0'?'HTTP response: '+xhr.status+', ':'')+msg); // safari returns 0 when offline + } + } + } + xhr.send(null); + + } catch(e) { + // fail (cross-domain, or no XHR) unless offline + fOnComplete('unknown',msg); + return false; + } + } + } + + this.handleEvent = function(sEventType,bSuccess,sMessage) { + var o = elements[sEventType]; + if (o) { + o.className = (bSuccess == true?'pass':(bSuccess != false?bSuccess:'fail')); // true = pass, className as argument, or false == fail + if (sMessage) { + var oSpan = o.getElementsByTagName('span')[4]; + if (oSpan) { + oSpan.innerHTML = (oSpan.innerHTML +' '+sMessage+''); + } else { + o.title = sMessage; + } + } + // associated events + if (sEventType == 'onload') { + if (bSuccess) { + self.doSoundTest(); + } else { + self.testURL(soundManager.url,function(bSuccess,sMessage) { + if (typeof sMessage == 'undefined') { + sMessage = null; + } + self.handleEvent('swf',bSuccess,sMessage); + }); + } + } else if (sEventType == 'swf') { + if (bSuccess == false) { + // don't show flashtojs at all if SWF failed to load + self.handleEvent('flashtojs','default'); // reset to N/A status + } + } else if (sEventType == 'flashtojs') { + if (bSuccess != true) { + // online or offline help messages + if (soundManager._overHTTP) { + document.getElementById('d-flashtojs-offline').style.display = 'none'; + } else { + document.getElementById('d-flashtojs-online').style.display = 'none'; + } + } + } + } else { + soundManager._writeDebug('SM2 debugger warning: Undefined event type "'+sEventType+'"',1); + } + } + + this.doSoundTest = function() { + var foo = soundManager.createSound({ + id: 'sm2TestSound', + url: ('http://schillmania.com/projects/soundmanager2/demo/_mp3/mouseover.mp3') + }); + if (!soundManager._disabled) { + foo.play(); + // looks to be OK.. + if (!soundManager._disabled) { + // still OK.. + self.handleEvent('soundtest',true); + } else { + self.handleEvent('soundtest',false,': Failed after play()'); + } + } else { + self.handleEvent('soundtest',false,': Failed after createSound()'); + } + } + + this.init = function() { + // map event elements to DOM nodes - eg. elements.flashtojs = document.getElementById('d-flashtojs'); + for (var i=elementIDs.length; i--;) { + elements[elementIDs[i]] = document.getElementById('d-'+elementIDs[i]); + } + self.doFlashTest(); + } + + this.doFlashTest = function() { + var fd = FlashDetect; + var hasFlash = fd.installed; + var isSupported = (hasFlash && fd.major >= soundManager.flashVersion); + var flashVersion = fd.major+'.'+fd.minor+'.'+fd.revisionStr; + var flashInfo = ' version '+(!isSupported?'unsupported ('+flashVersion+', SWF version '+soundManager.flashVersion+')':flashVersion); + document.getElementById('d-flashversion').innerHTML = 'soundManager.flashVersion = '+soundManager.flashVersion+';'; + self.handleEvent('hasflash',isSupported,hasFlash?flashInfo:null); + } + + soundManager.debugFlash = true; // try to get flash debug output, as well + + this.init(); + +} + +function sm2DebugInit() { + sm2Debugger = new SM2Debugger(); +} \ No newline at end of file diff --git a/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-add-location.png b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-add-location.png new file mode 100755 index 0000000..61db61c Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-add-location.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-added-location.png b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-added-location.png new file mode 100755 index 0000000..6cf1c19 Binary files /dev/null and b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/fpgss-added-location.png differ diff --git a/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/index.html b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/index.html new file mode 100755 index 0000000..c371d1a --- /dev/null +++ b/docs/dymaxion/soundmanagerv297a-20101010/troubleshoot/index.html @@ -0,0 +1,154 @@ + + + +SoundManager 2 Start-up Test / Troubleshooting Tool + + + + + + + + + + + + + + + + + + + + + + + +
    + +

    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.

        +
      • +
      • + 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.

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