Skip to content

Commit

Permalink
Back to debugging basics
Browse files Browse the repository at this point in the history
  • Loading branch information
Amos Wenger committed Jun 17, 2011
1 parent acc89aa commit 226290e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,17 @@ Mad.Player.prototype.destroy = function() {

Mad.Player.prototype.progress = function () {
var delta = Date.now() - this.lastRebuffer;
if(delta > 500) {
if(delta > 1000) {
// freaking Firefox sometimes fails at scheduling tasks and we lose audio streaming
console.log("Device reinit - buffer underflow.");
this.reinitDevice();
}

var playtime = ((this.absoluteFrameIndex * 1152 + this.offset) / this.sampleRate) + delta / 1000.0;
//console.log("delta = " + delta + ", contentLength = " + this.stream.state.contentLength + ", this.offset = " + this.mpeg.this_frame);
console.log("delta = " + delta + ", contentLength = " + this.stream.state.contentLength + ", this.offset = " + this.mpeg.this_frame);
var total = playtime * this.stream.state.contentLength / this.mpeg.this_frame;
var preloaded = this.stream.state.amountRead / this.stream.state.contentLength;
//console.log("amountRead = " + this.stream.state.amountRead + ", preloaded = " + preloaded);
console.log("amountRead = " + this.stream.state.amountRead + ", preloaded = " + preloaded);
this.onProgress(playtime, total, preloaded);

var that = this;
Expand Down

0 comments on commit 226290e

Please sign in to comment.