1 decade ago by gxxaxx
When a level has a single music track AND the loop is set to false, it seems to me that the music should stop after a single play.
At the moment, the logic in _endedCallback is to replay the current music track if looping is true. Or, if looping is not true, play the next music track.
But, if there is just one music track than next == same track and it effectively loops.
At least that seems to be what is happening.
So, I'm suggesting the following modification as a possible solution.
At the moment, the logic in _endedCallback is to replay the current music track if looping is true. Or, if looping is not true, play the next music track.
But, if there is just one music track than next == same track and it effectively loops.
At least that seems to be what is happening.
So, I'm suggesting the following modification as a possible solution.
next: function() { if( !this.tracks.length ) { return; }; if ( this.tracks.length === 1 ) { return; }; // add this line