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.
@@ -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.seekToNextMediaItem()
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.removeFirstOrNull()
168
+ next = pendingLaunchQueue.pollFirst()
169
169
  next?.let { runningDownloads.add(it) }
170
170
  }
171
171
  }
@@ -268,7 +268,7 @@ class PlaylistManager private constructor(
268
268
  }
269
269
  if (updateCount > 0) {
270
270
  affectedPlaylists[playlistId] = updateCount
271
- playlist.copy(tracks = newTracks)
271
+ playlist.copy(tracks = newTracks.toMutableList())
272
272
  } else {
273
273
  playlist
274
274
  }
@@ -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.0",
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(async (trackId: string) => {
142
- beginDeleting()
143
- try {
144
- await DownloadManager.deleteDownloadedTrack(trackId)
145
- } finally {
146
- endDeleting()
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(async (playlistId: string) => {
151
- beginDeleting()
152
- try {
153
- await DownloadManager.deleteDownloadedPlaylist(playlistId)
154
- } finally {
155
- endDeleting()
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)