]> git.parisson.com Git - telemeta.git/commitdiff
revert to soundmanager v2.90a.20081028, soundManager.url is broken in v2.91
authorolivier <>
Fri, 12 Dec 2008 18:45:01 +0000 (18:45 +0000)
committerolivier <>
Fri, 12 Dec 2008 18:45:01 +0000 (18:45 +0000)
telemeta/htdocs/js/soundmanager2.js
telemeta/htdocs/swf/soundmanager2.swf
telemeta/htdocs/swf/soundmanager2_flash9.swf

index 631814fd8498e0e3c803b5c27e7ffbc6904a6729..216115cea532391a80c9707a74cc791cc2b465d4 100644 (file)
@@ -7,11 +7,9 @@
    Code licensed under the BSD License:\r
    http://schillmania.com/projects/soundmanager2/license.txt\r
 \r
-   V2.91a.20081205\r
+   V2.90a.20081028\r
 */\r
 \r
-var soundManager = null;\r
-\r
 function SoundManager(smURL,smID) {\r
  \r
   this.flashVersion = 8;           // version of flash to require, either 8 or 9. Some API features require Flash 9.\r
@@ -23,7 +21,7 @@ function SoundManager(smURL,smID) {
   this.allowPolling = true;        // allow flash to poll for status update (required for "while playing", peak, sound spectrum functions to work.)\r
   this.useMovieStar = false;      // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio + video formats (AAC, M4V, FLV, MOV etc.)\r
   this.useHighPerformance = true;  // flash positioning trick, improves JS/flash callback speed, minimizes delay\r
-  this.bgColor = '#ffffff';               // movie (.swf) background color, useful if showing on-screen for video etc.\r
+  this.bgColor = '#ffffff';       // movie (.swf) background color, useful if showing on-screen for video etc.\r
 \r
   this.defaultOptions = {\r
     '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)\r
@@ -50,25 +48,25 @@ function SoundManager(smURL,smID) {
   };\r
 \r
   this.flash9Options = {           // flash 9-only options, merged into defaultOptions if flash 9 is being used\r
-    'isMovieStar': null,                  // "MovieStar" MPEG4 audio/video mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL\r
+    'isMovieStar': null,          // "MovieStar" MPEG4 audio/video mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL\r
     'usePeakData': false,          // enable left/right channel peak (level) data\r
     'useWaveformData': false,      // enable sound spectrum (raw waveform data) - WARNING: CPU-INTENSIVE: may set CPUs on fire.\r
     'useEQData': false             // enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.\r
   };\r
 \r
   this.movieStarOptions = {        // flash 9.0r115+ MPEG4 audio/video options, merged into defaultOptions if flash 9 + movieStar mode is enabled\r
-    'onmetadata': null,                           // callback for when video width/height etc. are received\r
-    'useVideo': false                     // if loading movieStar content, whether to show video\r
-  };\r
-\r
-  // jslint global declarations\r
-  /*global alert, console, document, navigator, setTimeout, window */\r
+    'onmetadata': null,                   // callback for when video width/height etc. are received\r
+    'useVideo': false             // if loading movieStar content, whether to show video\r
+  }\r
 \r
-  var SMSound = null; // defined later\r
+  this.flashBlockHelper = {\r
+    'enabled': false,              // experimental, removed with >v2.80\r
+    'message': []                  // "nag bar" to show when messaging the user, if SM2 fails on firefox etc.\r
+  };\r
 \r
-  var _s = this;\r
+  var _s = this; \r
   this.version = null;\r
-  this.versionNumber = 'V2.91a.20081205';\r
+  this.versionNumber = 'V2.90a.20081028';\r
   this.movieURL = null;\r
   this.url = null;\r
   this.altURL = null;\r
@@ -77,7 +75,7 @@ function SoundManager(smURL,smID) {
   this.o = null;\r
   this.id = (smID||'sm2movie');\r
   this.oMC = null;\r
-  this.sounds = {};\r
+  this.sounds = [];\r
   this.soundIDs = [];\r
   this.muted = false;\r
   this.isIE = (navigator.userAgent.match(/MSIE/i));\r
@@ -93,12 +91,10 @@ function SoundManager(smURL,smID) {
   this._hasConsole = (typeof console != 'undefined' && typeof console.log != 'undefined');\r
   this._debugLevels = ['log','info','warn','error'];\r
   this._defaultFlashVersion = 8;\r
-\r
   this.filePatterns = {\r
-    flash8: /.mp3/i,\r
-    flash9: /.mp3/i\r
+    flash8: /\.(mp3)/i,\r
+    flash9: /\.(mp3)/i\r
   };\r
-\r
   this.netStreamTypes = ['aac','flv','mov','mp4','m4v','f4v','m4a','mp4v','3gp','3g2']; // Flash v9.0r115+ "moviestar" formats\r
   this.netStreamPattern = new RegExp('.('+this.netStreamTypes.join('|')+')','i');\r
   this.filePattern = null;\r
@@ -140,7 +136,7 @@ function SoundManager(smURL,smID) {
     _s.filePattern = _s.filePatterns[(_s.flashVersion!=8?'flash9':'flash8')];\r
     _s.movieURL = (_s.flashVersion==8?'soundmanager2.swf':'soundmanager2_flash9.swf');\r
     _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_s.flashVersion==9);\r
-  };\r
+  }\r
 \r
   this._overHTTP = (document.location?document.location.protocol.match(/http/i):null);\r
   this._waitingforEI = false;\r
@@ -169,26 +165,24 @@ function SoundManager(smURL,smID) {
     } catch(e) {\r
       _s._failSafely();\r
       return true;\r
-    }\r
+    };\r
   };\r
 \r
   this.createSound = function(oOptions) {\r
-    if (!_s._didInit) {\r
-         throw new Error('soundManager.createSound(): Not loaded yet - wait for soundManager.onload() before calling sound-related methods');\r
-       }\r
-    if (arguments.length == 2) {\r
+    if (!_s._didInit) throw new Error('soundManager.createSound(): Not loaded yet - wait for soundManager.onload() before calling sound-related methods');\r
+    if (arguments.length==2) {\r
       // function overloading in JS! :) ..assume simple createSound(id,url) use case\r
-      oOptions = {'id':arguments[0],'url':arguments[1]};\r
-    }\r
+      var oOptions = {'id':arguments[0],'url':arguments[1]};\r
+    };\r
     var thisOptions = _s._mergeObjects(oOptions); // inherit SM2 defaults\r
     var _tO = thisOptions; // alias\r
     _s._wD('soundManager.createSound(): '+_tO.id+' ('+_tO.url+')',1);\r
     if (_s._idCheck(_tO.id,true)) {\r
       _s._wD('soundManager.createSound(): '+_tO.id+' exists',1);\r
       return _s.sounds[_tO.id];\r
-    }\r
+    };\r
     if (_s.flashVersion > 8 && _s.useMovieStar) {\r
-         if (_tO.isMovieStar === null) {\r
+         if (_tO.isMovieStar == null) {\r
            _tO.isMovieStar = (_tO.url.match(_s.netStreamPattern)?true:false);\r
          }\r
          if (_tO.isMovieStar) {\r
@@ -200,7 +194,7 @@ function SoundManager(smURL,smID) {
                _tO.useWaveformData = false;\r
                _tO.useEQData = false;\r
          }\r
-    }\r
+    };\r
     _s.sounds[_tO.id] = new SMSound(_tO);\r
     _s.soundIDs[_s.soundIDs.length] = _tO.id;\r
     // AS2:\r
@@ -208,7 +202,7 @@ function SoundManager(smURL,smID) {
       _s.o._createSound(_tO.id,_tO.onjustbeforefinishtime);\r
     } else {\r
       _s.o._createSound(_tO.id,_tO.url,_tO.onjustbeforefinishtime,_tO.usePeakData,_tO.useWaveformData,_tO.useEQData,_tO.isMovieStar,(_tO.isMovieStar?_tO.useVideo:false));\r
-    }\r
+    };\r
     if (_tO.autoLoad || _tO.autoPlay) {\r
       window.setTimeout(function() {\r
         if (_s.sounds[_tO.id]) {\r
@@ -228,8 +222,8 @@ function SoundManager(smURL,smID) {
 \r
   this.createVideo = function(oOptions) {\r
     if (arguments.length==2) {\r
-      oOptions = {'id':arguments[0],'url':arguments[1]};\r
-    }\r
+      var oOptions = {'id':arguments[0],'url':arguments[1]};\r
+    };\r
     if (_s.flashVersion >= 9) {\r
       oOptions.isMovieStar = true;\r
       oOptions.useVideo = true;\r
@@ -241,19 +235,17 @@ function SoundManager(smURL,smID) {
       _s._wD('soundManager.createVideo(): MovieStar mode not enabled. Exiting.',2);\r
     }\r
     return _s.createSound(oOptions);\r
-  };\r
+  }\r
 \r
   this.destroySound = function(sID,bFromSound) {\r
     // explicitly destroy a sound before normal page unload, etc.\r
-    if (!_s._idCheck(sID)) {\r
-      return false;\r
-    }\r
+    if (!_s._idCheck(sID)) return false;\r
     for (var i=0; i<_s.soundIDs.length; i++) {\r
       if (_s.soundIDs[i] == sID) {\r
            _s.soundIDs.splice(i,1);\r
         continue;\r
-      }\r
-    }\r
+      };\r
+    };\r
     // conservative option: avoid crash with ze flash 8\r
     // calling destroySound() within a sound onload() might crash firefox, certain flavours of winXP + flash 8??\r
     // if (_s.flashVersion != 8) {\r
@@ -262,31 +254,25 @@ function SoundManager(smURL,smID) {
     if (!bFromSound) {\r
       // ignore if being called from SMSound instance\r
       _s.sounds[sID].destruct();\r
-    }\r
+    };\r
     delete _s.sounds[sID];\r
   };\r
 \r
   this.destroyVideo = this.destroySound;\r
 \r
   this.load = function(sID,oOptions) {\r
-    if (!_s._idCheck(sID)) {\r
-      return false;\r
-    }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].load(oOptions);\r
   };\r
 \r
   this.unload = function(sID) {\r
-    if (!_s._idCheck(sID)) {\r
-      return false;\r
-    }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].unload();\r
   };\r
 \r
   this.play = function(sID,oOptions) {\r
     if (!_s._idCheck(sID)) {\r
-      if (typeof oOptions != 'Object') {\r
-               oOptions = {url:oOptions}; // overloading use case: play('mySound','/path/to/some.mp3');\r
-         }\r
+      if (typeof oOptions != 'Object') oOptions = {url:oOptions}; // overloading use case: play('mySound','/path/to/some.mp3');\r
       if (oOptions && oOptions.url) {\r
         // overloading use case, creation + playing of sound: .play('someID',{url:'/path/to.mp3'});\r
         _s._wD('soundController.play(): attempting to create "'+sID+'"',1);\r
@@ -294,24 +280,21 @@ function SoundManager(smURL,smID) {
         _s.createSound(oOptions);\r
       } else {\r
         return false;\r
-      }\r
-    }\r
+      };\r
+    };\r
     _s.sounds[sID].play(oOptions);\r
   };\r
 \r
   this.start = this.play; // just for convenience\r
 \r
   this.setPosition = function(sID,nMsecOffset) {\r
-    if (!_s._idCheck(sID)) {\r
-      return false;\r
-    }\r
+    if (!_s._idCheck(sID)) return false;\r
+    nMsecOffset = Math.min((nMsecOffset||0),_s.duration); // don't allow seek past loaded duration\r
     _s.sounds[sID].setPosition(nMsecOffset);\r
   };\r
 \r
   this.stop = function(sID) {\r
-    if (!_s._idCheck(sID)) {\r
-         return false;\r
-       }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s._wD('soundManager.stop('+sID+')',1);\r
     _s.sounds[sID].stop(); \r
   };\r
