React-native-track-player: iOS: skip doesnt work as expected

Created on 8 Nov 2018  路  4Comments  路  Source: react-native-kit/react-native-track-player

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.

Bug iOS

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
}
}

All 4 comments

  • 1, skip not working any more

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JakeMotta picture JakeMotta  路  3Comments

mckmarc picture mckmarc  路  4Comments

toooldmohammad picture toooldmohammad  路  3Comments

tarahiw picture tarahiw  路  3Comments

KalebPortillo picture KalebPortillo  路  4Comments