Skip to content

Commit

Permalink
Fix crash on end of queue
Browse files Browse the repository at this point in the history
  • Loading branch information
thornbill committed Mar 28, 2022
1 parent 1e65d31 commit 0253a01
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions assets/js/plugins/NativeAudioPlayer.staticjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ class NativeAudioPlayer {

// Report playback status changes to web
_reportStatus(status) {
// Playback has finished and should be reported as stopped
if (status.isFinished) {
if (this._isPlaying) {
this._isPlaying = false;
this._safelyTriggerEvent('stopped');
}
return;
}

// The item uri has changed
if (status.uri !== this.uri) {
this.uri = status.uri;
Expand All @@ -65,15 +74,6 @@ class NativeAudioPlayer {
return;
}

// Playback has finished and should be reported as stopped
if (status.isFinished) {
if (this._isPlaying) {
this._isPlaying = false;
this._safelyTriggerEvent('stopped');
}
return;
}

// The playing state has changed
if (status.isPlaying !== this._isPlaying) {
this._isPlaying = status.isPlaying;
Expand Down

0 comments on commit 0253a01

Please sign in to comment.