@@ -319,16 +302,12 @@ function SoundManager(smURL,smID) {
   this.stopAll = function() {\r
     _s._wD('soundManager.stopAll()',1);\r
     for (var oSound in _s.sounds) {\r
-      if (_s.sounds[oSound] instanceof SMSound) {\r
-               _s.sounds[oSound].stop(); // apply only to sound objects\r
-         }\r
-    }\r
+      if (_s.sounds[oSound] instanceof SMSound) _s.sounds[oSound].stop(); // apply only to sound objects\r
+    };\r
   };\r
 \r
   this.pause = function(sID) {\r
-    if (!_s._idCheck(sID)) {\r
-         return false;\r
-       }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].pause();\r
   };\r
 \r
@@ -339,9 +318,7 @@ function SoundManager(smURL,smID) {
   };\r
 \r
   this.resume = function(sID) {\r
-    if (!_s._idCheck(sID)) {\r
-         return false;\r
-       }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].resume();\r
   };\r
 \r
@@ -352,40 +329,31 @@ function SoundManager(smURL,smID) {
   };\r
 \r
   this.togglePause = function(sID) {\r
-    if (!_s._idCheck(sID)) {\r
-         return false;\r
-       }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].togglePause();\r
   };\r
 \r
   this.setPan = function(sID,nPan) {\r
-    if (!_s._idCheck(sID)) {\r
-         return false;\r
-       }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].setPan(nPan);\r
   };\r
 \r
   this.setVolume = function(sID,nVol) {\r
-    if (!_s._idCheck(sID)) {\r
-         return false;\r
-       }\r
+    if (!_s._idCheck(sID)) return false;\r
     _s.sounds[sID].setVolume(nVol);\r
   };\r
 \r
   this.mute = function(sID) {\r
-       if (typeof sID != 'string') {\r
-         sID = null;\r
-       }\r
+       if (typeof sID != 'string') sID = null;\r
     if (!sID) {\r
+      var o = null;\r
       _s._wD('soundManager.mute(): Muting all sounds');\r
       for (var i=_s.soundIDs.length; i--;) {\r
         _s.sounds[_s.soundIDs[i]].mute();\r
       }\r
       _s.muted = true;\r
     } else {\r
-      if (!_s._idCheck(sID)) {\r
-           return false;\r
-         }\r
+      if (!_s._idCheck(sID)) return false;\r
       _s._wD('soundManager.mute(): Muting "'+sID+'"');\r
       _s.sounds[sID].mute();\r
     }\r
@@ -396,19 +364,16 @@ function SoundManager(smURL,smID) {
   };\r
 \r
   this.unmute = function(sID) {\r
-    if (typeof sID != 'string') {\r
-         sID = null;\r
-       }\r
+    if (typeof sID != 'string') sID = null;\r
     if (!sID) {\r
+      var o = null;\r
       _s._wD('soundManager.unmute(): Unmuting all sounds');\r
       for (var i=_s.soundIDs.length; i--;) {\r
         _s.sounds[_s.soundIDs[i]].unmute();\r
       }\r
       _s.muted = false;\r
     } else {\r
-      if (!_s._idCheck(sID)) {\r
-               return false;\r
-         }\r
+      if (!_s._idCheck(sID)) return false;\r
       _s._wD('soundManager.unmute(): Unmuting "'+sID+'"');\r
       _s.sounds[sID].unmute();\r
     }\r
@@ -419,40 +384,39 @@ function SoundManager(smURL,smID) {
   };\r
 \r
   this.setPolling = function(bPolling) {\r
-    if (!_s.o || !_s.allowPolling) {\r
-         return false;\r
-       }\r
+    if (!_s.o || !_s.allowPolling) return false;\r
     // _s._wD('soundManager.setPolling('+bPolling+')');\r
     _s.o._setPolling(bPolling);\r
   };\r
 \r
   this.disable = function(bUnload) {\r
     // destroy all functions\r
-    if (_s._disabled) {\r
-         return false;\r
-       }\r
+    if (_s._disabled) return false;\r
     _s._disabled = true;\r
     _s._wD('soundManager.disable(): Disabling all functions - future calls will return false.',1);\r
     for (var i=_s.soundIDs.length; i--;) {\r
       _s._disableObject(_s.sounds[_s.soundIDs[i]]);\r
-    }\r
+    };\r
     _s.initComplete(); // fire "complete", despite fail\r
     _s._disableObject(_s);\r
   };\r
 \r
+  this.handleFlashBlock = function(bForce) {\r
+    // experimental, removed with >v2.80.\r
+    return false;\r
+  };\r
+\r
   this.canPlayURL = function(sURL) {\r
     return (sURL?(sURL.match(_s.filePattern)?true:false):null);        \r
   };\r
 \r
   this.getSoundById = function(sID,suppressDebug) {\r
-    if (!sID) {\r
-         throw new Error('SoundManager.getSoundById(): sID is null/undefined');\r
-       }\r
+    if (!sID) throw new Error('SoundManager.getSoundById(): sID is null/undefined');\r
     var result = _s.sounds[sID];\r
     if (!result && !suppressDebug) {\r
       _s._wD('"'+sID+'" is an invalid sound ID.',2);\r
       // soundManager._wD('trace: '+arguments.callee.caller);\r
-    }\r
+    };\r
     return result;\r
   };\r
 \r
