title: Error when playing sound with phoneGap
body: <p>Hi i'm trying to add sound to a game buttons and different copmponent i'm using this code from phoneGap site and it works fine when i test it :</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                        "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Media Example&lt;/title&gt;
  
      &lt;script type="text/javascript" charset="utf-8" src="js/phonegap-1.4.1.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" charset="utf-8"&gt;
  
      // Wait for PhoneGap to load
      //
      document.addEventListener("deviceready", onDeviceReady, false);
  
      // PhoneGap is ready
      //
      function onDeviceReady() {
          playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
      }
  
      // Audio player
      //
      var my_media = null;
      var mediaTimer = null;
  
      // Play audio
      //
      function playAudio(src) {
          // Create Media object from src
          my_media = new Media(src, onSuccess, onError);
  
          // Play audio
          my_media.play();
  
          // Update my_media position every second
          if (mediaTimer == null) {
              mediaTimer = setInterval(function() {
                  // get my_media position
                  my_media.getCurrentPosition(
                      // success callback
                      function(position) {
                          if (position &gt; -1) {
                              setAudioPosition((position) + " sec");
                          }
                      },
                      // error callback
                      function(e) {
                          console.log("Error getting pos=" + e);
                          setAudioPosition("Error: " + e);
                      }
                  );
              }, 1000);
          }
      }
  
      // Pause audio
      // 
      function pauseAudio() {
          if (my_media) {
              my_media.pause();
          }
      }
  
      // Stop audio
      // 
      function stopAudio() {
          if (my_media) {
              my_media.stop();
          }
          clearInterval(mediaTimer);
          mediaTimer = null;
      }
  
      // onSuccess Callback
      //
      function onSuccess() {
          console.log("playAudio():Audio Success");
      }
  
      // onError Callback 
      //
      function onError(error) {
          alert('code: '    + error.code    + '\n' + 
                'message: ' + error.message + '\n');
      }
  
      // Set audio position
      // 
      function setAudioPosition(position) {
          document.getElementById('audio_position').innerHTML = position;
      }
  
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;a href="#" class="btn large"  
    onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-   
     _rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
      &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
      &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
      &lt;p id="audio_position"&gt;&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But when i use it im my own code an error is generated here's my code :</p>
  
  <p>html:</p>
  
  <pre><code>    &lt;section id="popup"&gt;
      &lt;div id="popup-bg"&gt;
      &lt;/div&gt;
      &lt;div id="popup-box"&gt;
          &lt;div id="popup-box-content"&gt;
      **&lt;p&gt;&lt;a id="gamePlay" class="gameReset button"  href=""&gt;Play&lt;/a&gt;&lt;/p&gt;**
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>javaScript:</p>
  
  <pre><code>   var ui = $("#gameUI");
     var uiIntro = $("#popup");
  
  
     //Wait for PhoneGap to load//
        document.addEventListener("deviceready", onDeviceReady, false);
  
  
       // PhoneGap is ready
           //
          function onDeviceReady() {
            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
           }
  
        //Audio player//
      var my_media = null;
      var mediaTimer = null;
  
  
  
     $(function(){
    init();
        });
  
  
      function init() {
          uiComplete.hide();
          uiCards.hide();
          playGame = false;
  
          **uiPlay.click(function(e) { //this is the button i want to play             
                                                    //sound after clicking it 
          e.preventDefault();
  
              playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');
                      //uiIntro.hide();
                      //startGame();
                  });**
          }
  
           .....
  
  
      /****Audio Part***********/
     // Play audio//
      function playAudio(src) {
          // Create Media object from src
          my_media = new Media(src, onSuccess, onError);
  
          // Play audio
          my_media.play();
  
          // Update my_media position every second
          if (mediaTimer == null) {
              mediaTimer = setInterval(function() {
                  // get my_media position
                  my_media.getCurrentPosition(
                      // success callback
                      function(position) {
                          if (position &gt; -1) {
                              setAudioPosition((position) + " sec");
                          }
                      },
                      // error callback
                      function(e) {
                          console.log("Error getting pos=" + e);
                          setAudioPosition("Error: " + e);
                      }
                  );
              }, 1000);
          }
      }
  
      // Pause audio
      // 
      function pauseAudio() {
          if (my_media) {
              my_media.pause();
          }
      }
  
      // Stop audio
      // 
      function stopAudio() {
          if (my_media) {
              my_media.stop();
          }
          clearInterval(mediaTimer);
          mediaTimer = null;
      }
  
      // onSuccess Callback
      //
      function onSuccess() {
          console.log("playAudio():Audio Success");
      }
  
      // onError Callback 
      //
      function onError(error) {
          alert('code: '    + error.code    + '\n' + 
                'message: ' + error.message + '\n');
      }
  
      // Set audio position
      // 
      function setAudioPosition(position) {
          document.getElementById('audio_position').innerHTML = position;
      }
  </code></pre>
  
  <p>i didn't put the whole code only the part of sound.
  I'm getting this error after clicking on the uiPlay button :</p>
  
  <pre><code>   05-09 16:38:35.580: E/Web Console(521): ReferenceError: Can't find variable: Media    
     at file:///android_asset/www/js/dinopairs6.js:196
  </code></pre>
  
  <p>Any idea please ? </p>
  
  <p>Thank you in advance </p>