mirror of
https://github.com/Jellify-Music/App.git
synced 2026-04-22 18:10:31 -05:00
fix issue where skipping previous would always start the track
This commit is contained in:
@@ -16,15 +16,14 @@ import TrackPlayer, { State } from 'react-native-track-player'
|
||||
*/
|
||||
export async function previous(): Promise<void> {
|
||||
const { position } = await TrackPlayer.getProgress()
|
||||
const { state } = await TrackPlayer.getPlaybackState()
|
||||
|
||||
if (Math.floor(position) < SKIP_TO_PREVIOUS_THRESHOLD) {
|
||||
await TrackPlayer.stop() // Stop buffering the current track
|
||||
await TrackPlayer.skipToPrevious()
|
||||
} else await TrackPlayer.seekTo(0)
|
||||
|
||||
const { state } = await TrackPlayer.getPlaybackState()
|
||||
|
||||
if (state !== State.Playing) await TrackPlayer.play()
|
||||
if (state === State.Playing) await TrackPlayer.play()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user