react-native-nitro-player 1.7.0-alpha.0 → 1.7.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerListener.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/nitroplayer/download/DownloadManagerCore.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/nitroplayer/playlist/PlaylistManager.kt +1 -1
- package/lib/hooks/useDownloadActions.js +5 -5
- package/package.json +1 -1
- package/src/hooks/useAudioDevices.ts +1 -3
- package/src/hooks/useDownloadActions.ts +25 -19
|
@@ -176,7 +176,7 @@ internal class TrackPlayerEventListener(
|
|
|
176
176
|
// A source error leaves ExoPlayer in IDLE; skip the dead item and
|
|
177
177
|
// re-prepare so the rest of the queue keeps playing.
|
|
178
178
|
if (exo.hasNextMediaItem()) {
|
|
179
|
-
exo.
|
|
179
|
+
exo.seekToNext()
|
|
180
180
|
exo.prepare()
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -165,7 +165,7 @@ class DownloadManagerCore private constructor(
|
|
|
165
165
|
runningDownloads.remove(downloadId)
|
|
166
166
|
pendingLaunchQueue.remove(downloadId)
|
|
167
167
|
if (runningDownloads.size < maxConcurrent()) {
|
|
168
|
-
next = pendingLaunchQueue.
|
|
168
|
+
next = pendingLaunchQueue.pollFirst()
|
|
169
169
|
next?.let { runningDownloads.add(it) }
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -43,7 +43,7 @@ export function useDownloadActions() {
|
|
|
43
43
|
finally {
|
|
44
44
|
endDownloading();
|
|
45
45
|
}
|
|
46
|
-
}, []);
|
|
46
|
+
}, [beginDownloading, endDownloading]);
|
|
47
47
|
const downloadPlaylist = useCallback(async (playlistId, tracks) => {
|
|
48
48
|
beginDownloading();
|
|
49
49
|
setError(null);
|
|
@@ -58,7 +58,7 @@ export function useDownloadActions() {
|
|
|
58
58
|
finally {
|
|
59
59
|
endDownloading();
|
|
60
60
|
}
|
|
61
|
-
}, []);
|
|
61
|
+
}, [beginDownloading, endDownloading]);
|
|
62
62
|
const pauseDownload = useCallback(async (downloadId) => {
|
|
63
63
|
await DownloadManager.pauseDownload(downloadId);
|
|
64
64
|
}, []);
|
|
@@ -88,7 +88,7 @@ export function useDownloadActions() {
|
|
|
88
88
|
finally {
|
|
89
89
|
endDeleting();
|
|
90
90
|
}
|
|
91
|
-
}, []);
|
|
91
|
+
}, [beginDeleting, endDeleting]);
|
|
92
92
|
const deletePlaylist = useCallback(async (playlistId) => {
|
|
93
93
|
beginDeleting();
|
|
94
94
|
try {
|
|
@@ -97,7 +97,7 @@ export function useDownloadActions() {
|
|
|
97
97
|
finally {
|
|
98
98
|
endDeleting();
|
|
99
99
|
}
|
|
100
|
-
}, []);
|
|
100
|
+
}, [beginDeleting, endDeleting]);
|
|
101
101
|
const deleteAll = useCallback(async () => {
|
|
102
102
|
beginDeleting();
|
|
103
103
|
try {
|
|
@@ -106,7 +106,7 @@ export function useDownloadActions() {
|
|
|
106
106
|
finally {
|
|
107
107
|
endDeleting();
|
|
108
108
|
}
|
|
109
|
-
}, []);
|
|
109
|
+
}, [beginDeleting, endDeleting]);
|
|
110
110
|
const configure = useCallback((config) => {
|
|
111
111
|
DownloadManager.configure(config);
|
|
112
112
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-player",
|
|
3
|
-
"version": "1.7.0-alpha.
|
|
3
|
+
"version": "1.7.0-alpha.1",
|
|
4
4
|
"description": "A powerful audio player library for React Native with playlist management, playback controls, and support for Android Auto and CarPlay",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -4,9 +4,7 @@ import type { TAudioDevice } from '../specs/AudioDevices.nitro'
|
|
|
4
4
|
|
|
5
5
|
function devicesEqual(a: TAudioDevice[], b: TAudioDevice[]): boolean {
|
|
6
6
|
if (a.length !== b.length) return false
|
|
7
|
-
return a.every(
|
|
8
|
-
(d, i) => d.id === b[i]!.id && d.isActive === b[i]!.isActive
|
|
9
|
-
)
|
|
7
|
+
return a.every((d, i) => d.id === b[i]!.id && d.isActive === b[i]!.isActive)
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
/**
|
|
@@ -87,7 +87,7 @@ export function useDownloadActions(): UseDownloadActionsResult {
|
|
|
87
87
|
endDownloading()
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
[]
|
|
90
|
+
[beginDownloading, endDownloading]
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
const downloadPlaylist = useCallback(
|
|
@@ -107,7 +107,7 @@ export function useDownloadActions(): UseDownloadActionsResult {
|
|
|
107
107
|
endDownloading()
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
[]
|
|
110
|
+
[beginDownloading, endDownloading]
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
const pauseDownload = useCallback(async (downloadId: string) => {
|
|
@@ -138,23 +138,29 @@ export function useDownloadActions(): UseDownloadActionsResult {
|
|
|
138
138
|
await DownloadManager.cancelAllDownloads()
|
|
139
139
|
}, [])
|
|
140
140
|
|
|
141
|
-
const deleteTrack = useCallback(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
const deleteTrack = useCallback(
|
|
142
|
+
async (trackId: string) => {
|
|
143
|
+
beginDeleting()
|
|
144
|
+
try {
|
|
145
|
+
await DownloadManager.deleteDownloadedTrack(trackId)
|
|
146
|
+
} finally {
|
|
147
|
+
endDeleting()
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
[beginDeleting, endDeleting]
|
|
151
|
+
)
|
|
149
152
|
|
|
150
|
-
const deletePlaylist = useCallback(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
const deletePlaylist = useCallback(
|
|
154
|
+
async (playlistId: string) => {
|
|
155
|
+
beginDeleting()
|
|
156
|
+
try {
|
|
157
|
+
await DownloadManager.deleteDownloadedPlaylist(playlistId)
|
|
158
|
+
} finally {
|
|
159
|
+
endDeleting()
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
[beginDeleting, endDeleting]
|
|
163
|
+
)
|
|
158
164
|
|
|
159
165
|
const deleteAll = useCallback(async () => {
|
|
160
166
|
beginDeleting()
|
|
@@ -163,7 +169,7 @@ export function useDownloadActions(): UseDownloadActionsResult {
|
|
|
163
169
|
} finally {
|
|
164
170
|
endDeleting()
|
|
165
171
|
}
|
|
166
|
-
}, [])
|
|
172
|
+
}, [beginDeleting, endDeleting])
|
|
167
173
|
|
|
168
174
|
const configure = useCallback((config: DownloadConfig) => {
|
|
169
175
|
DownloadManager.configure(config)
|