Hivenfour / SeamlessLoop

Reproduce seamless/gapless audio loops on HTML5/JavaScript without specific browser Audio APIs
121 stars 16 forks source link

Calling STOP when nothing is playing... #5

Open itsallgood opened 9 years ago

itsallgood commented 9 years ago

Just thought id say that the stop function doesn't check to see if anything is playing - so if someone calls stop and nothing is playing - it'll just hate it.

So I added:

SeamlessLoop.prototype.stop = function() {
    if(this.timeout){
        clearTimeout(this.timeout);
        this.actual._1.currentTime = 0;
        this.actual._1.pause();
        this.actual._2.currentTime = 0;
        this.actual._2.pause();
    }
};

Around the function.

Cheers!