chore: Upgrade to latest react-native
This commit is contained in:
@@ -20,7 +20,6 @@ const baseTrackOptions: Record<string, string> = {
|
||||
static: 'true',
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generate a track object from a Jellyfin ItemId so that
|
||||
* react-native-track-player can easily consume it.
|
||||
@@ -54,7 +53,7 @@ export function generateTrackUrl(trackId: string, credentials: Credentials) {
|
||||
};
|
||||
|
||||
const trackParams = new URLSearchParams(trackOptions).toString();
|
||||
const url = encodeURI(`${credentials?.uri}/Audio/${trackId}/universal?${trackParams}`);
|
||||
const url = encodeURI(`${credentials?.uri}/Audio/${trackId}/universal?`) + trackParams;
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ const MimeTypes = {
|
||||
'audio/dsp': '.dsp',
|
||||
'audio/flac': '.flac',
|
||||
'audio/m4b': '.m4b',
|
||||
'audio/mpeg': '.mp3',
|
||||
'audio/vorbis': '.vorbis',
|
||||
'audio/x-ape': '.ape',
|
||||
'audio/xsp': '.xsp',
|
||||
|
||||
@@ -27,7 +27,7 @@ export default async function() {
|
||||
});
|
||||
|
||||
TrackPlayer.addEventListener(Event.RemoteStop, () => {
|
||||
TrackPlayer.destroy();
|
||||
TrackPlayer.reset();
|
||||
});
|
||||
|
||||
TrackPlayer.addEventListener(Event.RemoteSeek, (event) => {
|
||||
|
||||
@@ -17,8 +17,10 @@ export default function useCurrentTrack(): CurrentTrackResponse {
|
||||
const retrieveCurrentTrack = useCallback(async () => {
|
||||
const queue = await TrackPlayer.getQueue();
|
||||
const currentTrackIndex = await TrackPlayer.getCurrentTrack();
|
||||
setTrack(queue[currentTrackIndex]);
|
||||
setIndex(currentTrackIndex);
|
||||
if (currentTrackIndex !== null) {
|
||||
setTrack(queue[currentTrackIndex]);
|
||||
setIndex(currentTrackIndex);
|
||||
}
|
||||
}, [setTrack, setIndex]);
|
||||
|
||||
// Then execute the function on component mount and track changes
|
||||
|
||||
@@ -82,6 +82,10 @@ export default function usePlayTracks() {
|
||||
case 'add-after-currently-playing': {
|
||||
// Try and locate the current track
|
||||
const currentTrackIndex = await TrackPlayer.getCurrentTrack();
|
||||
|
||||
if (currentTrackIndex === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Since the argument is the id to insert the track BEFORE, we need
|
||||
// to get the current track + 1
|
||||
|
||||
Reference in New Issue
Block a user