Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

little fix on player.seek #194

Open
publicocean0 opened this issue Jun 1, 2017 · 1 comment
Open

little fix on player.seek #194

publicocean0 opened this issue Jun 1, 2017 · 1 comment

Comments

@publicocean0
Copy link

when you set currenttTme=0 before file is started there is a exception

fix is here

Player.prototype.seek = function(timestamp) {
var ref;
if ((ref = this.device) != null) {
ref.stop();
}
if (this.queue) {
this.queue.once('ready', (function(_this) {
return function() {
var ref1, ref2;
if ((ref1 = _this.device) != null) {
ref1.seek(_this.currentTime);
}
if (_this.playing) {
return (ref2 = _this.device) != null ? ref2.start() : void 0;
}
};
})(this));
timestamp = (timestamp / 1000) * this.format.sampleRate;
timestamp = this.asset.decoder.seek(timestamp);
this.currentTime = timestamp / this.format.sampleRate * 1000 | 0;
this.queue.reset();
return this.currentTime;
} else return 0
};

@master255
Copy link

master255 commented Jun 30, 2017

@publicocean0 thank you very much!
Right format version:

    Player.prototype.seek = function(timestamp) {
      var ref;
      if ((ref = this.device) != null) {
        ref.stop();
      }
	  if (this.queue) {
		  this.queue.once('ready', (function(_this) {
			return function() {
			  var ref1, ref2;
			  if ((ref1 = _this.device) != null) {
				ref1.seek(_this.currentTime);
			  }
			  if (_this.playing) {
				return (ref2 = _this.device) != null ? ref2.start() : void 0;
			  }
			};
		  })(this));
		  timestamp = (timestamp / 1000) * this.format.sampleRate;
		  timestamp = this.asset.decoder.seek(timestamp);
		  this.currentTime = timestamp / this.format.sampleRate * 1000 | 0;
		  this.queue.reset();
		  return this.currentTime;
	  } else return 0;
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants