react-native-audio-browser 0.2.0-next.17 → 0.2.0-next.19

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.
Files changed (81) hide show
  1. package/android/build.gradle +2 -1
  2. package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +160 -106
  3. package/android/src/main/java/com/audiobrowser/browser/BrowserManager.kt +11 -29
  4. package/android/src/main/java/com/audiobrowser/player/CrossOriginHeaderStripper.kt +77 -0
  5. package/android/src/main/java/com/audiobrowser/player/MediaFactory.kt +28 -10
  6. package/android/src/main/java/com/audiobrowser/player/MediaSessionCallback.kt +377 -110
  7. package/android/src/main/java/com/audiobrowser/util/BrowserPathHelper.kt +13 -1
  8. package/android/src/main/res/values/strings.xml +6 -21
  9. package/android/src/test/java/com/audiobrowser/player/BrowseTilesTest.kt +385 -0
  10. package/android/src/test/java/com/audiobrowser/player/CrossOriginHeaderStripperTest.kt +94 -0
  11. package/lib/commonjs/features/browser.js +8 -0
  12. package/lib/commonjs/features/browser.js.map +1 -1
  13. package/lib/commonjs/web/NativeAudioBrowser.js +163 -50
  14. package/lib/commonjs/web/NativeAudioBrowser.js.map +1 -1
  15. package/lib/commonjs/web/TrackPlayer/LoadAttempt.js +37 -0
  16. package/lib/commonjs/web/TrackPlayer/LoadAttempt.js.map +1 -0
  17. package/lib/commonjs/web/TrackPlayer/PlaybackStateMachine.js +18 -2
  18. package/lib/commonjs/web/TrackPlayer/PlaybackStateMachine.js.map +1 -1
  19. package/lib/commonjs/web/TrackPlayer/Player.js +232 -39
  20. package/lib/commonjs/web/TrackPlayer/Player.js.map +1 -1
  21. package/lib/commonjs/web/TrackPlayer/QueuePlayer.js +33 -12
  22. package/lib/commonjs/web/TrackPlayer/QueuePlayer.js.map +1 -1
  23. package/lib/commonjs/web/browser/BrowserManager.js +30 -12
  24. package/lib/commonjs/web/browser/BrowserManager.js.map +1 -1
  25. package/lib/commonjs/web/browser/SearchManager.js +16 -19
  26. package/lib/commonjs/web/browser/SearchManager.js.map +1 -1
  27. package/lib/commonjs/web/http/RequestConfigBuilder.js +110 -27
  28. package/lib/commonjs/web/http/RequestConfigBuilder.js.map +1 -1
  29. package/lib/commonjs/web/http/followMediaRedirect.js +219 -0
  30. package/lib/commonjs/web/http/followMediaRedirect.js.map +1 -0
  31. package/lib/module/features/browser.js +8 -0
  32. package/lib/module/features/browser.js.map +1 -1
  33. package/lib/module/web/NativeAudioBrowser.js +163 -50
  34. package/lib/module/web/NativeAudioBrowser.js.map +1 -1
  35. package/lib/module/web/TrackPlayer/LoadAttempt.js +32 -0
  36. package/lib/module/web/TrackPlayer/LoadAttempt.js.map +1 -0
  37. package/lib/module/web/TrackPlayer/PlaybackStateMachine.js +18 -2
  38. package/lib/module/web/TrackPlayer/PlaybackStateMachine.js.map +1 -1
  39. package/lib/module/web/TrackPlayer/Player.js +232 -39
  40. package/lib/module/web/TrackPlayer/Player.js.map +1 -1
  41. package/lib/module/web/TrackPlayer/QueuePlayer.js +33 -12
  42. package/lib/module/web/TrackPlayer/QueuePlayer.js.map +1 -1
  43. package/lib/module/web/browser/BrowserManager.js +30 -12
  44. package/lib/module/web/browser/BrowserManager.js.map +1 -1
  45. package/lib/module/web/browser/SearchManager.js +16 -19
  46. package/lib/module/web/browser/SearchManager.js.map +1 -1
  47. package/lib/module/web/http/RequestConfigBuilder.js +110 -27
  48. package/lib/module/web/http/RequestConfigBuilder.js.map +1 -1
  49. package/lib/module/web/http/followMediaRedirect.js +215 -0
  50. package/lib/module/web/http/followMediaRedirect.js.map +1 -0
  51. package/lib/typescript/src/features/browser.d.ts +8 -0
  52. package/lib/typescript/src/features/browser.d.ts.map +1 -1
  53. package/lib/typescript/src/types/browser.d.ts +13 -4
  54. package/lib/typescript/src/types/browser.d.ts.map +1 -1
  55. package/package.json +1 -1
  56. package/src/features/browser.ts +8 -0
  57. package/src/types/browser.ts +13 -4
  58. package/src/web/NativeAudioBrowser.playWhenReady.test.ts +232 -2
  59. package/src/web/NativeAudioBrowser.ts +193 -60
  60. package/src/web/TrackPlayer/LoadAttempt.ts +29 -0
  61. package/src/web/TrackPlayer/PlaybackStateMachine.test.ts +60 -13
  62. package/src/web/TrackPlayer/PlaybackStateMachine.ts +22 -6
  63. package/src/web/TrackPlayer/Player.dispatch.test.ts +5 -3
  64. package/src/web/TrackPlayer/Player.load.test.ts +137 -1
  65. package/src/web/TrackPlayer/Player.ts +256 -37
  66. package/src/web/TrackPlayer/QueuePlayer.ts +33 -14
  67. package/src/web/__tests__/lifecycle.test.ts +345 -0
  68. package/src/web/__tests__/lifecycleHarness.ts +351 -0
  69. package/src/web/__tests__/loadEdgeCases.test.ts +195 -0
  70. package/src/web/__tests__/loadSupersession.test.ts +175 -0
  71. package/src/web/__tests__/retry.test.ts +169 -0
  72. package/src/web/browser/BrowserManager.ts +32 -15
  73. package/src/web/browser/SearchManager.test.ts +75 -0
  74. package/src/web/browser/SearchManager.ts +23 -26
  75. package/src/web/browser/__tests__/artwork-resolution.test.ts +117 -0
  76. package/src/web/browser/__tests__/layer-resolver.test.ts +35 -0
  77. package/src/web/browser/__tests__/search-navigation.test.ts +76 -0
  78. package/src/web/http/RequestConfigBuilder.test.ts +241 -1
  79. package/src/web/http/RequestConfigBuilder.ts +140 -33
  80. package/src/web/http/followMediaRedirect.test.ts +289 -0
  81. package/src/web/http/followMediaRedirect.ts +253 -0
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Player = void 0;
7
7
  var _playbackErrorKind = require("../playbackErrorKind");
