MidiPlayerJS icon indicating copy to clipboard operation
MidiPlayerJS copied to clipboard

playing event fires after endOfFile

Open simonwiles opened this issue 4 years ago • 2 comments

Player.on('playing', (currentTick) => console.log("playing"));
Player.on('endOfFile', () => console.log("endOfFile"));

I consistently get one playing event firing after the endOfFile event. Is this expected behaviour? Thanks!

simonwiles avatar Apr 16 '21 00:04 simonwiles

Same question.

PetitDevil avatar Jun 25 '22 12:06 PetitDevil

A fix for this would be to change the implementation from:

if (!dryRun) this.triggerPlayerEvent('playing', {
  tick: this.tick
});

to:

if (!dryRun && this.isPlaying()) this.triggerPlayerEvent('playing', {
  tick: this.tick
});

serg472 avatar Jul 12 '22 04:07 serg472