title: Web Audio API resume from pause
body: <p>I often read that it's not possible to pause/resume audio files with the <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html" rel="noreferrer"><strong>Web Audio API</strong></a>.<br>
  But now I saw a <a href="http://www.htmlfivewow.com/demos/hal/index.html" rel="noreferrer"><strong>example</strong></a> where they actually made it possible to pause and resume it. I tried to figure out what how they did it. I thought maybe <code>source.looping = false</code>is the key, but it wasn't.<br>
  For now my audio is always re-playing from the start.</p>
  
  <p>This is my current code</p>
  
  <pre class="lang-js prettyprint-override"><code>var context = new (window.AudioContext || window.webkitAudioContext)();
  
  function AudioPlayer() {
    this.source = context.createBufferSource();
    this.analyser = context.createAnalyser();
    this.stopped = true;
  }
  
  AudioPlayer.prototype.setBuffer = function(buffer) {
    this.source.buffer = buffer;
    this.source.looping = false;
  };
  
  AudioPlayer.prototype.play = function() {
    this.source.connect(this.analyser);
    this.analyser.connect(context.destination);
  
    this.source.noteOn(0);
    this.stopped = false;
  };
  
  AudioPlayer.prototype.stop = function() {
    this.analyser.disconnect();
    this.source.disconnect();
    this.stopped = true;
  };
  </code></pre>
  
  <p>Does anybody know what to do, to get it work?</p>