@@ -470,31 +434,27 @@ function SoundManager(smURL,smID) {
 \r
   this._idCheck = this.getSoundById;\r
 \r
-  var _doNothing = function() {\r
-    return false;\r
-  };\r
-  _doNothing._protected = true;\r
-\r
   this._disableObject = function(o) {\r
     for (var oProp in o) {\r
-      if (typeof o[oProp] == 'function' && typeof o[oProp]._protected == 'undefined') {\r
-               o[oProp] = _doNothing;\r
-         }\r
-    }\r
+      if (typeof o[oProp] == 'function' && typeof o[oProp]._protected == 'undefined') o[oProp] = function(){return false;};\r
+    };\r
     oProp = null;\r
   };\r
 \r
   this._failSafely = function() {\r
     // exception handler for "object doesn't support this property or method" or general failure\r
+    var fpgssTitle = 'You may need to whitelist this location/domain eg. file:///C:/ or C:/ or mysite.com, or set ALWAYS ALLOW under the Flash Player Global Security Settings page. The latter is probably less-secure.';\r
+    var flashCPL = '<a href="'+flashCPLink+'" title="'+fpgssTitle+'">view/edit</a>';\r
+    var FPGSS = '<a href="'+flashCPLink+'" title="Flash Player Global Security Settings">FPGSS</a>';\r
     if (!_s._disabled) {\r
       _s._wD('soundManager: Failed to initialise.',2);\r
       _s.disable();\r
-    }\r
+    };\r
   };\r
   \r
   this._normalizeMovieURL = function(smURL) {\r
     if (smURL) {\r
-      if (smURL.match(/.swf/)) {\r
+      if (smURL.match(/\.swf/)) {\r
         smURL = smURL.substr(0,smURL.lastIndexOf('.swf'));\r
       }\r
       if (smURL.lastIndexOf('/') != smURL.length-1) {\r
@@ -511,12 +471,8 @@ function SoundManager(smURL,smID) {
   this._getDocument._protected = true;\r
 \r
   this._createMovie = function(smID,smURL) {\r
-    if (_s._didAppend && _s._appendSuccess) {\r
-         return false; // ignore if already succeeded\r
-       }\r
-    if (window.location.href.indexOf('debug=1')+1) {\r
-         _s.debugMode = true; // allow force of debug mode via URL\r
-       }\r
+    if (_s._didAppend && _s._appendSuccess) return false; // ignore if already succeeded\r
+    if (window.location.href.indexOf('debug=1')+1) _s.debugMode = true; // allow force of debug mode via URL\r
     _s._didAppend = true;\r
        \r
     // safety check for legacy (change to Flash 9 URL)\r
@@ -526,111 +482,18 @@ function SoundManager(smURL,smID) {
     _s.url = _s._normalizeMovieURL(_s._overHTTP?remoteURL:localURL);\r
     smURL = _s.url;\r
 \r
-    var specialCase = null;\r
-    if (_s.useHighPerformance && navigator.userAgent.match(/firefox\/2/i)) {\r
-      // no highPerformance for firefox 2. Causes failure on some pages, exact cause unknown at this point.\r
-      specialCase = 'Warning: disabling highPerformance, incompatible with Firefox 2.x';\r
-      _s.useHighPerformance = false;\r
-    }\r
-\r
-    if (_s.useHighPerformance && _s.useMovieStar) {\r
-         specialCase = 'Warning: disabling highPerformance, not applicable with movieStar mode on';\r
-         _s.useHighPerformance = false;\r
-       }\r
-\r
-    var oEmbed = {\r
-      name: smID,\r
-      id: smID,\r
-      src: smURL,\r
-      width: '100%',\r
-      height: '100%',\r
-      quality: 'high',\r
-      allowScriptAccess: 'always',\r
-      bgcolor: _s.bgColor,\r
-      pluginspage: 'http://www.macromedia.com/go/getflashplayer',\r
-      type: 'application/x-shockwave-flash'\r
-    };\r
-\r
-    var oObject = {\r
-      id: smID,\r
-      data: smURL,\r
-      type: 'application/x-shockwave-flash',\r
-      width: '100%',\r
-      height: '100%'\r
-    };\r
-\r
-    var oObjectParams = {\r
-      movie: smURL,\r
-      AllowScriptAccess: 'always',\r
-      quality: 'high',\r
-      bgcolor: _s.bgColor\r
-    };\r
-\r
-    if (_s.useHighPerformance && !_s.useMovieStar) {\r
-      oEmbed.wmode = 'transparent';\r
-      oObjectParams.wmode = 'transparent';\r
-    }\r
-\r
-    var oMovie = null;\r
-    var tmp = null;\r
-\r
-    if (_s.isIE) {\r
-\r
-      // IE is "special".\r
-      oMovie = document.createElement('div');\r
-      var movieHTML = '<object id="'+smID+'" data="'+smURL+'" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="'+smURL+'" /><param name="AllowScriptAccess" value="always" /><param name="quality" value="high" />'+(_s.useHighPerformance && !_s.useMovieStar?'<param name="wmode" value="transparent" /> ':'')+'<param name="bgcolor" value="'+_s.bgColor+'" /><!-- --></object>';\r
-\r
-    } else {\r
-\r
-      oMovie = document.createElement('embed');\r
-      for (tmp in oEmbed) {\r
-           if (oEmbed.hasOwnProperty(tmp)) {\r
-          oMovie.setAttribute(tmp,oEmbed[tmp]);\r
-               }\r
-      }\r
-    }\r
-\r
-    var oD = document.createElement('div');\r
-    oD.id = _s.debugID+'-toggle';\r
-    var oToggle = {\r
-      position: 'fixed',\r
-      bottom: '0px',\r
-      right: '0px',\r
-      width: '1.2em',\r
-      height: '1.2em',\r
-      lineHeight: '1.2em',\r
-      margin: '2px',\r
-      textAlign: 'center',\r
-      border: '1px solid #999',\r
-      cursor: 'pointer',\r
-      background: '#fff',\r
-      color: '#333',\r
-      zIndex: 10001\r
-    };\r
-\r
-    oD.appendChild(document.createTextNode('-'));\r
-    oD.onclick = _s._toggleDebug;\r
-    oD.title = 'Toggle SM2 debug console';\r
-\r
-    if (navigator.userAgent.match(/msie 6/i)) {\r
-      oD.style.position = 'absolute';\r
-      oD.style.cursor = 'hand';\r
-    }\r
-\r
-    for (tmp in oToggle) {\r
-         if (oToggle.hasOwnProperty(tmp)) {\r
-        oD.style[tmp] = oToggle[tmp];\r
-         }\r
-    }\r
+    var htmlEmbed = '<embed name="'+smID+'" id="'+smID+'" src="'+smURL+'" width="100%" height="100%" quality="high" allowScriptAccess="always" quality="high" '+(_s.useHighPerformance && !_s.useMovieStar?'wmode="transparent" ':'')+'bgcolor="'+_s.bgColor+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>';\r
+    var htmlObject = '<object id="'+smID+'" data="'+smURL+'" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="'+smURL+'" /><param name="AllowScriptAccess" value="always" /><param name="quality" value="high" />'+(_s.useHighPerformance && !_s.useMovieStar?'<param name="wmode" value="transparent" /> ':'')+'<param name="bgcolor" value="'+_s.bgColor+'" /><!-- --></object>';\r
+    var html = (!_s.isIE?htmlEmbed:htmlObject);\r
 \r
+    var toggleElement = '<div id="'+_s.debugID+'-toggle" style="position:fixed;_position:absolute;right:0px;bottom:0px;_top:0px;width:1.2em;height:1.2em;line-height:1.2em;margin:2px;padding:0px;text-align:center;border:1px solid #999;cursor:pointer;background:#fff;color:#333;z-index:10001" title="Toggle SM2 debug console" onclick="soundManager._toggleDebug()">-</div>';\r
+    var debugHTML = '<div id="'+_s.debugID+'" style="display:'+(_s.debugMode && ((!_s._hasConsole||!_s.useConsole)||(_s.useConsole && _s._hasConsole && !_s.consoleOnly))?'block':'none')+';opacity:0.85"></div>';\r
     var appXHTML = 'soundManager._createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.';\r
 \r
     var oTarget = _s._getDocument();\r
-\r
     if (oTarget) {\r
        \r
       _s.oMC = document.getElementById('sm2-container')?document.getElementById('sm2-container'):document.createElement('div');\r
-\r
       if (!_s.oMC.id) {\r
         _s.oMC.id = 'sm2-container';\r
         _s.oMC.className = 'movieContainer';\r
@@ -638,122 +501,95 @@ function SoundManager(smURL,smID) {
         var s = null;\r
         if (_s.useHighPerformance) {\r
           s = {\r
-               position: 'fixed',\r
-                   width: '8px',\r
+           position: 'fixed',\r
+           width: '8px',\r
             height: '8px', // must be at least 6px for flash to run fast. odd? yes.\r
             bottom: '0px',\r
             left: '0px',\r
-               zIndex:-1 // sit behind everything else\r
-          };\r
+           zIndex:-1 // sit behind everything else\r
+          }\r
         } else {\r
           s = {\r
             position: 'absolute',\r
-                   width: '1px',\r
+           width: '1px',\r
             height: '1px',\r
             bottom: '0px',\r
             left: '0px'\r
-          };\r
+          }\r
         }\r
         var x = null;\r
         for (x in s) {\r
-                 if (s.hasOwnProperty(x)) {\r
-            _s.oMC.style[x] = s[x];\r
-                 }\r
+          _s.oMC.style[x] = s[x];\r
         }\r
         try {\r
-                 if (!_s.isIE) {\r
-           _s.oMC.appendChild(oMovie);\r
-                 }\r
           oTarget.appendChild(_s.oMC);\r
-                 if (_s.isIE) {\r
-            _s.oMC.innerHTML = movieHTML;\r
-          }\r
+          _s.oMC.innerHTML = html;\r
           _s._appendSuccess = true;\r
         } catch(e) {\r
           throw new Error(appXHTML);\r
         }\r
       } else {\r
         // it's already in the document.\r
-        _s.oMC.appendChild(oMovie);\r
-               if (_s.isIE) {\r
-                 // possibly destructive write\r
-          _s.oMC.innerHTML = movieHTML;\r
-        }\r
+        _s.oMC.innerHTML = html;\r
         _s._appendSuccess = true;\r
       }\r
-\r
       if (!document.getElementById(_s.debugID) && ((!_s._hasConsole||!_s.useConsole)||(_s.useConsole && _s._hasConsole && !_s.consoleOnly))) {\r
         var oDebug = document.createElement('div');\r
         oDebug.id = _s.debugID;\r
         oDebug.style.display = (_s.debugMode?'block':'none');\r
         if (_s.debugMode) {\r
           try {\r
-            // var oD = document.createElement('div');\r
+            var oD = document.createElement('div');\r
             oTarget.appendChild(oD);\r
-            // oD.innerHTML = toggleElement;\r
-          } catch(e2) {\r
+            oD.innerHTML = toggleElement;\r
+          } catch(e) {\r
             throw new Error(appXHTML);\r
-          }\r
-        }\r
+          };\r
+        };\r
         oTarget.appendChild(oDebug);\r
-      }\r
+      };\r
       oTarget = null;\r
-    }\r
-\r
-    if (specialCase) {\r
-      _s._wD(specialCase);\r
-    }\r
-\r
-    _s._wD('-- SoundManager 2 '+_s.version+(_s.useMovieStar?', MovieStar mode':'')+(_s.useHighPerformance?', high performance mode':'')+' --',1);\r
+    };\r
+    _s._wD('-- SoundManager 2 '+_s.version+(_s.useMovieStar?', MovieStar mode':'')+(_s._wD?', high performance mode':'')+' --',1);\r
     _s._wD('soundManager._createMovie(): Trying to load '+smURL+(!_s._overHTTP && _s.altURL?'(alternate URL)':''),1);\r
   };\r
 \r
   // aliased to this._wD()\r
   this._writeDebug = function(sText,sType,bTimestamp) {\r
-    if (!_s.debugMode) {\r
-         return false;\r
-       }\r
+    if (!_s.debugMode) return false;\r
     if (typeof bTimestamp != 'undefined' && bTimestamp) {\r
       sText = sText + ' | '+new Date().getTime();\r
-    }\r
+    };\r
     if (_s._hasConsole && _s.useConsole) {\r
       var sMethod = _s._debugLevels[sType];\r
       if (typeof console[sMethod] != 'undefined') {\r
         console[sMethod](sText);\r
       } else {\r
         console.log(sText);\r
-      }\r
-      if (_s.useConsoleOnly) {\r
-           return true;\r
-         }\r
-    }\r
+      };\r
+      if (_s.useConsoleOnly) return true;\r
+    };\r
     var sDID = 'soundmanager-debug';\r
     try {\r
       var o = document.getElementById(sDID);\r
-      if (!o) {\r
-               return false;\r
-         }\r
+      if (!o) return false;\r
       var oItem = document.createElement('div');\r
-      // sText = sText.replace(/\n/g,'<br />');\r
+      sText = sText.replace(/\n/g,'<br />');\r
       if (typeof sType == 'undefined') {\r
-        sType = 0;\r
+        var sType = 0;\r
       } else {\r
-        sType = parseInt(sType,10);\r
-      }\r
-      oItem.appendChild(document.createTextNode(sText));\r
+        sType = parseInt(sType);\r
+      };\r
+      oItem.innerHTML = sText;\r
       if (sType) {\r
-        if (sType >= 2) {\r
-                 oItem.style.fontWeight = 'bold';\r
-               }\r
-        if (sType == 3) {\r
-                 oItem.style.color = '#ff3333';\r
-               }\r
-      }\r
+        if (sType >= 2) oItem.style.fontWeight = 'bold';\r
+        if (sType == 3) oItem.style.color = '#ff3333';\r
+      };\r
       // o.appendChild(oItem); // top-to-bottom\r
       o.insertBefore(oItem,o.firstChild); // bottom-to-top\r
     } catch(e) {\r
       // oh well\r
-    }\r
+    };\r
     o = null;\r
   };\r
   this._writeDebug._protected = true;\r
