File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ public class RNTrackPlayer: RCTEventEmitter {
185
185
player. event. playbackEnd. addListener ( self ) { [ weak self] reason in
186
186
guard let `self` = self else { return }
187
187
188
- if ( reason == . playedUntilEnd) {
188
+ if reason == . playedUntilEnd {
189
189
// playbackEnd is called twice at the end of a track;
190
190
// we ignore .skippedToNext and only fire an event
191
191
// for .playedUntilEnd
@@ -194,14 +194,15 @@ public class RNTrackPlayer: RCTEventEmitter {
194
194
" position " : self . player. currentTime,
195
195
" nextTrack " : ( self . player. nextItems. first as? Track ) ? . id,
196
196
] )
197
+
198
+ if self . player. nextItems. count == 0 {
199
+ self . sendEvent ( withName: " playback-queue-ended " , body: [
200
+ " track " : ( self . player. currentItem as? Track ) ? . id,
201
+ " position " : self . player. currentTime,
202
+ ] )
203
+ }
197
204
}
198
205
199
- if reason == . playedUntilEnd && self . player. nextItems. count == 0 {
200
- self . sendEvent ( withName: " playback-queue-ended " , body: [
201
- " track " : ( self . player. currentItem as? Track ) ? . id,
202
- " position " : self . player. currentTime,
203
- ] )
204
- }
205
206
}
206
207
207
208
player. remoteCommandController. handleChangePlaybackPositionCommand = { [ weak self] event in
You can’t perform that action at this time.
0 commit comments