title: JQuery and SoundManger not playing nicely
body: <p>I've just stared using JQuery and SoundManger2, and I have noticed that SoundManager has problems in certain situations where JQuery is used.  And it also depends if Firefox (3.6.13) or IE(8.0.7600) is being used.</p>
  
  <p>All I'm trying to test is weather I can play a sound or not.  In each example I will show the code first and after the code I will identify if IE and FireFox succeeded or failed.</p>
  
  <hr>
  
  <pre><code>&lt;html&gt; 
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/soundmanager2.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/jquery-1.5.js"&gt;&lt;/script&gt;    
      &lt;script type="text/javascript"&gt;
          soundManager.debugMode = true;
          soundManager.defaultOptions.volume = 50
          soundManager.debugFlash = true; // enable flash debug output for this page
          soundManager.url = '/Project/PublicWebSite/Scripts/swf/soundmanager2.swf';
          soundManager.flashVersion = 8; // 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;
          soundManager.onready(function () {
              soundManager.createSound('helloWorld', '/Project/PublicWebSite/Content/Sounds/Chime.mp3');
              soundManager.play('helloWorld');
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>IE</strong>: Success; <strong>FireFox</strong>: Success</p>
  
  <hr>
  
  <p>In following code everything is the same except I add the configuration for  SoundManager in JQuery document load.</p>
  
  <pre><code>&lt;html&gt; 
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/soundmanager2.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/jquery-1.5.js"&gt;&lt;/script&gt;    
      &lt;script type="text/javascript"&gt;
  
          $(function () {
              soundManager.debugMode = true;
              soundManager.defaultOptions.volume = 50
              soundManager.debugFlash = true; // enable flash debug output for this page
              soundManager.url = '/Project/PublicWebSite/Scripts/swf/soundmanager2.swf';
              soundManager.flashVersion = 8; // 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;
              soundManager.onready(function () {
                  soundManager.createSound('helloWorld', '/Project/PublicWebSite/Content/Sounds/Chime.mp3');
                  soundManager.play('helloWorld');
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>IE</strong>: Success; <strong>FireFox</strong>: Fail</p>
  
  <hr>
  
  <p>Changed the order of JQuery and SoundManger script references </p>
  
  <pre><code>&lt;html&gt; 
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/jquery-1.5.js"&gt;&lt;/script&gt;    
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/soundmanager2.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
          $(function () {
              soundManager.debugMode = true;
              soundManager.defaultOptions.volume = 50
              soundManager.debugFlash = true; // enable flash debug output for this page
              soundManager.url = '/Project/PublicWebSite/Scripts/swf/soundmanager2.swf';
              soundManager.flashVersion = 8; // 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;
              soundManager.onready(function () {
                  soundManager.createSound('helloWorld', '/Project/PublicWebSite/Content/Sounds/Chime.mp3');
                  soundManager.play('helloWorld');
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>IE</strong>: Fail; <strong>FireFox</strong>: Success</p>
  
  <hr>
  
  <p>If all I was doing was making static web pages this wouldn't be a problem.  I'm creating code in asp.net MVC using layers and such and the order of how things get loaded is imporant. This is how I orginally stumbled  upon this problem.</p>
  
  <p>Since I'm a noob to JQuery and SoundManger, there is a very good possibility that I'm doing something wrong.  If anyone has any comments of how to do this better, I would appricate any answers.  I banged my head against my keyboard for a good while, before I figured this out and hope this will help someone else.</p>
  
  <hr>
  
  <p>Update</p>
  
  <p>When sound doesn't play I get the following info from SoundManager2</p>
  
  <p>-- SoundManager 2 failed to load (security/load error) --<br>
  soundManager.disable(): Shutting down<br>
  soundManager: Failed to initialise.<br>
  soundManager: Verify that /Project/PublicWebSite/Scripts/swf/soundmanager2.swf is a valid path.<br>
  soundManager: No Flash response within expected time. Likely causes: Loading soundmanager2_debug.swf may have failed (and/or Flash 8+ not present?), Flash blocked or JS-Flash security error. See SWF output for more debug info.<br>
  soundManager: Getting impatient, still waiting for Flash...<br>
  soundManager::initMovie(): Waiting for ExternalInterface call from Flash..<br>
  soundManager::initMovie(): Got EMBED element (created via JS)<br>
  soundManager::createMovie(): Trying to load ./soundmanager2_debug.swf<br>
  -- SoundManager 2 V2.97a.20110123 (AS2/Flash 8), normal polling --  </p>
  
  <p>I noticed in Firebug and Fiddler that when I get this error, SoundManger tries to find 
  soundmanager2_debug.swf @ /project/PublicWebSite/static/.  The problem is that my swf files are not located there.  This is where my HTML file is located.</p>
  
  <hr>
  
  <p>Update</p>
  
  <p>Simon, that pointed me in the correct direction.  I didn't have to change anything in the soundmanger2.js file as mentioned at <a href="http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading" rel="nofollow">http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading</a> .<br>
  I just remove the refernce to the SoundManger script and dynamicly loaded the script using JQuery ajax call.</p>
  
  <pre><code>&lt;html&gt; 
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script type="text/javascript" src="/Project/PublicWebSite/Scripts/jquery-1.5.js"&gt;&lt;/script&gt;    
  
      &lt;script type="text/javascript"&gt;
  
          $(function () {
              $.ajax({
                  url: '/Project/PublicWebSite/Scripts/soundmanager2.js',
                  dataType: 'script',
                  success: 
                  {
                      soundManager.debugMode = true;
                      soundManager.defaultOptions.volume = 50
                      soundManager.debugFlash = true; // enable flash debug output for this page
                      soundManager.url = '/Project/PublicWebSite/Scripts/swf/soundmanager2.swf';
                      soundManager.flashVersion = 8; // 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;
                      soundManager.onready(function () {
                          soundManager.createSound('helloWorld', '/Project/PublicWebSite/Content/Sounds/Chime.mp3');
                          soundManager.play('helloWorld');
                      });
                  }
  
              });
  
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>IE</strong>: Success; <strong>FireFox</strong>: Success</p>
  
  <p>BarDev</p>