@@ -763,14 +599,12 @@ function SoundManager(smURL,smID) {
 \r
   if (window.location.href.indexOf('debug=alert')+1 && _s.debugMode) {\r
     _s._wD = _s._wDAlert;\r
-  }\r
+  };\r
 \r
   this._toggleDebug = function() {\r
     var o = document.getElementById(_s.debugID);\r
     var oT = document.getElementById(_s.debugID+'-toggle');\r
-    if (!o) {\r
-         return false;\r
-       }\r
+    if (!o) return false;\r
     if (_s._debugOpen) {\r
       // minimize\r
       oT.innerHTML = '+';\r
@@ -778,7 +612,7 @@ function SoundManager(smURL,smID) {
     } else {\r
       oT.innerHTML = '-';\r
       o.style.display = 'block';\r
-    }\r
+    };\r
     _s._debugOpen = !_s._debugOpen;\r
   };\r
 \r
@@ -788,30 +622,24 @@ function SoundManager(smURL,smID) {
     _s._wD('--- soundManager._debug(): Current sound objects ---',1);\r
     for (var i=0,j=_s.soundIDs.length; i<j; i++) {\r
       _s.sounds[_s.soundIDs[i]]._debug();\r
-    }\r
+    };\r
   };\r
 \r
   this._mergeObjects = function(oMain,oAdd) {\r
     // non-destructive merge\r
     var o1 = {}; // clone o1\r
     for (var i in oMain) {\r
-         if (oMain.hasOwnProperty(i)) {\r
-        o1[i] = oMain[i];\r
-         }\r
+      o1[i] = oMain[i];\r
     }\r
     var o2 = (typeof oAdd == 'undefined'?_s.defaultOptions:oAdd);\r
     for (var o in o2) {\r
-      if (o2.hasOwnProperty(o) && typeof o1[o] == 'undefined') {\r
-               o1[o] = o2[o];\r
-         }\r
-    }\r
+      if (typeof o1[o] == 'undefined') o1[o] = o2[o];\r
+    };\r
     return o1;\r
   };\r
 \r
   this.createMovie = function(sURL) {\r
-    if (sURL) {\r
-         _s.url = sURL;\r
-       }\r
+    if (sURL) _s.url = sURL;\r
     _s._initMovie();\r
   };\r
 \r
