Hey, Thanks for the awesome library. Ran into an issue on iOS for playing an audio file.
Steps to reproduce:
1) Add and play an audio file.
2) Set TrackPlayer to pause state.
3) Add a new Track to the beginning of the queue: TrackPlayer.add(newlyAddedTrack, firstTrackInfo.id);
3) Skip to the new track: TrackPlayer.skip(newlyAddedTrack.id)
4) try to play track: TrackPlayer.play()
It incorrectly unpause the first audio file and play that instead of the newly added audio file. If the Tracking Player is in playing state, it works as expected and plays the new audio file, and also on android it works as expected. I currently have a work around, where I set it the trackplayer to play state before I run skip so that it works as expected.
I just fixed by adding a line into
/ios/RNTrackPlayer/Logic/MediaWrapper.swift
func skipToTrack(id: String) {
if let trackIndex = queue.index(where: { $0.id == id }) {
currentTrack?.skipped = true
currentIndex = trackIndex
play() //<------ ADD THIS
}
}
same issue here
I've just published version 1.1.0 on npm 馃憤 It should be resolved there. Could you with it?
Most helpful comment
I just fixed by adding a line into
/ios/RNTrackPlayer/Logic/MediaWrapper.swift
func skipToTrack(id: String) {
if let trackIndex = queue.index(where: { $0.id == id }) {
currentTrack?.skipped = true
currentIndex = trackIndex
play() //<------ ADD THIS
}
}