title: With HTML5 SoundCloud player widget how do you programmatically skip to a different track without causing second unwanted track from playing?
body: <p>I am using the HTML5 Soundcloud widget API to skip to another song on the sound finish event.  </p>
  
  <p><a href="http://jsbin.com/axuzoj/4/edit" rel="nofollow">http://jsbin.com/axuzoj/4/edit</a></p>
  
  <p>Unfortunately there appears to be a race condition bug in the finish event.  The Soundcloud player ends up playing two songs simultaneously: the next song in the list and the song that was skipped to in the finish event handler. </p>
  
  <pre><code>var widget = null;
  $(function() {
      var iframe = document.querySelector('#soundcloud_player iframe');
      widget = SC.Widget(iframe);        
      widget.bind(SC.Widget.Events.READY, function() {
          widget.bind(SC.Widget.Events.FINISH, function() {                
              widget.skip(3);
          });
      });
  });
  </code></pre>
  
  <p>Is this a known bug?  </p>
  
  <p>Is there a better way to skip to a different track after a sound finishes?</p>
  
  <p>Is there a way to turn off continuous play?</p>
  
  <p>Adding a short wait before skipping in the finish event handler, gets around the problem.  But doesn't seem like a good method.</p>
  
  <pre><code>window.setTimeout(function() { widget.skip(3); }, 300);
  </code></pre>
  
  <p>Another work around is to skip to a song just before the previous song finishes, using PLAY_PROGRESS event instead of on FINISH event.</p>
  
  <pre><code>widget.bind(SC.Widget.Events.READY, function() {
      widget.bind(SC.Widget.Events.PLAY_PROGRESS, function(obj) {
          if (obj.relativePosition &gt; 0.999) {
              widget.pause();
              widget.skip(3);
          }
      });
  });
  </code></pre>