title: Phonegap, stop audio
body: <p>I tried to make an simple phonegap aplication, where several songs can be played.
  So far my app can play an song, but when i tap twice the play button:</p>
  
  <pre><code> &lt;button onclick="playAudio('test.mp3')"&gt;Play Some Audio&lt;/button&gt;
  </code></pre>
  
  <p>It plays the song again, so that an echo can be heard, instead of first stop the audio and  then beging from the beginning of the song.
  I tried severeal things but either my stop button works. The Api for stop audio can be found here: <a href="http://docs.phonegap.com/en/2.0.0/cordova_media_media.md.html#media.stop" rel="nofollow">http://docs.phonegap.com/en/2.0.0/cordova_media_media.md.html#media.stop</a>
  This is my stop button:</p>
  
  <pre><code> &lt;button onclick="stopAudio()"&gt;Stop Some Audio&lt;/button&gt;
  </code></pre>
  
  <p>and the entire project:</p>
  
  <pre><code>     &lt;body&gt;
       &lt;h1&gt;Playing Audio&lt;/h1&gt;
        &lt;button onclick="playAudio('test.mp3')"&gt;Play Some Audio&lt;/button&gt;
        &lt;button onclick="stopAudio()"&gt;Stop Some Audio&lt;/button&gt;
        &lt;/div&gt;
       &lt;script type="text/javascript" src="cordova-2.4.0.js"&gt;&lt;/script&gt;
       &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
       &lt;script type="text/javascript"&gt;
          app.initialize();
          function playAudio(src) {
          if (device.platform == 'Android') {
              src = '/android_asset/' + src;
          }
  
          var media = new Media(src, success, error_error);
  
          media.play();
  
      }
  
      function success() {
          // ignore
      }
  
      function error_error(e) {
          alert('great error');
          alert(e.message);
      }
  
      function stopAudio() {
       if (media) {
       var media = new Media(src, success, error_error);
           media.stop();
           }
      }
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>So maybe anybody know how to make that stop button work?
  Sorry for my bad englisch and greetings from germany!</p>