8
+ var _LoadAttempt = require("./LoadAttempt");
8
9
  var _PlaybackStateMachine = require("./PlaybackStateMachine");
9
10
  var _SetupNotCalledError = require("./SetupNotCalledError");
10
11
  var _State = require("./State");
@@ -13,6 +14,15 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
13
14
 
14
15
  // Shaka event type definitions
15
16
 
17
+ /** Per-load overrides that don't belong on the track itself. */
18
+
19
+ /** The mutable request Shaka hands to a networking-engine request filter. */
20
+
21
+ /**
22
+ * `shaka.util.Error.Code.LOAD_INTERRUPTED`. Inlined because shaka is imported
23
+ * for types only here, as the codes in `playbackErrorKind.ts` are.
24
+ */
25
+ const LOAD_INTERRUPTED = 7000;
16
26
  class Player {
17
27
  hasInitialized = false;
18
28
  _current = undefined;
@@ -22,6 +32,13 @@ class Player {
22
32
  };
23
33
  _isStopped = false;
24
34
  _loadInProgress = false;
35
+
36
+ /**
37
+ * Headers for the track currently loaded, applied by the request filter
38
+ * installed in `setupPlayer`. On the instance rather than per request so the
39
+ * manifest, its segments and any key requests all carry them.
40
+ */
41
+
25
42
  // current getter/setter
26
43
  get current() {
27
44
  return this._current;
@@ -95,6 +112,18 @@ class Player {
95
112
  await player.attach(element);
96
113
  this.player = player;
97
114
 
115
+ // Apply the media config's headers to Shaka's requests, as native does to
116
+ // the AVURLAsset / ExoPlayer DataSpec. Without this they resolve and are
117
+ // then dropped, and authenticated media 401s on web alone.
118
+ player.getNetworkingEngine()?.registerRequestFilter((_type, request) => {
119
+ const headers = this.mediaHeaders;
120
+ if (!headers) return;
121
+ request.headers = {
122
+ ...request.headers,
123
+ ...headers
124
+ };
125
+ });
126
+
98
127
  // Listen for relevant events
99
128
  player.addEventListener('error', event => {
100
129
  const errorEvent = event;
@@ -106,22 +135,39 @@ class Player {
106
135
  element.addEventListener('playing', () => this.dispatch({
107
136
  type: 'playing'
108
137
  }));
109
- element.addEventListener('pause', () => this.dispatch({
110
- type: 'paused',
111
- hasAsset: this.current !== undefined
112
- }));
113
- player.addEventListener('loading', () => this.dispatch({
114
- type: 'trackLoading'
115
- }));
138
+ element.addEventListener('pause', () => {
139
+ // A track playing out fires `pause` and then `ended`. Only the `ended`
140
+ // is meaningful — reporting `paused` first flashes a state Android never
141
+ // reports, mid-queue or at the true end.
142
+ if (element.ended) return;
143
+ this.dispatch({
144
+ type: 'paused',
145
+ hasAsset: this.current !== undefined
146
+ });
147
+ });
148
+ player.addEventListener('loading', () => {
149
+ this.dispatch({
150
+ type: 'trackLoading'
151
+ });
152
+ // Every load passes through `buffering`, as ExoPlayer's always does via
153
+ // STATE_BUFFERING. Shaka only fires its own `buffering` event when a load
154
+ // actually stalls, so a load served from cache would otherwise skip a
155
+ // state native always reports.
156
+ this.dispatch({
157
+ type: 'waiting'
158
+ });
159
+ });
116
160
  player.addEventListener('loaded', () => this.dispatch({
117
- type: 'loadSeekCompleted'
161
+ type: 'loadSeekCompleted',
162
+ playWhenReady: this.playWhenReady
118
163
  }));
119
164
  player.addEventListener('buffering', event => {
120
165
  const bufferingEvent = event;
121
166
  this.dispatch(bufferingEvent.detail.buffering === true ? {
122
167
  type: 'waiting'
123
168
  } : {
124
- type: 'bufferingSufficient'
169
+ type: 'bufferingSufficient',
170
+ playWhenReady: this.playWhenReady
125
171
  });
126
172
  });
127
173
 
@@ -172,6 +218,24 @@ class Player {
172
218
  };
173
219
  }
174
220
  onError(shakaError) {
221
+ // An interrupted load is not a failure. Shaka raises it when a `load()` is
222
+ // cut short by a newer `load()` or an `unload()` — always something we
223
+ // asked for — and names it accordingly: `createAbortLoadError_()`. Its own
224
+ // code skips its cleanup unload for this code too (player.js:2010).
225
+ //
226
+ // Recognising it here rather than pre-emptively invalidating the load keeps
227
+ // the two independent: any teardown, in any order, can abort a load without
228
+ // the abort reaching a consumer as an error. Eagerly unloading to stop the
229
+ // outgoing track used to flash an error banner on every fast track switch.
230
+ if (shakaError.code === LOAD_INTERRUPTED) {
231
+ console.debug('Load interrupted by a newer load or an unload');
232
+ return;
233
+ }
234
+
235
+ // Before the unload below resets it: a retry resumes from where playback
236
+ // failed, as native does.
237
+ this.rememberResumePosition();
238
+
175
239
  // unload the current track to allow for clean playback on other
176
240
  this.player?.unload().catch(err => {
177
241
  console.error(`Error unloading player on 'onError'`, err);
@@ -195,16 +259,49 @@ class Player {
195
259
  console.debug('Error code', shakaError.code, 'object', shakaError);
196
260
  }
197
261
 
198
- /** Invalidates the .then/.catch of superseded loads — a Shaka load
199
- * interrupted by stop() or a newer load() rejects, and only the active load
200
- * may surface that (or run its onLoaded side effects). */
201
- _loadGeneration = 0;
202
- load(track, onLoaded) {
262
+ /**
263
+ * The load attempt that owns the player, or none. See {@link LoadAttempt}.
264
+ */
265
+
266
+ /**
267
+ * Starts an attempt, superseding whatever was in flight.
268
+ *
269
+ * Called by the outermost `load()` so supersession is registered when the
270
+ * caller asks for it, not when some inner stage happens to reach it.
271
+ */
272
+ beginLoadAttempt() {
273
+ this._attempt?.cancel();
274
+ const attempt = new _LoadAttempt.LoadAttempt();
275
+ this._attempt = attempt;
276
+ return attempt;
277
+ }
278
+
279
+ /** Abandons the attempt in flight without starting another — `stop()`. */
280
+ cancelLoadAttempt() {
281
+ this._attempt?.cancel();
282
+ this._attempt = undefined;
283
+ }
284
+ load(track, onLoaded, options) {
203
285
  const player = this.requirePlayer();
204
286
  this._isStopped = false;
205
287
  this._loadInProgress = true;
206
- const generation = ++this._loadGeneration;
207
- if (!track.src) {
288
+ const headers = options?.headers;
289
+ this.mediaHeaders = headers && Object.keys(headers).length > 0 ? headers : undefined;
290
+ // What Shaka plays may differ from what the caller queued; `track` is left
291
+ // alone so `current` and `getActiveTrack()` keep the caller's identity for
292
+ // it rather than a transport detail.
293
+ const playbackSrc = options?.src ?? track.src;
294
+ // Current on the attempt, not on success — native derives the active track
295
+ // from the queue, so a failed load is still the active track there and its
296
+ // error has somewhere to show. `getActiveTrackIndex()` already reported the
297
+ // queue's index either way; this makes the pair agree.
298
+ this.current = track;
299
+ // The attempt a subclass began before resolving the URL, so its resolution
300
+ // stage and both continuations below share one token. Passed rather than
301
+ // read off the instance: a direct `load()` is itself the outermost call and
302
+ // must start a fresh attempt, superseding whatever was in flight.
303
+ const attempt = options?.attempt ?? this.beginLoadAttempt();
304
+ if (!playbackSrc) {
208
305
  this._loadInProgress = false;
209
306
  this._pendingSeek = undefined;
210
307
  const error = {
@@ -218,10 +315,9 @@ class Player {
218
315
  };
219
316
  return;
220
317
  }
221
- player.load(track.src).then(() => {
222
- if (generation !== this._loadGeneration || this._isStopped) return;
318
+ player.load(playbackSrc).then(() => {
319
+ if (!attempt.isCurrent) return;
223
320
  this._loadInProgress = false;
224
- this.current = track;
225
321
  onLoaded?.(track);
226
322
 
227
323
  // Execute any pending seek that arrived during loading
@@ -235,7 +331,7 @@ class Player {
235
331
  this.play();
236
332
  }
237
333
  }).catch(err => {
238
- if (generation !== this._loadGeneration || this._isStopped) return;
334
+ if (!attempt.isCurrent) return;
239
335
  this._loadInProgress = false;
240
336
  this._pendingSeek = undefined;
241
337
  this.onError(this.toNormalizedError(err));
@@ -244,8 +340,14 @@ class Player {
244
340
  stop(onComplete) {
245
341
  const player = this.requirePlayer();
246
342
 
343
+ // Whatever was loading no longer owns the player: its continuations, at
344
+ // either boundary, must not revive it.
345
+ this.cancelLoadAttempt();
346
+
247
347
  // Match Android: stop sets playWhenReady=false and state=stopped,
248
- // but keeps the current track so play() can resume.
348
+ // but keeps the current track so play() can resume — from where it
349
+ // stopped, which ExoPlayer preserves across its own stop/prepare pair.
350
+ this.rememberResumePosition();
249
351
  this._isStopped = true;
250
352
  this._loadInProgress = false;
251
353
  this._pendingSeek = undefined;
@@ -258,34 +360,125 @@ class Player {
258
360
  onComplete?.(); // Still call onComplete so callers aren't left hanging
259
361
  });
260
362
  }
363
+
364
+ /**
365
+ * Where playback was when it failed or was stopped, so a re-prepare can
366
+ * resume rather than restart.
367
+ *
368
+ * Kept against the track it belongs to rather than as a bare number, so it
369
+ * self-invalidates when a different track becomes current and cannot be
370
+ * applied to the wrong one.
371
+ */
372
+
373
+ /**
374
+ * Records the current position, when there is one worth recording.
375
+ *
376
+ * A zero is never recorded: `onError` runs for a *load* failure too, where
377
+ * the element has just been torn down and reads 0, and overwriting a good
378
+ * position with that made a failed retry lose the place a successful one
379
+ * would have resumed from.
380
+ */
381
+ rememberResumePosition() {
382
+ const position = this.element?.currentTime;
383
+ const track = this.current;
384
+ if (!track || typeof position !== 'number' || position <= 0) return;
385
+ this._resume = {
386
+ track,
387
+ position
388
+ };
389
+ }
390
+
391
+ /**
392
+ * Android's `prepare()`, which both `play()` and `retry()` call.
393
+ *
394
+ * It early-returns unless ExoPlayer is STATE_IDLE, so it reconnects after an
395
+ * error or a stop and never re-buffers a healthy stream; `error`/`_isStopped`
396
+ * is web's equivalent of idle. Re-preparing re-resolves the URL, which is the
397
+ * whole point — a signed URL or token may have expired since the failure, and
398
+ * replaying the cached one just fails again. iOS says the same thing in its
399
+ * own `retry()`: "Re-resolve rather than replay the cached URL".
400
+ *
401
+ * Returns whether it handled the call, so `play()` knows not to also poke the
402
+ * element.
403
+ */
404
+ reprepare() {
405
+ if (!this.current) return false;
406
+ if (this.state.state !== _State.State.Error && !this._isStopped) return false;
407
+
408
+ // Not for live: `currentTime` there is elapsed time on a connection that no
409
+ // longer exists, and a fresh connection already *is* the live edge. Seeking
410
+ // to the old value asks for a point the new stream does not have. The
411
+ // track's own `live` declaration is the gate, as it is in `seekToLiveEdge`
412
+ // and on both native platforms.
413
+ const remembered = this._resume?.track === this.current ? this._resume.position : undefined;
414
+ const resume = this.current.live === true ? undefined : remembered;
415
+ this.reloadCurrent(resume);
416
+ return true;
417
+ }
261
418
  play() {
262
419
  const element = this.requireElement();
263
420
  this.playWhenReady = true;
264
- if (this.state.state === _State.State.Error && this.current) {
265
- this.reloadCurrent();
266
- return;
267
- }
268
421
 
269
- // Match Android: play() after stop() re-prepares the current track
270
- if (this._isStopped && this.current) {
271
- this.reloadCurrent();
272
- return;
273
- }
274
- element.play().catch(err => console.error(err));
422
+ // Matches Android's play(): set the intent, then prepare — which does
423
+ // something only when idle, i.e. after an error or a stop.
424
+ if (this.reprepare()) return;
425
+ element.play().catch(err => this.onPlayRejected(err));
426
+ }
427
+
428
+ /**
429
+ * A rejected `element.play()`. Web-only: neither native platform can refuse
430
+ * a play intent, so there is no parity target here.
431
+ *
432
+ * `AbortError` means a newer load interrupted this one — that load owns the
433
+ * state and the intent stands. Anything else, autoplay policy above all, is
434
+ * the browser refusing: the intent cannot be honoured, so it is cleared and
435
+ * the state settles rather than stranding on `loading`/`buffering`, which is
436
+ * where suppressing `ready` under `playWhenReady` would otherwise leave it.
437
+ */
438
+ onPlayRejected(err) {
439
+ console.error(err);
440
+ const name = typeof err === 'object' && err !== null && 'name' in err ? err.name : undefined;
441
+ if (name === 'AbortError') return;
442
+ this.playWhenReady = false;
443
+ this.dispatch({
444
+ type: 'paused',
445
+ hasAsset: this.current !== undefined
446
+ });
275
447
  }
276
448
 
277
449
  /**
278
- * Reloads the current track. `current` holds the *resolved* track, so
279
- * subclasses that resolve media URLs override this to reload from the
280
- * original source instead — re-feeding `current` into `load()` would
281
- * re-resolve an already-resolved URL and leak it into the queue.
450
+ * The track a reload re-feeds. `current` holds it as the caller queued it —
451
+ * `load()` takes the resolved URL separately, via `LoadOptions.src` — so
452
+ * re-feeding it is safe.
453
+ *
454
+ * The overridable part of {@link reloadCurrent}, rather than the whole
455
+ * method: a subclass backed by a queue changes only where the track comes
456
+ * from, and the reload itself stays in one place.
282
457
  */
283
- reloadCurrent() {
284
- if (this.current) this.load(this.current);
458
+ trackToReload() {
459
+ return this.current;
460
+ }
461
+
462
+ /** Reloads the track {@link trackToReload} names, resuming if asked to. */
463
+ reloadCurrent(resumePosition) {
464
+ const track = this.trackToReload();
465
+ if (!track) return;
466
+ this.load(track, resumePosition === undefined ? undefined : () => this.seekTo(resumePosition));
285
467
  }
468
+
469
+ /**
470
+ * Android's `retry()` is `player.prepare()` — the same call `play()` makes,
471
+ * without setting the intent. So this is `play()` minus the intent.
472
+ *
473
+ * It is emphatically not `shaka.Player.retryStreaming()`, which this used to
474
+ * call: that returns false and does nothing at all unless the load mode is
475
+ * MEDIA_SOURCE, so for a progressive file — the case a signed URL is for — it
476
+ * was a silent no-op, while the `play()` the same docs offer as the
477
+ * alternative recovered properly.
478
+ */
286
479
  retry() {
287
- const player = this.requirePlayer();
288
- player.retryStreaming();
480
+ this.requirePlayer();
481
+ this.reprepare();
289
482
  }
290
483
  pause() {
291
484
  const element = this.requireElement();
@@ -1 +1 @@
1
- {"version":3,"names":["_playbackErrorKind","require","_PlaybackStateMachine","_SetupNotCalledError","_State","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Player","hasInitialized","_current","undefined","_playWhenReady","_state","state","State","None","_isStopped","_loadInProgress","current","cur","newState","playWhenReady","pwr","requireElement","element","SetupNotCalledError","requirePlayer","player","setupPlayer","_options","window","shaka","Promise","resolve","then","polyfill","installAll","isBrowserSupported","Error","error","kind","code","message","document","createElement","setAttribute","body","appendChild","attach","addEventListener","event","errorEvent","onError","detail","dispatch","type","hasAsset","bufferingEvent","buffering","__DEV__","rnab","next","nextPlaybackState","applyState","toNormalizedError","err","data","String","shakaError","unload","catch","console","status","httpStatus","playbackErrorKind","navigator","onLine","toString","statusCode","debug","_loadGeneration","load","track","onLoaded","generation","src","_pendingSeek","currentTime","play","stop","onComplete","Stopped","reloadCurrent","retry","retryStreaming","pause","togglePlayback","setRate","rate","defaultPlaybackRate","playbackRate","getRate","seekBy","offset","seekTo","seconds","seekToLiveEdge","live","seekable","end","length","setVolume","volume","getVolume","getProgress","buffered","position","duration","exports"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/Player.ts"],"mappings":";;;;;;AAUA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA+B,SAAAI,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,E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+ {"version":3,"names":["_playbackErrorKind","require","_LoadAttempt","_PlaybackStateMachine","_SetupNotCalledError","_State","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LOAD_INTERRUPTED","Player","hasInitialized","_current","undefined","_playWhenReady","_state","state","State","None","_isStopped","_loadInProgress","current","cur","newState","playWhenReady","pwr","requireElement","element","SetupNotCalledError","requirePlayer","player","setupPlayer","_options","window","shaka","Promise","resolve","then","polyfill","installAll","isBrowserSupported","Error","error","kind","code","message","document","createElement","setAttribute","body","appendChild","attach","getNetworkingEngine","registerRequestFilter","_type","request","headers","mediaHeaders","addEventListener","event","errorEvent","onError","detail","dispatch","type","ended","hasAsset","bufferingEvent","buffering","__DEV__","rnab","next","nextPlaybackState","applyState","toNormalizedError","err","data","String","shakaError","console","debug","rememberResumePosition","unload","catch","status","httpStatus","playbackErrorKind","navigator","onLine","toString","statusCode","beginLoadAttempt","_attempt","cancel","attempt","LoadAttempt","cancelLoadAttempt","load","track","onLoaded","options","keys","length","playbackSrc","src","_pendingSeek","isCurrent","currentTime","play","stop","onComplete","Stopped","position","_resume","reprepare","remembered","resume","live","reloadCurrent","onPlayRejected","name","trackToReload","resumePosition","seekTo","retry","pause","togglePlayback","setRate","rate","defaultPlaybackRate","playbackRate","getRate","seekBy","offset","seconds","seekToLiveEdge","seekable","end","setVolume","volume","getVolume","getProgress","buffered","duration","exports"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/Player.ts"],"mappings":";;;;;;AAUA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA+B,SAAAK,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,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tB;EACF;EAEOoB,SAASA,CAACC,MAAc,EAAQ;IACrC,MAAMhH,OAAO,GAAG,IAAI,CAACD,cAAc,CAAC,CAAC;IACrCC,OAAO,CAACgH,MAAM,GAAGA,MAAM;EACzB;EAEOC,SAASA,CAAA,EAAW;IACzB,MAAMjH,OAAO,GAAG,IAAI,CAACD,cAAc,CAAC,CAAC;IACrC,OAAOC,OAAO,CAACgH,MAAM;EACvB;EAEOE,WAAWA,CAAA,EAAa;IAC7B,MAAMlH,OAAO,GAAG,IAAI,CAACD,cAAc,CAAC,CAAC;IACrC,IAAIoH,QAAQ,GAAG,CAAC;IAChB,IAAInH,OAAO,CAACmH,QAAQ,CAACxC,MAAM,GAAG,CAAC,EAAE;MAC/BwC,QAAQ,GAAGnH,OAAO,CAACmH,QAAQ,CAACL,GAAG,CAAC9G,OAAO,CAACmH,QAAQ,CAACxC,MAAM,GAAG,CAAC,CAAC;IAC9D;IACA,OAAO;MACLU,QAAQ,EAAErF,OAAO,CAACgF,WAAW;MAC7BoC,QAAQ,EAAEpH,OAAO,CAACoH,QAAQ,IAAI,CAAC;MAC/BD;IACF,CAAC;EACH;AACF;AAACE,OAAA,CAAAtI,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -21,35 +21,56 @@ class QueuePlayer extends _Player.Player {
21
21
  // was a silent pause) and armed load()'s auto-play with phantom intent.
22
22
  // Cleared before the state lands so consumers observe the native order
23
23
  // (intent → state → queueEnded), independent of onQueueEnded overrides.
24
- // Per-track ends that advance the queue keep the intent.
25
- if (state === _State.State.Ended && this.endsQueue()) {
26
- this.playWhenReady = false;
24
+ if (state !== _State.State.Ended) {
25
+ super.applyState(state);
26
+ return;
27
27
  }
28
- super.applyState(state);
29
28
 
30
- // dispatch() already gates on _isStopped before reaching applyState, so a
31
- // natural end while stopped never advances the queue.
32
- if (state === _State.State.Ended) {
29
+ // A track ending mid-queue is not an `ended` playback state: ExoPlayer
30
+ // reaches STATE_ENDED only at the end of the *playlist*, and an advance
31
+ // between items stays READY/BUFFERING. Web loads one track at a time, so
32
+ // the element's own `ended` arrives every time — reporting it flashed a
33
+ // terminal state, and dropped `PlayingState.playing` to false, between
34
+ // every pair of tracks. Repeat-one counts as mid-queue for the same
35
+ // reason: native reports nothing there either.
36
+ if (this.endsQueue()) {
37
+ // The real end: the intent goes with it, and the state is genuinely ended.
38
+ this.playWhenReady = false;
39
+ super.applyState(state);
40
+ // dispatch() already gates on _isStopped before reaching applyState, so a
41
+ // natural end while stopped never advances the queue.
33
42
  this.onTrackEnded();
43
+ return;
34
44
  }
45
+
46
+ // Suppressing `ended` is only safe when something takes over the state. A
47
+ // handler that declines to advance — the sleep timer set to end-of-track —
48
+ // leaves nothing to move it, and the player would sit reporting `playing`
49
+ // with nothing playing. Report the end in that case, as before.
50
+ if (!this.onTrackEnded()) super.applyState(state);
35
51
  }
36
52
 
37
53
  /** True when a natural end has nowhere to go: not repeating, no next track. */
38
54
  endsQueue() {
39
55
  return this.queue.repeatMode !== _RepeatMode.RepeatMode.Track && this.queue.repeatMode !== _RepeatMode.RepeatMode.Queue && this.queue.nextIndex() === undefined;
40
56
  }
57
+
58
+ /**
59
+ * @returns whether it started another load, and so owns the playback state
60
+ * from here. `false` means the caller still has to report the end itself.
61
+ */
41
62
  onTrackEnded() {
42
63
  if (this.queue.repeatMode === _RepeatMode.RepeatMode.Track) {
43
- if (this.queue.currentIndex !== undefined) {
44
- this.goToIndex(this.queue.currentIndex);
45
- }
46
- return;
64
+ if (this.queue.currentIndex === undefined) return false;
65
+ this.goToIndex(this.queue.currentIndex);
66
+ return true;
47
67
  }
48
68
  if (this.endsQueue()) {
49
69
  this.onQueueEnded();
50
- return;
70
+ return false;
51
71
  }
52
72
  this.skipToNext();
73
+ return true;
53
74
  }
54
75
 
55
76
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_Player","require","_QueueManager","_RepeatMode","_State","QueuePlayer","Player","queue","QueueManager","applyState","state","State","Ended","endsQueue","playWhenReady","onTrackEnded","repeatMode","RepeatMode","Track","Queue","nextIndex","undefined","currentIndex","goToIndex","onQueueEnded","skipToNext","index","initialPosition","track","getTrack","onLoaded","_track","seekTo","load","_isStopped","play","add","tracks","insertBeforeIndex","insert","skip","Error","wrapAroundFirstIndex","skipToPrevious","previousIndex","wrapAroundLastIndex","setShuffleEnabled","enabled","getShuffleEnabled","shuffleEnabled","setRepeatMode","mode","getRepeatMode","remove","indexes","outcome","kind","current","stop","onComplete","reset","clear","removeUpcomingTracks","removeUpcoming","move","fromIndex","toIndex","exports"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/QueuePlayer.ts"],"mappings":";;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMI,WAAW,SAASC,cAAM,CAAC;EAC5BC,KAAK,GAAG,IAAIC,0BAAY,CAAC,CAAC;EAE1BC,UAAUA,CAACC,KAAoB,EAAE;IACzC;IACA;IACA;IACA;IACA;IACA;IACA,IAAIA,KAAK,KAAKC,YAAK,CAACC,KAAK,IAAI,IAAI,CAACC,SAAS,CAAC,CAAC,EAAE;MAC7C,IAAI,CAACC,aAAa,GAAG,KAAK;IAC5B;IAEA,KAAK,CAACL,UAAU,CAACC,KAAK,CAAC;;IAEvB;IACA;IACA,IAAIA,KAAK,KAAKC,YAAK,CAACC,KAAK,EAAE;MACzB,IAAI,CAACG,YAAY,CAAC,CAAC;IACrB;EACF;;EAEA;EACQF,SAASA,CAAA,EAAY;IAC3B,OACE,IAAI,CAACN,KAAK,CAACS,UAAU,KAAKC,sBAAU,CAACC,KAAK,IAC1C,IAAI,CAACX,KAAK,CAACS,UAAU,KAAKC,sBAAU,CAACE,KAAK,IAC1C,IAAI,CAACZ,KAAK,CAACa,SAAS,CAAC,CAAC,KAAKC,SAAS;EAExC;EAEUN,YAAYA,CAAA,EAAG;IACv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Manager","_RepeatMode","_State","QueuePlayer","Player","queue","QueueManager","applyState","state","State","Ended","endsQueue","playWhenReady","onTrackEnded","repeatMode","RepeatMode","Track","Queue","nextIndex","undefined","currentIndex","goToIndex","onQueueEnded","skipToNext","index","initialPosition","track","getTrack","onLoaded","_track","seekTo","load","_isStopped","play","add","tracks","insertBeforeIndex","insert","skip","Error","wrapAroundFirstIndex","skipToPrevious","previousIndex","wrapAroundLastIndex","setShuffleEnabled","enabled","getShuffleEnabled","shuffleEnabled","setRepeatMode","mode","getRepeatMode","remove","indexes","outcome","kind","current","stop","onComplete","reset","clear","removeUpcomingTracks","removeUpcoming","move","fromIndex","toIndex","exports"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/QueuePlayer.ts"],"mappings":";;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMI,WAAW,SAASC,cAAM,CAAC;EAC5BC,KAAK,GAAG,IAAIC,0BAAY,CAAC,CAAC;EAE1BC,UAAUA,CAACC,KAAoB,EAAE;IACzC;IACA;IACA;IACA;IACA;IACA,IAAIA,KAAK,KAAKC,YAAK,CAACC,KAAK,EAAE;MACzB,KAAK,CAACH,UAAU,CAACC,KAAK,CAAC;MACvB;IACF;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,IAAI,CAACG,SAAS,CAAC,CAAC,EAAE;MACpB;MACA,IAAI,CAACC,aAAa,GAAG,KAAK;MAC1B,KAAK,CAACL,UAAU,CAACC,KAAK,CAAC;MACvB;MACA;MACA,IAAI,CAACK,YAAY,CAAC,CAAC;MACnB;IACF;;IAEA;IACA;IACA;IACA;IACA,IAAI,CAAC,IAAI,CAACA,YAAY,CAAC,CAAC,EAAE,KAAK,CAACN,UAAU,CAACC,KAAK,CAAC;EACnD;;EAEA;EACQG,SAASA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CAAC,CAAC;EACb;EAEOI,oBAAoBA,CAAA,EAAS;IAClC,IAAI,CAACvD,KAAK,CAACwD,cAAc,CAAC,CAAC;EAC7B;EAEOC,IAAIA,CAACC,SAAiB,EAAEC,OAAe,EAAQ;IACpD,IAAI,CAAC3D,KAAK,CAACyD,IAAI,CAACC,SAAS,EAAEC,OAAO,CAAC;EACrC;AACF;AAACC,OAAA,CAAA9D,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -297,6 +297,9 @@ class BrowserManager {
297
297
  * results (no contextual URLs), like the native `makeSearchResult`.
298
298
  * Matches Android's BrowserManager.search() which bypasses resolve() entirely.
299
299
  *
300
+ * A failed search propagates, so `navigate` turns it into a navigation error
301
+ * the way it does a failed browse resolve.
302
+ *
300
303
  * @param searchPath The search path (format: /__search?q=query)
301
304
  * @returns ResolvedTrack containing search results as one untitled section
302
305
  */
@@ -326,14 +329,9 @@ class BrowserManager {
326
329
  }
327
330
  // Handle request config-based search via the shared layered fetch.
328
331
  else if (searchRoute.searchConfig) {
329
- try {
330
- searchResults = await this.fetchSearchResults(searchRoute.searchConfig, {
331
- q: query
332
- });
333
- } catch (error) {
334
- console.error('Search failed:', error);
335
- return undefined;
336
- }
332
+ searchResults = await this.fetchSearchResults(searchRoute.searchConfig, {
333
+ q: query
334
+ });
337
335
  }
338
336
 
339
337
  // Search callbacks should return fresh tracks without contextual paths (like Android)
@@ -350,10 +348,13 @@ class BrowserManager {
350
348
  * Matches Android's artwork URL transformation with full Track access.
351
349
  */
352
350
  async transformArtworkForContent(content) {
351
+ // No short-circuit on a missing artwork config: Android gates per *track*
352
+ // (`artworkConfig == null && track.artwork == null`), so a track carrying a
353
+ // plain `artwork` URL still gets an `artworkSource`. Returning early here
354
+ // meant an app with no `artwork` block never populated the field at all —
355
+ // `resolveArtworkSourceAsync` already handles the no-config case the way
356
+ // `resolveArtworkUrl` does on Android.
353
357
  const artworkConfig = this._configuration.artwork;
354
- if (!artworkConfig) {
355
- return content;
356
- }
357
358
  // The shared request layer applies to artwork too — use the resolved layer
358
359
  // (resolver result or static config) so a resolver-only config still works.
359
360
  await this.ensureLayersResolved();
@@ -433,6 +434,22 @@ class BrowserManager {
433
434
  return undefined;
434
435
  }
435
436
 
437
+ /**
438
+ * Ensures the request layer is resolved for the current generation and
439
+ * returns it — the resolver's result when a `requestResolver` is configured,
440
+ * else the static `request`.
441
+ *
442
+ * Consumers outside the browse path (media URL building, artwork) must reach
443
+ * the request layer through this rather than reading `configuration.request`,
444
+ * or a resolver-only config silently loses its baseUrl, headers and transform
445
+ * exactly where a credential is needed. Mirrors Android's
446
+ * `BrowserManager.resolvedRequestConfig()`, which carries the same warning.
447
+ */
448
+ async resolvedRequestConfig() {
449
+ await this.ensureLayersResolved();
450
+ return this._resolvedRequest;
451
+ }
452
+
436
453
  /**
437
454
  * Ensures the request/browse layer configs are resolved for the current
438
455
  * generation. Any present resolver is invoked once per generation and the
@@ -581,8 +598,9 @@ class BrowserManager {
581
598
 
582
599
  // Transform artwork URLs on tabs via the async resolver so the shared
583
600
  // request layer (incl. its transform) applies, matching content/search.
601
+ // Gated per track inside the resolver, as on Android — see
602
+ // `transformArtworkForContent`.
584
603
  const artworkConfig = this._configuration.artwork;
585
- if (!artworkConfig) return tabs;
586
604
  // Resolved request layer (resolver or static), matching content/search.
587
605
  await this.ensureLayersResolved();
588
606
  const requestConfig = this._resolvedRequest;