Seems like the 'playback-track-changed' event just doesn't want to fire, and the playlist doesn't change to the next song -- neither in foreground or background. @dcvz have you tested this on your side?
+1
That's because func audioPlayer(_ audioPlayer: AudioPlayer, didFinishPlaying item: Track) { is not an existing delegate method:
https://github.com/react-native-kit/react-native-track-player/blob/dev/ios/RNTrackPlayer/Vendor/AudioPlayer/player/AudioPlayerDelegate.swift#L35
We can replace:
func audioPlayer(_ audioPlayer: AudioPlayer, didFinishPlaying item: Track) {
if (!playNext()) {
delegate?.playerExhaustedQueue()
}
}
with
func audioPlayer(_ audioPlayer: AudioPlayer, didUpdateProgressionTo time: TimeInterval, percentageRead: Float) {
if (percentageRead >= 100) {
if (!playNext()) {
delegate?.playerExhaustedQueue()
}
}
}
In Logic/Mediawrapper.swift
@olivierlesnicki will test that soon and get back to you to see if it works
@olivierlesnicki does that makes playback-track-changed and playback-queue-ended work properly?
This should be fixed in d28d402e85f3f311bec60f5c0cbdf3f7fb14c211 馃殌
If the plan is to fix it in the vendor we should also create a pull request upstream:
https://github.com/delannoyk/AudioPlayer
@dcvz Still not playing tracks when previous is completed. updated to 0.2.4. Anyone tried this on latest version?
I am having the same problem
I am facing a weird issue while skipping to next track when the current track finish. That is working fine. But in my case when I am passing 3 tracks for playing and it will always skip 2nd track and start 3rd track directly. It is only happening in ios. In android, it is working fine.
And also in ios, there is a specific case where it happened. If one track is over and automatically it starts playing next track here it is skipping 2nd track and start 3rd one.
But when we manually change track using method TrackPlayer.skipToNext() then is playing 2nd track.
I don't know why it is happening when the library automatically changes track.
Here are an example and screenshots. I had loaded 3 track in track player
tracksIds = ["779/779.mp3","780/780.mp3","781/781.mp3"]
Here is how on track change event send data when we use TrackPlayer.skipToNext()
When an audio player start playing
{track: null, nextTrack: "779/779.mp3", position: 0}
when I call TrackPlayer.skipToNext()
{track: "779/779.mp3", nextTrack: "780/780.mp3", position: 40.494045174}
when I again call TrackPlayer.skipToNext()
{nextTrack: "781/781.mp3", track: "780/780.mp3", position: 30.435507483}
Here is how on track change event send data when track player automatically changes audio no completion of current Track
When an audio player start playing
{track: null, nextTrack: "779/779.mp3", position: 0}
When track 779.mp3 finishes. I got following data from no track change listener
{nextTrack: "781/781.mp3", position: 3356.256, track: "780/780.mp3"}
and when we see it start playing 3rd audio by skipping 2nd track that is 780.
You can see the difference in on data receiving from on track change listener when 1st audio finished and we change with the method.
Any one facing these kind of issue
I am using react-native-track-player : v1.2.0
@jariwalabhavesh, this sounds like a different issue from what this thread was about. Can you please make a separate issue?
Also the screenshots you mentioned didn't seem to get included.
@curiousdustin: Thank you for the response I will create a new issue. With screenshot
@curiousdustin : looks like fixed in v1.2.3