@@ -819,58 +647,50 @@ function SoundManager(smURL,smID) {
 \r
   this._initMovie = function() {\r
     // attempt to get, or create, movie\r
-    if (_s.o) {\r
-         return false; // pre-init may have fired this function before window.onload(), may already exist\r
-       }\r
+    if (_s.o) return false; // pre-init may have fired this function before window.onload(), may already exist\r
     _s.o = _s.getMovie(_s.id); // try to get flash movie (inline markup)\r
     if (!_s.o) {\r
       // try to create\r
       _s._createMovie(_s.id,_s.url);\r
       _s.o = _s.getMovie(_s.id);\r
-    }\r
+    };\r
     if (_s.o) {\r
       _s._wD('soundManager._initMovie(): Got '+_s.o.nodeName+' element ('+(_s._didAppend?'created via JS':'static HTML')+')',1);\r
       _s._wD('soundManager._initMovie(): Waiting for ExternalInterface call from Flash..');\r
-    }\r
+    };\r
   };\r
 \r
   this.waitForExternalInterface = function() {\r
-    if (_s._waitingForEI) {\r
-         return false;\r
-       }\r
+    if (_s._waitingForEI) return false;\r
     _s._waitingForEI = true;\r
     if (_s._tryInitOnFocus && !_s._isFocused) {\r
       _s._wD('soundManager: Special case: Flash may not have started due to non-focused tab (Safari is lame), and/or focus cannot be detected. Waiting for focus-related event..');\r
       return false;\r
-    }\r
+    };\r
     if (!_s._didInit) {\r
       _s._wD('soundManager: Getting impatient, still waiting for Flash.. ;)');\r
-    }\r
+    };\r
     setTimeout(function() {\r
       if (!_s._didInit) {\r
         _s._wD('soundManager: No Flash response within reasonable time after document load.\nPossible causes: Flash version under 8, no support, or Flash security denying JS-Flash communication.',2);\r
         if (!_s._overHTTP) {\r
           _s._wD('soundManager: Loading this page from local/network file system (not over HTTP?) Flash security likely restricting JS-Flash access. Consider adding current URL to "trusted locations" in the Flash player security settings manager at '+flashCPLink+', or simply serve this content over HTTP.',2);\r
-        }\r
-      }\r
+        };\r
+      };\r
       // if still not initialized and no other options, give up\r
-      if (!_s._didInit && _s._okToDisable) {\r
-               _s._failSafely();\r
-         }\r
+      if (!_s._didInit && _s._okToDisable) _s._failSafely();\r
     },750);\r
   };\r
 \r
   this.handleFocus = function() {\r
-    if (_s._isFocused || !_s._tryInitOnFocus) {\r
-         return true;\r
-       }\r
+    if (_s._isFocused || !_s._tryInitOnFocus) return true;\r
     _s._okToDisable = true;\r
     _s._isFocused = true;\r
     _s._wD('soundManager.handleFocus()');\r
     if (_s._tryInitOnFocus) {\r
       // giant Safari 3.1 hack - assume window in focus if mouse is moving, since document.hasFocus() not currently implemented.\r
       window.removeEventListener('mousemove',_s.handleFocus,false);\r
-    }\r
+    };\r
     // allow init to restart\r
     _s._waitingForEI = false;\r
     setTimeout(_s.waitForExternalInterface,500);\r
@@ -879,40 +699,47 @@ function SoundManager(smURL,smID) {
       window.removeEventListener('focus',_s.handleFocus,false);\r
     } else if (window.detachEvent) {\r
       window.detachEvent('onfocus',_s.handleFocus);\r
-    }\r
+    };\r
   };\r
 \r
   this.initComplete = function() {\r
-    if (_s._didInit) {\r
-         return false;\r
-       }\r
+    if (_s._didInit) return false;\r
     _s._didInit = true;\r
     _s._wD('-- SoundManager 2 '+(_s._disabled?'failed to load':'loaded')+' ('+(_s._disabled?'security/load error':'OK')+') --',1);\r
     if (_s._disabled) {\r
       _s._wD('soundManager.initComplete(): calling soundManager.onerror()',1);\r
       _s.onerror.apply(window);\r
       return false;\r
-    }\r
+    };\r
     if (_s.waitForWindowLoad && !_s._windowLoaded) {\r
       _s._wD('soundManager: Waiting for window.onload()');\r
       if (window.addEventListener) {\r
         window.addEventListener('load',_s.initUserOnload,false);\r
       } else if (window.attachEvent) {\r
         window.attachEvent('onload',_s.initUserOnload);\r
-      }\r
+      };\r
       return false;\r
     } else {\r
       if (_s.waitForWindowLoad && _s._windowLoaded) {\r
         _s._wD('soundManager: Document already loaded');\r
-      }\r
+      };\r
       _s.initUserOnload();\r
