Merge branch 'main' of github.com:austinried/subtracks into main

This commit is contained in:
austinried 2022-04-12 10:21:37 +09:00
commit 4905f75564
2 changed files with 5 additions and 3 deletions

View File

@ -28,9 +28,9 @@ const setNetState = (netState: 'mobile' | 'wifi') => {
}) })
} }
const rebuildQueue = () => { const rebuildQueue = (forcePlay?: boolean) => {
unstable_batchedUpdates(() => { unstable_batchedUpdates(() => {
useStore.getState().rebuildQueue(useStore.getState().playerState === State.Playing) useStore.getState().rebuildQueue(forcePlay)
}) })
} }
@ -139,7 +139,7 @@ const createService = async () => {
// fix for ExoPlayer aborting playback while esimating content length // fix for ExoPlayer aborting playback while esimating content length
if (code === 'playback-source' && message.includes('416')) { if (code === 'playback-source' && message.includes('416')) {
rebuildQueue() rebuildQueue(true)
} }
}) })
} }

View File

@ -274,6 +274,7 @@ export const createTrackPlayerSlice = (set: SetStore, get: GetStore): TrackPlaye
const currentTrack = await getCurrentTrack() const currentTrack = await getCurrentTrack()
const playerState = await getPlayerState() const playerState = await getPlayerState()
const position = (await TrackPlayer.getPosition()) || 0 const position = (await TrackPlayer.getPosition()) || 0
const repeatMode = await getRepeatMode()
const queueName = get().queueName const queueName = get().queueName
const queueContextId = get().queueContextId const queueContextId = get().queueContextId
@ -304,6 +305,7 @@ export const createTrackPlayerSlice = (set: SetStore, get: GetStore): TrackPlaye
await TrackPlayer.skip(currentTrack) await TrackPlayer.skip(currentTrack)
} }
await TrackPlayer.setRepeatMode(repeatMode)
await TrackPlayer.seekTo(position) await TrackPlayer.seekTo(position)
if (playerState === State.Playing || forcePlay) { if (playerState === State.Playing || forcePlay) {