0 Replies Latest reply on Jun 17, 2009 11:10 AM by jls33fsls

    Flash & SWFObject2 stops flash audio in background tabs

    jls33fsls

      I use SWFObject 2.2 to play sounds for an AJAX based game I have made. I used to use SWFObject 1, and everything worked fine, but when I updated my game, I updated to 2.2. Now, when users try to listen to music on Youtube or Pandora in another tab on Firefox while playing the game, they can't unless they have that tab selected.

       

      What is interesting is that the video doesn't stop playing, just the sound stops working. I run the following javascript in order to stop the sound effect in my flash file, and it seems to stop the sound at the exact same time on Youtube or Pandora:


      $('myflashid').doStop();
      
      

      The following is the actionscript used for my flash file:

       

      import flash.external.ExternalInterface;
      
      snd=new Sound();
      snd.attachSound("MySound1");
      
      ExternalInterface.addCallback( "doPlay", this, doPlay );
      ExternalInterface.addCallback( "doStop", this, doStop );
      function doPlay() {
         snd.start();
      }
      function doStop() {
         snd.stop();
      }