-    }\r
+    };\r
   };\r
 \r
   this.initUserOnload = function() {\r
     _s._wD('soundManager.initComplete(): calling soundManager.onload()',1);\r
     // call user-defined "onload", scoped to window\r
-    _s.onload.apply(window);\r
+    //try {\r
+      _s.onload.apply(window);\r
+      /*\r
+    } catch(e) {\r
+      // something broke (likely JS error in user function)\r
+      _s._wD('soundManager.onload() threw an exception: '+e.message,2);\r
+      setTimeout(function(){throw new Error(e)},20);\r
+      return false;\r
+    };\r
+    */\r
     _s._wD('soundManager.onload() complete',1);\r
   };\r
 \r
@@ -923,30 +750,28 @@ function SoundManager(smURL,smID) {
     if (_s._didInit) {\r
       _s._wD('soundManager.init(): Already called?');\r
       return false;\r
-    }\r
+    };\r
     // event cleanup\r
     if (window.removeEventListener) {\r
       window.removeEventListener('load',_s.beginDelayedInit,false);\r
     } else if (window.detachEvent) {\r
       window.detachEvent('onload',_s.beginDelayedInit);\r
-    }\r
+    };\r
     try {\r
-      _s._wD('Attempting to call Flash from JS..');\r
+      _s._wD('Attempting to call JS -&gt; Flash..');\r
       _s.o._externalInterfaceTest(false); // attempt to talk to Flash\r
       // _s._wD('Flash ExternalInterface call (JS-Flash) OK',1);\r
       if (!_s.allowPolling) {\r
            _s._wD('Polling (whileloading/whileplaying support) is disabled.',1);\r
          }\r
       _s.setPolling(true);\r
-         if (!_s.debugMode) {\r
-               _s.o._disableDebug();\r
-         }\r
+         if (!_s.debugMode) _s.o._disableDebug();\r
       _s.enabled = true;\r
     } catch(e) {\r
       _s._failSafely();\r
       _s.initComplete();\r
       return false;\r
-    }\r
+    };\r
     _s.initComplete();\r
   };\r
 \r
@@ -958,9 +783,7 @@ function SoundManager(smURL,smID) {
   };\r
 \r
   this.beginInit = function() {\r
-    if (_s._initPending) {\r
-         return false;\r
-       }\r
+    if (_s._initPending) return false;\r
     _s.createMovie(); // ensure creation if not already done\r
     _s._initMovie();\r
     _s._initPending = true;\r
@@ -969,17 +792,13 @@ function SoundManager(smURL,smID) {
 \r
   this.domContentLoaded = function() {\r
     _s._wD('soundManager.domContentLoaded()');\r
-    if (document.removeEventListener) {\r
-         document.removeEventListener('DOMContentLoaded',_s.domContentLoaded,false);\r
-       }\r
+    if (document.removeEventListener) document.removeEventListener('DOMContentLoaded',_s.domContentLoaded,false);\r
     _s.go();\r
   };\r
 \r
   this._externalInterfaceOK = function() {\r
     // callback from flash for confirming that movie loaded, EI is working etc.\r
-    if (_s.swfLoaded) {\r
-         return false;\r
-       }\r
+    if (_s.swfLoaded) return false;\r
     _s._wD('soundManager._externalInterfaceOK()');\r
     _s.swfLoaded = true;\r
     _s._tryInitOnFocus = false;\r
@@ -988,7 +807,7 @@ function SoundManager(smURL,smID) {
       setTimeout(_s.init,100);\r
     } else {\r
       _s.init();\r
-    }\r
+    };\r
   };\r
 \r
   this._setSandboxType = function(sandboxType) {\r
@@ -1006,7 +825,7 @@ function SoundManager(smURL,smID) {
     } else if (sb.type == 'localTrusted') {\r
       sb.noRemote = false;\r
       sb.noLocal = false;\r
-    }\r
+    };\r
   };\r
 \r
   this.destruct = function() {\r
@@ -1016,7 +835,7 @@ function SoundManager(smURL,smID) {
   \r
   // SMSound (sound object)\r
   \r
-  SMSound = function (oOptions) {\r
+  function SMSound(oOptions) {\r
   var _t = this;\r
   this.sID = oOptions.id;\r
   this.url = oOptions.url;\r
@@ -1032,7 +851,7 @@ function SoundManager(smURL,smID) {
     var sfBracket = null;\r
     var maxLength = 64; // # of characters of function code to show before truncating\r
     for (stuff in _t.options) {\r
-      if (_t.options[stuff] !== null) {\r
+      if (_t.options[stuff] != null) {\r
         if (_t.options[stuff] instanceof Function) {\r
              // handle functions specially\r
              sF = _t.options[stuff].toString();\r
@@ -1041,11 +860,11 @@ function SoundManager(smURL,smID) {
              msg[msg.length] = ' '+stuff+': {'+sF.substr(sfBracket+1,(Math.min(Math.max(sF.indexOf('\n')-1,maxLength),maxLength))).replace(/\n/g,'')+'... }';\r
            } else {\r
              msg[msg.length] = ' '+stuff+': '+_t.options[stuff];\r
-           }\r
-      }\r
-    }\r
+           };\r
+      };\r
+    };\r
     _s._wD('SMSound() merged options: {\n'+msg.join(', \n')+'\n}');\r
-    }\r
+    };\r
   };\r
 \r
   this._debug();\r
@@ -1090,15 +909,13 @@ function SoundManager(smURL,smID) {
       _t._iO = _s._mergeObjects(oOptions);\r
       _t.instanceOptions = _t._iO;\r
     } else {\r
-      oOptions = _t.options;\r
+      var oOptions = _t.options;\r
       _t._iO = oOptions;\r
       _t.instanceOptions = _t._iO;\r
     } \r
-    if (typeof _t._iO.url == 'undefined') {\r
-         _t._iO.url = _t.url;\r
-       }\r
+    if (typeof _t._iO.url == 'undefined') _t._iO.url = _t.url;\r
     _s._wD('soundManager.load(): '+_t._iO.url,1);\r
-    if (_t._iO.url == _t.url && _t.readyState !== 0 && _t.readyState != 2) {\r
+    if (_t._iO.url == _t.url && _t.readyState != 0 && _t.readyState != 2) {\r
       _s._wD('soundManager.load(): current URL already assigned.',1);\r
       return false;\r
     }\r
@@ -1114,18 +931,18 @@ function SoundManager(smURL,smID) {
           // special case: MPEG4 content must start playing to load, then pause to prevent playing.\r
           _t.pause();\r
         }\r
-      }\r
+      };\r
     } catch(e) {\r
       _s._wD('SMSound.load(): Exception: JS-Flash communication failed, or JS error.',2);\r
       _s.onerror();\r
       _s.disable();\r
-    }\r
+    };\r
   };\r
 \r
   this.unload = function() {\r
     // Flash 8/AS2 can't "close" a stream - fake it by loading an empty MP3\r
     // Flash 9/AS3: Close stream, preventing further load\r
-    if (_t.readyState !== 0) {\r
+    if (_t.readyState != 0) {\r
       _s._wD('SMSound.unload(): "'+_t.sID+'"');\r
       if (_t.readyState != 2) { // reset if not error\r
         _t.setPosition(0); // reset current sound positioning\r
@@ -1141,12 +958,10 @@ function SoundManager(smURL,smID) {
     _s._wD('SMSound.destruct(): "'+_t.sID+'"');\r
     _s.o._destroySound(_t.sID);\r
     _s.destroySound(_t.sID,true); // ensure deletion from controller\r
-  };\r
+  }\r
 \r
   this.play = function(oOptions) {\r
-    if (!oOptions) {\r
-         oOptions = {};\r
-       }\r
+    if (!oOptions) oOptions = {};\r
     _t._iO = _s._mergeObjects(oOptions,_t._iO);\r
     _t._iO = _s._mergeObjects(_t._iO,_t.options);\r
     _t.instanceOptions = _t._iO;\r
@@ -1157,10 +972,10 @@ function SoundManager(smURL,smID) {
         return false;\r
       } else {\r
         _s._wD('SMSound.play(): "'+_t.sID+'" already playing (multi-shot)',1);\r
-      }\r
-    }\r
+      };\r
+    };\r
     if (!_t.loaded) {\r
-      if (_t.readyState === 0) {\r
+      if (_t.readyState == 0) {\r
         _s._wD('SMSound.play(): Attempting to load "'+_t.sID+'"',1);\r
         // try to get this sound playing ASAP\r
         _t._iO.stream = true;\r
@@ -1173,25 +988,21 @@ function SoundManager(smURL,smID) {
         return false;\r
       } else {\r
         _s._wD('SMSound.play(): "'+_t.sID+'" is loading - attempting to play..',1);\r
-      }\r
+      };\r
     } else {\r
       _s._wD('SMSound.play(): "'+_t.sID+'"');\r
-    }\r
+    };\r
     if (_t.paused) {\r
       _t.resume();\r
     } else {\r
       _t.playState = 1;\r
-      if (!_t.instanceCount || _s.flashVersion == 9) {\r
-               _t.instanceCount++;\r
-         }\r
+      if (!_t.instanceCount || _s.flashVersion == 9) _t.instanceCount++;\r
       _t.position = (typeof _t._iO.position != 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);\r
-      if (_t._iO.onplay) {\r
-               _t._iO.onplay.apply(_t);\r
-         }\r
+      if (_t._iO.onplay) _t._iO.onplay.apply(_t);\r
       _t.setVolume(_t._iO.volume);\r
       _t.setPan(_t._iO.pan);\r
       _s.o._start(_t.sID,_t._iO.loop||1,(_s.flashVersion==9?_t.position:_t.position/1000));\r
-    }\r
+    };\r
   };\r
 \r
   this.start = this.play; // just for convenience\r
