Open biesbjerg opened 5 years ago
When last item in playlist has completed PLAYLIST_COMPLETED should be called.
PLAYLIST_COMPLETED
It is not called.
I've only tested this on iOS.
Set playlist using setPlaylistItems, call play and let it play until the end.
setPlaylistItems
play
iPhone X, iOS 12
8.1.2 (cordova-lib@8.1.1)
Installed platforms: android 6.2.3 browser 4.1.0 ios 4.4.0 Available platforms: osx ~4.0.1 windows ~6.0.0
cordova-plugin-playlist 0.6.0 "AudioPlayer"
2019-01-28 12:32:10.382879+0100 Mindly[4001:1605081] playbackDuration ==> 29.97696 2019-01-28 12:32:10.383058+0100 Mindly[4001:1605081] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 29.98025 2019-01-28 12:32:10.383125+0100 Mindly[4001:1605081] title ==> Sunflower (Spider-Man: Into the Spider-Verse) 2019-01-28 12:32:10.383178+0100 Mindly[4001:1605081] MPNowPlayingInfoPropertyPlaybackRate ==> 1 2019-01-28 12:32:10.383221+0100 Mindly[4001:1605081] albumTitle ==> Spider-Man: Into the Spider-Verse (Soundtrack From & Inspired by the Motion Picture) 2019-01-28 12:32:10.383265+0100 Mindly[4001:1605081] artist ==> Post Malone & Swae Lee 2019-01-28 12:32:10.384862+0100 Mindly[4001:1605081] Queue changed current item to: (null) 2019-01-28 12:32:10.384961+0100 Mindly[4001:1605081] New item ID: (null) 2019-01-28 12:32:10.385009+0100 Mindly[4001:1605081] Queue is at end: YES 2019-01-28 12:32:10.389039+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Playback Completed(50) [1445949267]: [object Object] 2019-01-28 12:32:10.395449+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Playback Position Changed(40) [1445949267]: [object Object] 2019-01-28 12:32:10.395551+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Track Changed(100) [NONE]: [object Object] 2019-01-28 12:32:10.408013+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Stopped(60) [INVALID]: 2019-01-28 12:32:10.408138+0100 Mindly[4001:1605081] ERROR: BAIL STATUS UPDATE, NO DATA 60
It seems the callback never fires because _isReplacingItems is true at runtime. What is the purpose of checking for this variable?
_isReplacingItems
true
WORKAROUND As a temporary workaround, instead of using setPlaylistItems you can chain clearAllItems and addAllItems:
clearAllItems
addAllItems
return this.wrapPromise('clearAllItems', (resolve, reject) => { this.instance.clearAllItems(resolve, reject); }).then(() => this.wrapPromise('addAllItems', (resolve, reject) => { this.instance.addAllItems(resolve, reject, tracks); }));
Expected Behaviour
When last item in playlist has completed
PLAYLIST_COMPLETED
should be called.Actual Behaviour
It is not called.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
I've only tested this on iOS.
Set playlist using
setPlaylistItems
, callplay
and let it play until the end.Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iPhone X, iOS 12
Cordova CLI version and cordova platform version
8.1.2 (cordova-lib@8.1.1)
Installed platforms: android 6.2.3 browser 4.1.0 ios 4.4.0 Available platforms: osx ~4.0.1 windows ~6.0.0
Plugin version
cordova-plugin-playlist 0.6.0 "AudioPlayer"
Sample Push Data Payload
Sample Code that illustrates the problem
Logs taken while reproducing problem
It seems the callback never fires because
_isReplacingItems
istrue
at runtime. What is the purpose of checking for this variable?WORKAROUND As a temporary workaround, instead of using
setPlaylistItems
you can chainclearAllItems
andaddAllItems
: