capacitor-plugin-playlist 0.10.3 → 0.10.9
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/README.md +1133 -137
- package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistPlugin.kt +9 -5
- package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioPlayer.java +20 -5
- package/android/src/main/java/org/dwbn/plugins/playlist/playlist/AudioPlaylistHandler.java +10 -11
- package/dist/docs.json +66 -33
- package/dist/esm/RmxAudioPlayer.js +11 -14
- package/dist/esm/RmxAudioPlayer.js.map +1 -1
- package/dist/esm/definitions.d.ts +119 -7
- package/dist/esm/web.d.ts +3 -1
- package/dist/esm/web.js +27 -39
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +39 -54
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +39 -54
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/PlaylistPlugin/Plugin.swift +7 -3
- package/ios/Sources/PlaylistPlugin/RmxAudioPlayer.swift +117 -55
- package/package.json +1 -1
|
@@ -159,8 +159,8 @@ public class PlaylistPlugin : Plugin(), OnStatusReportListener {
|
|
|
159
159
|
val removals = ArrayList<TrackRemovalItem>()
|
|
160
160
|
for (index in 0 until items.length()) {
|
|
161
161
|
val entry = items.optJSONObject(index) ?: continue
|
|
162
|
-
val trackIndex = entry.optInt("
|
|
163
|
-
val trackId = entry.optString("
|
|
162
|
+
val trackIndex = entry.optInt("index", -1)
|
|
163
|
+
val trackId = entry.optString("id", "")
|
|
164
164
|
removals.add(TrackRemovalItem(trackIndex, trackId))
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -410,9 +410,13 @@ public class PlaylistPlugin : Plugin(), OnStatusReportListener {
|
|
|
410
410
|
Handler(Looper.getMainLooper()).post {
|
|
411
411
|
val position = call.getFloat("position", 0f)!!
|
|
412
412
|
val prewarm = call.getBoolean("prewarm", false) ?: false
|
|
413
|
-
|
|
414
|
-
call.
|
|
415
|
-
|
|
413
|
+
// Default true preserves legacy Android in-place play when `play` is omitted.
|
|
414
|
+
val play = call.getBoolean("play", true) ?: true
|
|
415
|
+
val resumed = audioPlayerImpl!!.resumeAfterVideoHandoff(position, prewarm, play)
|
|
416
|
+
val result = JSObject()
|
|
417
|
+
result.put("resumed", resumed)
|
|
418
|
+
call.resolve(result)
|
|
419
|
+
Log.i(TAG, "resumeAfterVideoHandoff prewarm=$prewarm play=$play resumed=$resumed")
|
|
416
420
|
}
|
|
417
421
|
}
|
|
418
422
|
|
|
@@ -471,24 +471,39 @@ public class RmxAudioPlayer implements PlaybackStatusListener<AudioTrack>,
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
public
|
|
475
|
-
resumeAfterVideoHandoff(positionSec, false);
|
|
474
|
+
public boolean resumeAfterVideoHandoff(float positionSec) {
|
|
475
|
+
return resumeAfterVideoHandoff(positionSec, false, true);
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
/**
|
|
479
|
+
* @return {@code true} when in-place resume already seeked and started playback
|
|
480
|
+
* (JS should skip redundant seekTo/play); {@code false} for prewarm, paused handoff,
|
|
481
|
+
* or last-resort beginPlayback.
|
|
482
|
+
*/
|
|
483
|
+
public boolean resumeAfterVideoHandoff(float positionSec, boolean prewarm) {
|
|
484
|
+
return resumeAfterVideoHandoff(positionSec, prewarm, true);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
public boolean resumeAfterVideoHandoff(float positionSec, boolean prewarm, boolean play) {
|
|
479
488
|
lastKnownHandoffPositionSec = positionSec;
|
|
480
489
|
long positionMs = (long) (positionSec * 1000f);
|
|
481
490
|
if (prewarm) {
|
|
482
491
|
playlistManager.setVideoHandoffForegroundRetain(true);
|
|
483
492
|
playlistManager.beginPlayback(positionMs, true);
|
|
484
|
-
return;
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
if (!play) {
|
|
496
|
+
// Paused video exit — do not start audio; JS will seekTo only.
|
|
497
|
+
playlistManager.setVideoHandoffForegroundRetain(false);
|
|
498
|
+
return false;
|
|
485
499
|
}
|
|
486
500
|
if (tryResumeVideoHandoffInPlace(positionMs)) {
|
|
487
|
-
return;
|
|
501
|
+
return true;
|
|
488
502
|
}
|
|
489
503
|
// Service not foreground — last resort (may be muted on Android 17 when backgrounded).
|
|
490
504
|
playlistManager.setVideoHandoffForegroundRetain(false);
|
|
491
505
|
playlistManager.beginPlayback(positionMs, true);
|
|
506
|
+
return false;
|
|
492
507
|
}
|
|
493
508
|
|
|
494
509
|
/**
|
|
@@ -93,22 +93,21 @@ public class AudioPlaylistHandler<I extends PlaylistItem, M extends BasePlaylist
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
|
-
* Resume at {@code positionMs} after native video ends. Re-requests focus and
|
|
97
|
-
*
|
|
96
|
+
* Resume at {@code positionMs} after native video ends. Re-requests focus and starts playback.
|
|
97
|
+
* <p>
|
|
98
|
+
* Must {@link #play()} before {@link #seek(long)}: playlistcore {@code performSeek} sets
|
|
99
|
+
* {@code playingBeforeSeek = isPlaying()}. After video handoff the player is paused, so
|
|
100
|
+
* seek-then-play races with {@code onSeekComplete}, which calls {@code pause()} when
|
|
101
|
+
* {@code playingBeforeSeek} is false — UI briefly shows playing while native audio stays silent.
|
|
98
102
|
*/
|
|
99
103
|
public void resumePlaybackAfterVideoHandoff(long positionMs) {
|
|
100
104
|
((PlaylistManager) getPlaylistManager()).setVideoHandoffForegroundRetain(false);
|
|
105
|
+
setStartPaused(false);
|
|
101
106
|
getAudioFocusProvider().requestFocus();
|
|
102
|
-
com.devbrackets.android.playlistcore.api.MediaPlayerApi<I> mediaPlayer = getCurrentMediaPlayer();
|
|
103
|
-
if (mediaPlayer != null) {
|
|
104
|
-
if (positionMs > 0) {
|
|
105
|
-
seek(positionMs);
|
|
106
|
-
}
|
|
107
|
-
if (mediaPlayer.isPlaying()) {
|
|
108
|
-
mediaPlayer.pause();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
107
|
play();
|
|
108
|
+
if (positionMs > 0) {
|
|
109
|
+
seek(positionMs);
|
|
110
|
+
}
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
/**
|
package/dist/docs.json
CHANGED
|
@@ -11,18 +11,27 @@
|
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "eventName",
|
|
14
|
-
"docs": "",
|
|
14
|
+
"docs": "Must be `'status'`.",
|
|
15
15
|
"type": "'status'"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "listenerFunc",
|
|
19
|
-
"docs": "",
|
|
19
|
+
"docs": "Callback receiving `{ action, status }` where `status.msgType` is a `RmxAudioStatusMessage`.",
|
|
20
20
|
"type": "PlaylistStatusChangeCallback"
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
"returns": "Promise<PluginListenerHandle>",
|
|
24
|
-
"tags": [
|
|
25
|
-
|
|
24
|
+
"tags": [
|
|
25
|
+
{
|
|
26
|
+
"name": "param",
|
|
27
|
+
"text": "eventName Must be `'status'`."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "param",
|
|
31
|
+
"text": "listenerFunc Callback receiving `{ action, status }` where `status.msgType` is a `RmxAudioStatusMessage`."
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"docs": "Subscribe to native playback status events (track changes, position, errors, etc.).",
|
|
26
35
|
"complexTypes": [
|
|
27
36
|
"PluginListenerHandle",
|
|
28
37
|
"PlaylistStatusChangeCallback"
|
|
@@ -41,7 +50,7 @@
|
|
|
41
50
|
],
|
|
42
51
|
"returns": "Promise<void>",
|
|
43
52
|
"tags": [],
|
|
44
|
-
"docs": "",
|
|
53
|
+
"docs": "Configure plugin behaviour (verbose logging, stream pause handling, notification icon).\nCan be called at any time; not required before playback.",
|
|
45
54
|
"complexTypes": [
|
|
46
55
|
"AudioPlayerOptions"
|
|
47
56
|
],
|
|
@@ -53,7 +62,7 @@
|
|
|
53
62
|
"parameters": [],
|
|
54
63
|
"returns": "Promise<void>",
|
|
55
64
|
"tags": [],
|
|
56
|
-
"docs": "",
|
|
65
|
+
"docs": "Initialise the native player, register status callbacks, and arm lock-screen / notification controls.\nCall once before playback (e.g. on app start).",
|
|
57
66
|
"complexTypes": [],
|
|
58
67
|
"slug": "initialize"
|
|
59
68
|
},
|
|
@@ -63,7 +72,7 @@
|
|
|
63
72
|
"parameters": [],
|
|
64
73
|
"returns": "Promise<void>",
|
|
65
74
|
"tags": [],
|
|
66
|
-
"docs": "",
|
|
75
|
+
"docs": "Tear down native resources (audio session, media service, observers).\nCall when the app no longer needs background audio (e.g. on logout).",
|
|
67
76
|
"complexTypes": [],
|
|
68
77
|
"slug": "release"
|
|
69
78
|
},
|
|
@@ -79,7 +88,7 @@
|
|
|
79
88
|
],
|
|
80
89
|
"returns": "Promise<void>",
|
|
81
90
|
"tags": [],
|
|
82
|
-
"docs": "",
|
|
91
|
+
"docs": "Replace the entire playlist. Clears all previous items.\nUse `options.retainPosition` to keep the current track and playback position.",
|
|
83
92
|
"complexTypes": [
|
|
84
93
|
"PlaylistOptions"
|
|
85
94
|
],
|
|
@@ -97,7 +106,7 @@
|
|
|
97
106
|
],
|
|
98
107
|
"returns": "Promise<void>",
|
|
99
108
|
"tags": [],
|
|
100
|
-
"docs": "",
|
|
109
|
+
"docs": "Append a single track to the end of the playlist.",
|
|
101
110
|
"complexTypes": [
|
|
102
111
|
"AddItemOptions"
|
|
103
112
|
],
|
|
@@ -115,7 +124,7 @@
|
|
|
115
124
|
],
|
|
116
125
|
"returns": "Promise<void>",
|
|
117
126
|
"tags": [],
|
|
118
|
-
"docs": "",
|
|
127
|
+
"docs": "Append multiple tracks to the end of the playlist.\nRaises one `RMXSTATUS_ITEM_ADDED` event per track.",
|
|
119
128
|
"complexTypes": [
|
|
120
129
|
"AddAllItemOptions"
|
|
121
130
|
],
|
|
@@ -133,7 +142,7 @@
|
|
|
133
142
|
],
|
|
134
143
|
"returns": "Promise<void>",
|
|
135
144
|
"tags": [],
|
|
136
|
-
"docs": "",
|
|
145
|
+
"docs": "Remove a track by index (preferred) or id.\nIf the removed track is currently playing, the next track starts automatically.",
|
|
137
146
|
"complexTypes": [
|
|
138
147
|
"RemoveItemOptions"
|
|
139
148
|
],
|
|
@@ -151,7 +160,7 @@
|
|
|
151
160
|
],
|
|
152
161
|
"returns": "Promise<void>",
|
|
153
162
|
"tags": [],
|
|
154
|
-
"docs": "",
|
|
163
|
+
"docs": "Remove multiple tracks in a single batch.\nIf the currently playing track is removed, the next available track starts automatically.",
|
|
155
164
|
"complexTypes": [
|
|
156
165
|
"RemoveItemsOptions"
|
|
157
166
|
],
|
|
@@ -163,7 +172,7 @@
|
|
|
163
172
|
"parameters": [],
|
|
164
173
|
"returns": "Promise<void>",
|
|
165
174
|
"tags": [],
|
|
166
|
-
"docs": "",
|
|
175
|
+
"docs": "Remove all tracks from the playlist. Raises `RMXSTATUS_PLAYLIST_CLEARED` and `RMXSTATUS_STOPPED`.",
|
|
167
176
|
"complexTypes": [],
|
|
168
177
|
"slug": "clearallitems"
|
|
169
178
|
},
|
|
@@ -173,7 +182,7 @@
|
|
|
173
182
|
"parameters": [],
|
|
174
183
|
"returns": "Promise<GetPlaylistResult>",
|
|
175
184
|
"tags": [],
|
|
176
|
-
"docs": "",
|
|
185
|
+
"docs": "Return a snapshot of the current playlist items.",
|
|
177
186
|
"complexTypes": [
|
|
178
187
|
"GetPlaylistResult"
|
|
179
188
|
],
|
|
@@ -185,7 +194,7 @@
|
|
|
185
194
|
"parameters": [],
|
|
186
195
|
"returns": "Promise<void>",
|
|
187
196
|
"tags": [],
|
|
188
|
-
"docs": "",
|
|
197
|
+
"docs": "Start or resume playback of the current track.\nNo-op if the playlist is empty.",
|
|
189
198
|
"complexTypes": [],
|
|
190
199
|
"slug": "play"
|
|
191
200
|
},
|
|
@@ -195,7 +204,7 @@
|
|
|
195
204
|
"parameters": [],
|
|
196
205
|
"returns": "Promise<void>",
|
|
197
206
|
"tags": [],
|
|
198
|
-
"docs": "",
|
|
207
|
+
"docs": "Pause playback of the current track.",
|
|
199
208
|
"complexTypes": [],
|
|
200
209
|
"slug": "pause"
|
|
201
210
|
},
|
|
@@ -205,7 +214,7 @@
|
|
|
205
214
|
"parameters": [],
|
|
206
215
|
"returns": "Promise<void>",
|
|
207
216
|
"tags": [],
|
|
208
|
-
"docs": "",
|
|
217
|
+
"docs": "Skip to the next track. At the end of the playlist, wraps to the beginning when loop is enabled.",
|
|
209
218
|
"complexTypes": [],
|
|
210
219
|
"slug": "skipforward"
|
|
211
220
|
},
|
|
@@ -215,7 +224,7 @@
|
|
|
215
224
|
"parameters": [],
|
|
216
225
|
"returns": "Promise<void>",
|
|
217
226
|
"tags": [],
|
|
218
|
-
"docs": "",
|
|
227
|
+
"docs": "Skip to the previous track. No-op when already at the first track.",
|
|
219
228
|
"complexTypes": [],
|
|
220
229
|
"slug": "skipback"
|
|
221
230
|
},
|
|
@@ -231,7 +240,7 @@
|
|
|
231
240
|
],
|
|
232
241
|
"returns": "Promise<void>",
|
|
233
242
|
"tags": [],
|
|
234
|
-
"docs": "",
|
|
243
|
+
"docs": "Seek to a position (seconds) in the currently playing track.\nIf the position exceeds track length, playback advances to the next track.",
|
|
235
244
|
"complexTypes": [
|
|
236
245
|
"SeekToOptions"
|
|
237
246
|
],
|
|
@@ -249,7 +258,7 @@
|
|
|
249
258
|
],
|
|
250
259
|
"returns": "Promise<void>",
|
|
251
260
|
"tags": [],
|
|
252
|
-
"docs": "",
|
|
261
|
+
"docs": "Jump to the track at the given 0-based index and start playback.",
|
|
253
262
|
"complexTypes": [
|
|
254
263
|
"PlayByIndexOptions"
|
|
255
264
|
],
|
|
@@ -267,7 +276,7 @@
|
|
|
267
276
|
],
|
|
268
277
|
"returns": "Promise<void>",
|
|
269
278
|
"tags": [],
|
|
270
|
-
"docs": "",
|
|
279
|
+
"docs": "Jump to the track with the given id and start playback.",
|
|
271
280
|
"complexTypes": [
|
|
272
281
|
"PlayByIdOptions"
|
|
273
282
|
],
|
|
@@ -285,7 +294,7 @@
|
|
|
285
294
|
],
|
|
286
295
|
"returns": "Promise<void>",
|
|
287
296
|
"tags": [],
|
|
288
|
-
"docs": "",
|
|
297
|
+
"docs": "Select the track at the given index without necessarily starting playback.",
|
|
289
298
|
"complexTypes": [
|
|
290
299
|
"SelectByIndexOptions"
|
|
291
300
|
],
|
|
@@ -303,7 +312,7 @@
|
|
|
303
312
|
],
|
|
304
313
|
"returns": "Promise<void>",
|
|
305
314
|
"tags": [],
|
|
306
|
-
"docs": "",
|
|
315
|
+
"docs": "Select the track with the given id without necessarily starting playback.",
|
|
307
316
|
"complexTypes": [
|
|
308
317
|
"SelectByIdOptions"
|
|
309
318
|
],
|
|
@@ -321,7 +330,7 @@
|
|
|
321
330
|
],
|
|
322
331
|
"returns": "Promise<void>",
|
|
323
332
|
"tags": [],
|
|
324
|
-
"docs": "",
|
|
333
|
+
"docs": "Set media stream volume. Float in range [0, 1].\nHardware volume controls still apply on top of this value.",
|
|
325
334
|
"complexTypes": [
|
|
326
335
|
"SetPlaybackVolumeOptions"
|
|
327
336
|
],
|
|
@@ -339,7 +348,7 @@
|
|
|
339
348
|
],
|
|
340
349
|
"returns": "Promise<void>",
|
|
341
350
|
"tags": [],
|
|
342
|
-
"docs": "",
|
|
351
|
+
"docs": "When true, the playlist loops back to the first track after the last track completes.",
|
|
343
352
|
"complexTypes": [
|
|
344
353
|
"SetLoopOptions"
|
|
345
354
|
],
|
|
@@ -357,7 +366,7 @@
|
|
|
357
366
|
],
|
|
358
367
|
"returns": "Promise<void>",
|
|
359
368
|
"tags": [],
|
|
360
|
-
"docs": "",
|
|
369
|
+
"docs": "Set playback speed. Float value; 0 pauses, 1 is normal speed.",
|
|
361
370
|
"complexTypes": [
|
|
362
371
|
"SetPlaybackRateOptions"
|
|
363
372
|
],
|
|
@@ -369,13 +378,13 @@
|
|
|
369
378
|
"parameters": [],
|
|
370
379
|
"returns": "Promise<void>",
|
|
371
380
|
"tags": [],
|
|
372
|
-
"docs": "
|
|
381
|
+
"docs": "Release native audio session / focus so a video player can own playback.\n\n**Android:** pauses current track, abandons audio focus, stores head position. Does not stop the foreground media service.\n**iOS:** pauses, captures head position, deactivates `AVAudioSession` with `notifyOthersOnDeactivation`.\n**Web:** pauses HTMLAudioElement and stores `currentTime`.\n\nCall immediately before native video starts (e.g. your video plugin's init method).",
|
|
373
382
|
"complexTypes": [],
|
|
374
383
|
"slug": "prepareforvideohandoff"
|
|
375
384
|
},
|
|
376
385
|
{
|
|
377
386
|
"name": "resumeAfterVideoHandoff",
|
|
378
|
-
"signature": "(options: ResumeAfterVideoHandoffOptions) => Promise<
|
|
387
|
+
"signature": "(options: ResumeAfterVideoHandoffOptions) => Promise<ResumeAfterVideoHandoffResult>",
|
|
379
388
|
"parameters": [
|
|
380
389
|
{
|
|
381
390
|
"name": "options",
|
|
@@ -383,10 +392,11 @@
|
|
|
383
392
|
"type": "ResumeAfterVideoHandoffOptions"
|
|
384
393
|
}
|
|
385
394
|
],
|
|
386
|
-
"returns": "Promise<
|
|
395
|
+
"returns": "Promise<ResumeAfterVideoHandoffResult>",
|
|
387
396
|
"tags": [],
|
|
388
|
-
"docs": "
|
|
397
|
+
"docs": "Re-arm native audio after video ends or, on Android, prewarm the media service before video starts.\n\n**Without `prewarm` (typical exit path):**\n- Android: when `play` is true (default), re-acquires focus and resumes at `position`. When `resumed` is `true`, JS should skip redundant `seekTo`/`play`. When `play` is false, clears handoff retain and returns `{ resumed: false }` so JS can seek without playing.\n- iOS: restores pinned track, reactivates `AVAudioSession`, seeks to `position`, and when `play` is true starts playback (seek-then-play). Returns `{ resumed: true }` when native handled the handoff.\n- Web: stores position only (no native session); returns `{ resumed: false }`.\n\n**With `prewarm: true` (Android, before video):** starts `MediaService` in foreground at `position` but stays silent — no audio focus, no audible playback. Always returns `{ resumed: false }`.",
|
|
389
398
|
"complexTypes": [
|
|
399
|
+
"ResumeAfterVideoHandoffResult",
|
|
390
400
|
"ResumeAfterVideoHandoffOptions"
|
|
391
401
|
],
|
|
392
402
|
"slug": "resumeaftervideohandoff"
|
|
@@ -397,7 +407,7 @@
|
|
|
397
407
|
"parameters": [],
|
|
398
408
|
"returns": "Promise<GetLastKnownPositionResult>",
|
|
399
409
|
"tags": [],
|
|
400
|
-
"docs": "
|
|
410
|
+
"docs": "Return the audio head position (seconds) captured during the most recent `prepareForVideoHandoff`\nor passed to `resumeAfterVideoHandoff`.",
|
|
401
411
|
"complexTypes": [
|
|
402
412
|
"GetLastKnownPositionResult"
|
|
403
413
|
],
|
|
@@ -1903,6 +1913,22 @@
|
|
|
1903
1913
|
}
|
|
1904
1914
|
]
|
|
1905
1915
|
},
|
|
1916
|
+
{
|
|
1917
|
+
"name": "ResumeAfterVideoHandoffResult",
|
|
1918
|
+
"slug": "resumeaftervideohandoffresult",
|
|
1919
|
+
"docs": "",
|
|
1920
|
+
"tags": [],
|
|
1921
|
+
"methods": [],
|
|
1922
|
+
"properties": [
|
|
1923
|
+
{
|
|
1924
|
+
"name": "resumed",
|
|
1925
|
+
"tags": [],
|
|
1926
|
+
"docs": "`true` when native already handled seek (and play when requested) in place.\nWhen `true`, JS should skip redundant `seekTo` / `play` to avoid a stutter.\n`false` on web, prewarm, paused Android handoff, and Android last-resort `beginPlayback`.",
|
|
1927
|
+
"complexTypes": [],
|
|
1928
|
+
"type": "boolean"
|
|
1929
|
+
}
|
|
1930
|
+
]
|
|
1931
|
+
},
|
|
1906
1932
|
{
|
|
1907
1933
|
"name": "ResumeAfterVideoHandoffOptions",
|
|
1908
1934
|
"slug": "resumeaftervideohandoffoptions",
|
|
@@ -1913,14 +1939,21 @@
|
|
|
1913
1939
|
{
|
|
1914
1940
|
"name": "position",
|
|
1915
1941
|
"tags": [],
|
|
1916
|
-
"docs": "",
|
|
1942
|
+
"docs": "Resume position in seconds (video exit head or saved audio position).",
|
|
1917
1943
|
"complexTypes": [],
|
|
1918
1944
|
"type": "number"
|
|
1919
1945
|
},
|
|
1920
1946
|
{
|
|
1921
1947
|
"name": "prewarm",
|
|
1922
1948
|
"tags": [],
|
|
1923
|
-
"docs": "Android
|
|
1949
|
+
"docs": "**Android only.** When `true`, promote `MediaService` to foreground and prepare at `position`\nwithout requesting audio focus or playing audio. Use immediately after `prepareForVideoHandoff`\nand before native video starts, while the app is still foregrounded.\nIgnored on iOS (no-op). Not applicable on web.",
|
|
1950
|
+
"complexTypes": [],
|
|
1951
|
+
"type": "boolean | undefined"
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
"name": "play",
|
|
1955
|
+
"tags": [],
|
|
1956
|
+
"docs": "When `true`, native starts audible playback after seeking to `position`.\nWhen `false` (paused video exit), native must not start playback.\niOS defaults to `false` when omitted; Android defaults to `true` for legacy callers.",
|
|
1924
1957
|
"complexTypes": [],
|
|
1925
1958
|
"type": "boolean | undefined"
|
|
1926
1959
|
}
|
|
@@ -150,28 +150,25 @@ export class RmxAudioPlayer {
|
|
|
150
150
|
if (!removeItem) {
|
|
151
151
|
throw new Error('Track removal spec is empty');
|
|
152
152
|
}
|
|
153
|
-
if (!removeItem.trackId &&
|
|
153
|
+
if (!removeItem.trackId && removeItem.trackIndex === undefined) {
|
|
154
154
|
throw new Error('Track removal spec is invalid');
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
if (removeItem.trackId) {
|
|
161
|
-
opts.id = removeItem.trackId;
|
|
162
|
-
}
|
|
163
|
-
return Playlist.removeItem(opts);
|
|
156
|
+
return Playlist.removeItem({
|
|
157
|
+
id: removeItem.trackId,
|
|
158
|
+
index: removeItem.trackIndex
|
|
159
|
+
});
|
|
164
160
|
};
|
|
165
161
|
/**
|
|
166
162
|
* Removes all given tracks from the playlist; these can be specified either by trackId or trackIndex. If the removed items
|
|
167
163
|
* include the currently playing item, the next available item will automatically begin playing.
|
|
168
164
|
*/
|
|
169
165
|
this.removeItems = (items) => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
return Playlist.removeItems({
|
|
167
|
+
items: (items || []).map((item) => ({
|
|
168
|
+
id: item === null || item === void 0 ? void 0 : item.trackId,
|
|
169
|
+
index: item === null || item === void 0 ? void 0 : item.trackIndex
|
|
170
|
+
}))
|
|
171
|
+
});
|
|
175
172
|
};
|
|
176
173
|
/**
|
|
177
174
|
* Clear the entire playlist. This will result in the STOPPED event being raised.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RmxAudioPlayer.js","sourceRoot":"","sources":["../../src/RmxAudioPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,iCAAiC,EACpC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"RmxAudioPlayer.js","sourceRoot":"","sources":["../../src/RmxAudioPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,iCAAiC,EACpC,MAAM,aAAa,CAAC;AAcrB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AAEH,MAAM,qBAAqB,GAAG;IAC1B,qBAAqB,CAAC,2BAA2B;IACjD,qBAAqB,CAAC,kBAAkB;IACxC,qBAAqB,CAAC,mBAAmB;IACzC,qBAAqB,CAAC,iBAAiB;IACvC,qBAAqB,CAAC,iBAAiB;IACvC,qBAAqB,CAAC,gBAAgB;IACtC,qBAAqB,CAAC,eAAe;IACrC,qBAAqB,CAAC,mBAAmB;IACzC,qBAAqB,CAAC,eAAe;CACxC,CAAC;AAEF,MAAM,OAAO,cAAc;IAevB;;;;OAIG;IACH,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC;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