@@ -1201,48 +1012,34 @@ function SoundManager(smURL,smID) {
       _t.playState = 0;\r
       _t.paused = false;\r
       // if (_s.defaultOptions.onstop) _s.defaultOptions.onstop.apply(_s);\r
-      if (_t._iO.onstop) {\r
-               _t._iO.onstop.apply(_t);\r
-         }\r
+      if (_t._iO.onstop) _t._iO.onstop.apply(_t);\r
       _s.o._stop(_t.sID,bAll);\r
       _t.instanceCount = 0;\r
       _t._iO = {};\r
       // _t.instanceOptions = _t._iO;\r
-    }\r
+    };\r
   };\r
 \r
   this.setPosition = function(nMsecOffset) {\r
-    if (typeof nMsecOffset == 'undefined') {\r
-      nMsecOffset = 0;\r
-    }\r
-    // var offset = Math.min((nMsecOffset||0),_t.duration); // don't allow seek past loaded duration\r
     _t._iO.position = nMsecOffset;\r
     _s._wD('SMSound.setPosition('+nMsecOffset+')');\r
     _s.o._setPosition(_t.sID,(_s.flashVersion==9?_t._iO.position:_t._iO.position/1000),(_t.paused||!_t.playState)); // if paused or not playing, will not resume (by playing)\r
   };\r
 \r
   this.pause = function() {\r
-    if (_t.paused || _t.playState === 0) {\r
-         return false;\r
-       }\r
+    if (_t.paused || _t.playState == 0) return false;\r
     _s._wD('SMSound.pause()');\r
     _t.paused = true;\r
     _s.o._pause(_t.sID);\r
-    if (_t._iO.onpause) {\r
-         _t._iO.onpause.apply(_t);\r
-       }\r
+    if (_t._iO.onpause) _t._iO.onpause.apply(_t);\r
   };\r
 \r
   this.resume = function() {\r
-    if (!_t.paused || _t.playState === 0) {\r
-         return false;\r
-       }\r
+    if (!_t.paused || _t.playState == 0) return false;\r
     _s._wD('SMSound.resume()');\r
     _t.paused = false;\r
     _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume)\r
-    if (_t._iO.onresume) {\r
-         _t._iO.onresume.apply(_t);\r
-       }\r
+    if (_t._iO.onresume) _t._iO.onresume.apply(_t);\r
   };\r
 \r
   this.togglePause = function() {\r
@@ -1250,26 +1047,22 @@ function SoundManager(smURL,smID) {
     if (!_t.playState) {\r
       _t.play({position:(_s.flashVersion==9?_t.position:_t.position/1000)});\r
       return false;\r
-    }\r
+    };\r
     if (_t.paused) {\r
       _t.resume();\r
     } else {\r
       _t.pause();\r
-    }\r
+    };\r
   };\r
 \r
   this.setPan = function(nPan) {\r
-    if (typeof nPan == 'undefined') {\r
-         nPan = 0;\r
-       }\r
+    if (typeof nPan == 'undefined') nPan = 0;\r
     _s.o._setPan(_t.sID,nPan);\r
     _t._iO.pan = nPan;\r
   };\r
 \r
   this.setVolume = function(nVol) {\r
-    if (typeof nVol == 'undefined') {\r
-         nVol = 100;\r
-       }\r
+    if (typeof nVol == 'undefined') nVol = 100;\r
     _s.o._setVolume(_t.sID,(_s.muted&&!_t.muted)||_t.muted?0:nVol);\r
     _t._iO.volume = nVol;\r
   };\r
@@ -1291,18 +1084,14 @@ function SoundManager(smURL,smID) {
       _t.bytesLoaded = nBytesLoaded;\r
       _t.bytesTotal = nBytesTotal;\r
       _t.duration = Math.floor(nDuration);\r
-      _t.durationEstimate = parseInt((_t.bytesTotal/_t.bytesLoaded)*_t.duration,10); // estimate total time (will only be accurate with CBR MP3s.)\r
-      if (_t.readyState != 3 && _t._iO.whileloading) {\r
-               _t._iO.whileloading.apply(_t);\r
-         }\r
+      _t.durationEstimate = parseInt((_t.bytesTotal/_t.bytesLoaded)*_t.duration); // estimate total time (will only be accurate with CBR MP3s.)\r
+      if (_t.readyState != 3 && _t._iO.whileloading) _t._iO.whileloading.apply(_t);\r
     } else {\r
       _t.bytesLoaded = nBytesLoaded;\r
       _t.bytesTotal = nBytesTotal;\r
       _t.duration = Math.floor(nDuration);\r
       _t.durationEstimate = _t.duration;\r
-      if (_t.readyState != 3 && _t._iO.whileloading) {\r
-               _t._iO.whileloading.apply(_t);\r
-         }\r
+      if (_t.readyState != 3 && _t._iO.whileloading) _t._iO.whileloading.apply(_t);\r
     }\r
   };\r
 \r
@@ -1314,24 +1103,20 @@ function SoundManager(smURL,smID) {
     for (var i=0,j=oID3PropNames.length; i<j; i++) {\r
       oData[oID3PropNames[i]] = oID3Data[i];\r
       // _s._wD(oID3PropNames[i]+': '+oID3Data[i]);\r
-    }\r
+    };\r
     _t.id3 = _s._mergeObjects(_t.id3,oData);\r
-    if (_t._iO.onid3) {\r
-         _t._iO.onid3.apply(_t);\r
-       }\r
+    if (_t._iO.onid3) _t._iO.onid3.apply(_t);\r
   };\r
 \r
   this._whileplaying = function(nPosition,oPeakData,oWaveformData,oEQData) {\r
-    if (isNaN(nPosition) || nPosition === null) {\r
-         return false; // Flash may return NaN at times\r
-       }\r
+    if (isNaN(nPosition) || nPosition == null) return false; // Flash may return NaN at times\r
     _t.position = nPosition;\r
        if (_t._iO.usePeakData && typeof oPeakData != 'undefined' && oPeakData) {\r
          _t.peakData = {\r
           left: oPeakData.leftPeak,\r
           right: oPeakData.rightPeak\r
          };\r
-       }\r
+       };\r
        if (_t._iO.useWaveformData && typeof oWaveformData != 'undefined' && oWaveformData) {\r
          _t.waveformData = oWaveformData;\r
          /*\r
@@ -1340,37 +1125,37 @@ function SoundManager(smURL,smID) {
           right: oSpectrumData.right.split(',')\r
          }\r
          */\r
-       }\r
+       };\r
        if (_t._iO.useEQData && typeof oEQData != 'undefined' && oEQData) {\r
          _t.eqData = oEQData;\r
-       }\r
+       };\r
     if (_t.playState == 1) {\r
       if (_t._iO.whileplaying) {\r
            _t._iO.whileplaying.apply(_t); // flash may call after actual finish\r
-       }\r
+         };\r
       if (_t.loaded && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration-_t.position <= _t._iO.onbeforefinishtime) {\r
         _s._wD('duration-position &lt;= onbeforefinishtime: '+_t.duration+' - '+_t.position+' &lt= '+_t._iO.onbeforefinishtime+' ('+(_t.duration-_t.position)+')');\r
         _t._onbeforefinish();\r
-      }\r
-    }\r
+      };\r
+    };\r
   };\r
 \r
   this._onload = function(bSuccess) {\r
     bSuccess = (bSuccess==1?true:false);\r
     _s._wD('SMSound._onload(): "'+_t.sID+'"'+(bSuccess?' loaded.':' failed to load? - '+_t.url));\r
     if (!bSuccess) {\r
-      if (_s.sandbox.noRemote === true) {\r
+      if (_s.sandbox.noRemote == true) {\r
         _s._wD('SMSound._onload(): Reminder: Flash security is denying network/internet access',1);\r
-      }\r
-      if (_s.sandbox.noLocal === true) {\r
+      };\r
+      if (_s.sandbox.noLocal == true) {\r
         _s._wD('SMSound._onload(): Reminder: Flash security is denying local access',1);\r
-      }\r
-    }\r
+      };\r
+    };\r
     _t.loaded = bSuccess;\r
     _t.readyState = bSuccess?3:2;\r
     if (_t._iO.onload) {\r
       _t._iO.onload.apply(_t);\r
-    }\r
+    };\r
   };\r
 \r
   this._onbeforefinish = function() {\r
@@ -1380,7 +1165,7 @@ function SoundManager(smURL,smID) {
         _s._wD('SMSound._onbeforefinish(): "'+_t.sID+'"');\r
         _t._iO.onbeforefinish.apply(_t);\r
       }\r
-    }\r
+    };\r
   };\r
 \r
   this._onjustbeforefinish = function(msOffset) {\r
@@ -1391,7 +1176,7 @@ function SoundManager(smURL,smID) {
         _s._wD('SMSound._onjustbeforefinish(): "'+_t.sID+'"');\r
         _t._iO.onjustbeforefinish.apply(_t);\r
       }\r
-    }\r
+    };\r
   };\r
 \r
   this._onfinish = function() {\r
@@ -1402,22 +1187,18 @@ function SoundManager(smURL,smID) {
       _s._wD('SMSound._onfinish(): "'+_t.sID+'"');\r
       _t._iO.onfinish.apply(_t);\r
     }\r
-    if (_t._iO.onbeforefinishcomplete) {\r
-         _t._iO.onbeforefinishcomplete.apply(_t);\r
-       }\r
+    if (_t._iO.onbeforefinishcomplete) _t._iO.onbeforefinishcomplete.apply(_t);\r
     // reset some state items\r
+    _t.setPosition(0);\r
     _t.didBeforeFinish = false;\r
     _t.didJustBeforeFinish = false;\r
     if (_t.instanceCount) {\r
       _t.instanceCount--;\r
       if (!_t.instanceCount) {\r
         // reset instance options\r
-        _t.setPosition(0);\r
         _t.instanceCount = 0;\r
         _t.instanceOptions = {};\r
       }\r
-    } else {\r
-      _t.setPosition(0);\r
     }\r
   };\r
 \r
@@ -1430,7 +1211,7 @@ function SoundManager(smURL,smID) {
          _s._wD('No width/height given, assuming defaults');\r
          oMetaData.width = 320;\r
          oMetaData.height = 240;\r
-    }\r
+    };\r
     _t.metadata = oMetaData; // potentially-large object from flash\r
     _t.width = oMetaData.width;\r
     _t.height = oMetaData.height;\r
@@ -1448,9 +1229,7 @@ function SoundManager(smURL,smID) {
     window.addEventListener('focus',_s.handleFocus,false);\r
     window.addEventListener('load',_s.beginDelayedInit,false);\r
     window.addEventListener('unload',_s.destruct,false);\r
-    if (_s._tryInitOnFocus) {\r
-         window.addEventListener('mousemove',_s.handleFocus,false); // massive Safari focus hack\r
-       }\r
+    if (_s._tryInitOnFocus) window.addEventListener('mousemove',_s.handleFocus,false); // massive Safari focus hack\r
   } else if (window.attachEvent) {\r
     window.attachEvent('onfocus',_s.handleFocus);\r
     window.attachEvent('onload',_s.beginDelayedInit);\r
@@ -1459,13 +1238,10 @@ function SoundManager(smURL,smID) {
     // no add/attachevent support - safe to assume no JS -> Flash either.\r
     soundManager.onerror();\r
     soundManager.disable();\r
-  }\r
-\r
-  if (document.addEventListener) {\r
-       document.addEventListener('DOMContentLoaded',_s.domContentLoaded,false);\r
-  }\r
+  };\r
 \r
-} // SoundManager()\r
+  if (document.addEventListener) document.addEventListener('DOMContentLoaded',_s.domContentLoaded,false);\r
 \r
-soundManager = new SoundManager();\r
+}; // SoundManager()\r
 \r
+var soundManager = new SoundManager();\r
index e78fafae9609cf1df28311373ae4c0918a653e58..98ed98d5eb1088834f49de897b49a6d851160927 100644 (file)
Binary files a/telemeta/htdocs/swf/soundmanager2.swf and b/telemeta/htdocs/swf/soundmanager2.swf differ
index d10a9e5e5286eeb45bc74331c5d8b6a37eec7a97..14e45788e2deaa32b7daa420dd8b34d48d8025bb 100644 (file)
Binary files a/telemeta/htdocs/swf/soundmanager2_flash9.swf and b/telemeta/htdocs/swf/soundmanager2_flash9.swf differ