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.
- package/android/build.gradle +2 -1
- package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +160 -106
- package/android/src/main/java/com/audiobrowser/browser/BrowserManager.kt +11 -29
- package/android/src/main/java/com/audiobrowser/player/CrossOriginHeaderStripper.kt +77 -0
- package/android/src/main/java/com/audiobrowser/player/MediaFactory.kt +28 -10
- package/android/src/main/java/com/audiobrowser/player/MediaSessionCallback.kt +377 -110
- package/android/src/main/java/com/audiobrowser/util/BrowserPathHelper.kt +13 -1
- package/android/src/main/res/values/strings.xml +6 -21
- package/android/src/test/java/com/audiobrowser/player/BrowseTilesTest.kt +385 -0
- package/android/src/test/java/com/audiobrowser/player/CrossOriginHeaderStripperTest.kt +94 -0
- package/lib/commonjs/features/browser.js +8 -0
- package/lib/commonjs/features/browser.js.map +1 -1
- package/lib/commonjs/web/NativeAudioBrowser.js +163 -50
- package/lib/commonjs/web/NativeAudioBrowser.js.map +1 -1
- package/lib/commonjs/web/TrackPlayer/LoadAttempt.js +37 -0
- package/lib/commonjs/web/TrackPlayer/LoadAttempt.js.map +1 -0
- package/lib/commonjs/web/TrackPlayer/PlaybackStateMachine.js +18 -2
- package/lib/commonjs/web/TrackPlayer/PlaybackStateMachine.js.map +1 -1
- package/lib/commonjs/web/TrackPlayer/Player.js +232 -39
- package/lib/commonjs/web/TrackPlayer/Player.js.map +1 -1
- package/lib/commonjs/web/TrackPlayer/QueuePlayer.js +33 -12
- package/lib/commonjs/web/TrackPlayer/QueuePlayer.js.map +1 -1
- package/lib/commonjs/web/browser/BrowserManager.js +30 -12
- package/lib/commonjs/web/browser/BrowserManager.js.map +1 -1
- package/lib/commonjs/web/browser/SearchManager.js +16 -19
- package/lib/commonjs/web/browser/SearchManager.js.map +1 -1
- package/lib/commonjs/web/http/RequestConfigBuilder.js +110 -27
- package/lib/commonjs/web/http/RequestConfigBuilder.js.map +1 -1
- package/lib/commonjs/web/http/followMediaRedirect.js +219 -0
- package/lib/commonjs/web/http/followMediaRedirect.js.map +1 -0
- package/lib/module/features/browser.js +8 -0
- package/lib/module/features/browser.js.map +1 -1
- package/lib/module/web/NativeAudioBrowser.js +163 -50
- package/lib/module/web/NativeAudioBrowser.js.map +1 -1
- package/lib/module/web/TrackPlayer/LoadAttempt.js +32 -0
- package/lib/module/web/TrackPlayer/LoadAttempt.js.map +1 -0
- package/lib/module/web/TrackPlayer/PlaybackStateMachine.js +18 -2
- package/lib/module/web/TrackPlayer/PlaybackStateMachine.js.map +1 -1
- package/lib/module/web/TrackPlayer/Player.js +232 -39
- package/lib/module/web/TrackPlayer/Player.js.map +1 -1
- package/lib/module/web/TrackPlayer/QueuePlayer.js +33 -12
- package/lib/module/web/TrackPlayer/QueuePlayer.js.map +1 -1
- package/lib/module/web/browser/BrowserManager.js +30 -12
- package/lib/module/web/browser/BrowserManager.js.map +1 -1
- package/lib/module/web/browser/SearchManager.js +16 -19
- package/lib/module/web/browser/SearchManager.js.map +1 -1
- package/lib/module/web/http/RequestConfigBuilder.js +110 -27
- package/lib/module/web/http/RequestConfigBuilder.js.map +1 -1
- package/lib/module/web/http/followMediaRedirect.js +215 -0
- package/lib/module/web/http/followMediaRedirect.js.map +1 -0
- package/lib/typescript/src/features/browser.d.ts +8 -0
- package/lib/typescript/src/features/browser.d.ts.map +1 -1
- package/lib/typescript/src/types/browser.d.ts +13 -4
- package/lib/typescript/src/types/browser.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/browser.ts +8 -0
- package/src/types/browser.ts +13 -4
- package/src/web/NativeAudioBrowser.playWhenReady.test.ts +232 -2
- package/src/web/NativeAudioBrowser.ts +193 -60
- package/src/web/TrackPlayer/LoadAttempt.ts +29 -0
- package/src/web/TrackPlayer/PlaybackStateMachine.test.ts +60 -13
- package/src/web/TrackPlayer/PlaybackStateMachine.ts +22 -6
- package/src/web/TrackPlayer/Player.dispatch.test.ts +5 -3
- package/src/web/TrackPlayer/Player.load.test.ts +137 -1
- package/src/web/TrackPlayer/Player.ts +256 -37
- package/src/web/TrackPlayer/QueuePlayer.ts +33 -14
- package/src/web/__tests__/lifecycle.test.ts +345 -0
- package/src/web/__tests__/lifecycleHarness.ts +351 -0
- package/src/web/__tests__/loadEdgeCases.test.ts +195 -0
- package/src/web/__tests__/loadSupersession.test.ts +175 -0
- package/src/web/__tests__/retry.test.ts +169 -0
- package/src/web/browser/BrowserManager.ts +32 -15
- package/src/web/browser/SearchManager.test.ts +75 -0
- package/src/web/browser/SearchManager.ts +23 -26
- package/src/web/browser/__tests__/artwork-resolution.test.ts +117 -0
- package/src/web/browser/__tests__/layer-resolver.test.ts +35 -0
- package/src/web/browser/__tests__/search-navigation.test.ts +76 -0
- package/src/web/http/RequestConfigBuilder.test.ts +241 -1
- package/src/web/http/RequestConfigBuilder.ts +140 -33
- package/src/web/http/followMediaRedirect.test.ts +289 -0
- package/src/web/http/followMediaRedirect.ts +253 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { playbackErrorKind } from '../playbackErrorKind';
|
|
4
|
+
import { LoadAttempt } from './LoadAttempt';
|
|
4
5
|
import { nextPlaybackState } from './PlaybackStateMachine';
|
|
5
6
|
import { SetupNotCalledError } from './SetupNotCalledError';
|
|
6
7
|
import { State } from './State';
|
|
@@ -9,6 +10,15 @@ import { State } from './State';
|
|
|
9
10
|
|
|
10
11
|
// Shaka event type definitions
|
|
11
12
|
|
|
13
|
+
/** Per-load overrides that don't belong on the track itself. */
|
|
14
|
+
|
|
15
|
+
/** The mutable request Shaka hands to a networking-engine request filter. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `shaka.util.Error.Code.LOAD_INTERRUPTED`. Inlined because shaka is imported
|
|
19
|
+
* for types only here, as the codes in `playbackErrorKind.ts` are.
|
|
20
|
+
*/
|
|
21
|
+
const LOAD_INTERRUPTED = 7000;
|
|
12
22
|
export class Player {
|
|
13
23
|
hasInitialized = false;
|
|
14
24
|
_current = undefined;
|
|
@@ -18,6 +28,13 @@ export class Player {
|
|
|
18
28
|
};
|
|
19
29
|
_isStopped = false;
|
|
20
30
|
_loadInProgress = false;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Headers for the track currently loaded, applied by the request filter
|
|
34
|
+
* installed in `setupPlayer`. On the instance rather than per request so the
|
|
35
|
+
* manifest, its segments and any key requests all carry them.
|
|
36
|
+
*/
|
|
37
|
+
|
|
21
38
|
// current getter/setter
|
|
22
39
|
get current() {
|
|
23
40
|
return this._current;
|
|
@@ -91,6 +108,18 @@ export class Player {
|
|
|
91
108
|
await player.attach(element);
|
|
92
109
|
this.player = player;
|
|
93
110
|
|
|
111
|
+
// Apply the media config's headers to Shaka's requests, as native does to
|
|
112
|
+
// the AVURLAsset / ExoPlayer DataSpec. Without this they resolve and are
|
|
113
|
+
// then dropped, and authenticated media 401s on web alone.
|
|
114
|
+
player.getNetworkingEngine()?.registerRequestFilter((_type, request) => {
|
|
115
|
+
const headers = this.mediaHeaders;
|
|
116
|
+
if (!headers) return;
|
|
117
|
+
request.headers = {
|
|
118
|
+
...request.headers,
|
|
119
|
+
...headers
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
|
|
94
123
|
// Listen for relevant events
|
|
95
124
|
player.addEventListener('error', event => {
|
|
96
125
|
const errorEvent = event;
|
|
@@ -102,22 +131,39 @@ export class Player {
|
|
|
102
131
|
element.addEventListener('playing', () => this.dispatch({
|
|
103
132
|
type: 'playing'
|
|
104
133
|
}));
|
|
105
|
-
element.addEventListener('pause', () =>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
134
|
+
element.addEventListener('pause', () => {
|
|
135
|
+
// A track playing out fires `pause` and then `ended`. Only the `ended`
|
|
136
|
+
// is meaningful — reporting `paused` first flashes a state Android never
|
|
137
|
+
// reports, mid-queue or at the true end.
|
|
138
|
+
if (element.ended) return;
|
|
139
|
+
this.dispatch({
|
|
140
|
+
type: 'paused',
|
|
141
|
+
hasAsset: this.current !== undefined
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
player.addEventListener('loading', () => {
|
|
145
|
+
this.dispatch({
|
|
146
|
+
type: 'trackLoading'
|
|
147
|
+
});
|
|
148
|
+
// Every load passes through `buffering`, as ExoPlayer's always does via
|
|
149
|
+
// STATE_BUFFERING. Shaka only fires its own `buffering` event when a load
|
|
150
|
+
// actually stalls, so a load served from cache would otherwise skip a
|
|
151
|
+
// state native always reports.
|
|
152
|
+
this.dispatch({
|
|
153
|
+
type: 'waiting'
|
|
154
|
+
});
|
|
155
|
+
});
|
|
112
156
|
player.addEventListener('loaded', () => this.dispatch({
|
|
113
|
-
type: 'loadSeekCompleted'
|
|
157
|
+
type: 'loadSeekCompleted',
|
|
158
|
+
playWhenReady: this.playWhenReady
|
|
114
159
|
}));
|
|
115
160
|
player.addEventListener('buffering', event => {
|
|
116
161
|
const bufferingEvent = event;
|
|
117
162
|
this.dispatch(bufferingEvent.detail.buffering === true ? {
|
|
118
163
|
type: 'waiting'
|
|
119
164
|
} : {
|
|
120
|
-
type: 'bufferingSufficient'
|
|
165
|
+
type: 'bufferingSufficient',
|
|
166
|
+
playWhenReady: this.playWhenReady
|
|
121
167
|
});
|
|
122
168
|
});
|
|
123
169
|
|
|
@@ -168,6 +214,24 @@ export class Player {
|
|
|
168
214
|
};
|
|
169
215
|
}
|
|
170
216
|
onError(shakaError) {
|
|
217
|
+
// An interrupted load is not a failure. Shaka raises it when a `load()` is
|
|
218
|
+
// cut short by a newer `load()` or an `unload()` — always something we
|
|
219
|
+
// asked for — and names it accordingly: `createAbortLoadError_()`. Its own
|
|
220
|
+
// code skips its cleanup unload for this code too (player.js:2010).
|
|
221
|
+
//
|
|
222
|
+
// Recognising it here rather than pre-emptively invalidating the load keeps
|
|
223
|
+
// the two independent: any teardown, in any order, can abort a load without
|
|
224
|
+
// the abort reaching a consumer as an error. Eagerly unloading to stop the
|
|
225
|
+
// outgoing track used to flash an error banner on every fast track switch.
|
|
226
|
+
if (shakaError.code === LOAD_INTERRUPTED) {
|
|
227
|
+
console.debug('Load interrupted by a newer load or an unload');
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Before the unload below resets it: a retry resumes from where playback
|
|
232
|
+
// failed, as native does.
|
|
233
|
+
this.rememberResumePosition();
|
|
234
|
+
|
|
171
235
|
// unload the current track to allow for clean playback on other
|
|
172
236
|
this.player?.unload().catch(err => {
|
|
173
237
|
console.error(`Error unloading player on 'onError'`, err);
|
|
@@ -191,16 +255,49 @@ export class Player {
|
|
|
191
255
|
console.debug('Error code', shakaError.code, 'object', shakaError);
|
|
192
256
|
}
|
|
193
257
|
|
|
194
|
-
/**
|
|
195
|
-
*
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
258
|
+
/**
|
|
259
|
+
* The load attempt that owns the player, or none. See {@link LoadAttempt}.
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Starts an attempt, superseding whatever was in flight.
|
|
264
|
+
*
|
|
265
|
+
* Called by the outermost `load()` so supersession is registered when the
|
|
266
|
+
* caller asks for it, not when some inner stage happens to reach it.
|
|
267
|
+
*/
|
|
268
|
+
beginLoadAttempt() {
|
|
269
|
+
this._attempt?.cancel();
|
|
270
|
+
const attempt = new LoadAttempt();
|
|
271
|
+
this._attempt = attempt;
|
|
272
|
+
return attempt;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** Abandons the attempt in flight without starting another — `stop()`. */
|
|
276
|
+
cancelLoadAttempt() {
|
|
277
|
+
this._attempt?.cancel();
|
|
278
|
+
this._attempt = undefined;
|
|
279
|
+
}
|
|
280
|
+
load(track, onLoaded, options) {
|
|
199
281
|
const player = this.requirePlayer();
|
|
200
282
|
this._isStopped = false;
|
|
201
283
|
this._loadInProgress = true;
|
|
202
|
-
const
|
|
203
|
-
|
|
284
|
+
const headers = options?.headers;
|
|
285
|
+
this.mediaHeaders = headers && Object.keys(headers).length > 0 ? headers : undefined;
|
|
286
|
+
// What Shaka plays may differ from what the caller queued; `track` is left
|
|
287
|
+
// alone so `current` and `getActiveTrack()` keep the caller's identity for
|
|
288
|
+
// it rather than a transport detail.
|
|
289
|
+
const playbackSrc = options?.src ?? track.src;
|
|
290
|
+
// Current on the attempt, not on success — native derives the active track
|
|
291
|
+
// from the queue, so a failed load is still the active track there and its
|
|
292
|
+
// error has somewhere to show. `getActiveTrackIndex()` already reported the
|
|
293
|
+
// queue's index either way; this makes the pair agree.
|
|
294
|
+
this.current = track;
|
|
295
|
+
// The attempt a subclass began before resolving the URL, so its resolution
|
|
296
|
+
// stage and both continuations below share one token. Passed rather than
|
|
297
|
+
// read off the instance: a direct `load()` is itself the outermost call and
|
|
298
|
+
// must start a fresh attempt, superseding whatever was in flight.
|
|
299
|
+
const attempt = options?.attempt ?? this.beginLoadAttempt();
|
|
300
|
+
if (!playbackSrc) {
|
|
204
301
|
this._loadInProgress = false;
|
|
205
302
|
this._pendingSeek = undefined;
|
|
206
303
|
const error = {
|
|
@@ -214,10 +311,9 @@ export class Player {
|
|
|
214
311
|
};
|
|
215
312
|
return;
|
|
216
313
|
}
|
|
217
|
-
player.load(
|
|
218
|
-
if (
|
|
314
|
+
player.load(playbackSrc).then(() => {
|
|
315
|
+
if (!attempt.isCurrent) return;
|
|
219
316
|
this._loadInProgress = false;
|
|
220
|
-
this.current = track;
|
|
221
317
|
onLoaded?.(track);
|
|
222
318
|
|
|
223
319
|
// Execute any pending seek that arrived during loading
|
|
@@ -231,7 +327,7 @@ export class Player {
|
|
|
231
327
|
this.play();
|
|
232
328
|
}
|
|
233
329
|
}).catch(err => {
|
|
234
|
-
if (
|
|
330
|
+
if (!attempt.isCurrent) return;
|
|
235
331
|
this._loadInProgress = false;
|
|
236
332
|
this._pendingSeek = undefined;
|
|
237
333
|
this.onError(this.toNormalizedError(err));
|
|
@@ -240,8 +336,14 @@ export class Player {
|
|
|
240
336
|
stop(onComplete) {
|
|
241
337
|
const player = this.requirePlayer();
|
|
242
338
|
|
|
339
|
+
// Whatever was loading no longer owns the player: its continuations, at
|
|
340
|
+
// either boundary, must not revive it.
|
|
341
|
+
this.cancelLoadAttempt();
|
|
342
|
+
|
|
243
343
|
// Match Android: stop sets playWhenReady=false and state=stopped,
|
|
244
|
-
// but keeps the current track so play() can resume
|
|
344
|
+
// but keeps the current track so play() can resume — from where it
|
|
345
|
+
// stopped, which ExoPlayer preserves across its own stop/prepare pair.
|
|
346
|
+
this.rememberResumePosition();
|
|
245
347
|
this._isStopped = true;
|
|
246
348
|
this._loadInProgress = false;
|
|
247
349
|
this._pendingSeek = undefined;
|
|
@@ -254,34 +356,125 @@ export class Player {
|
|
|
254
356
|
onComplete?.(); // Still call onComplete so callers aren't left hanging
|
|
255
357
|
});
|
|
256
358
|
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Where playback was when it failed or was stopped, so a re-prepare can
|
|
362
|
+
* resume rather than restart.
|
|
363
|
+
*
|
|
364
|
+
* Kept against the track it belongs to rather than as a bare number, so it
|
|
365
|
+
* self-invalidates when a different track becomes current and cannot be
|
|
366
|
+
* applied to the wrong one.
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Records the current position, when there is one worth recording.
|
|
371
|
+
*
|
|
372
|
+
* A zero is never recorded: `onError` runs for a *load* failure too, where
|
|
373
|
+
* the element has just been torn down and reads 0, and overwriting a good
|
|
374
|
+
* position with that made a failed retry lose the place a successful one
|
|
375
|
+
* would have resumed from.
|
|
376
|
+
*/
|
|
377
|
+
rememberResumePosition() {
|
|
378
|
+
const position = this.element?.currentTime;
|
|
379
|
+
const track = this.current;
|
|
380
|
+
if (!track || typeof position !== 'number' || position <= 0) return;
|
|
381
|
+
this._resume = {
|
|
382
|
+
track,
|
|
383
|
+
position
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Android's `prepare()`, which both `play()` and `retry()` call.
|
|
389
|
+
*
|
|
390
|
+
* It early-returns unless ExoPlayer is STATE_IDLE, so it reconnects after an
|
|
391
|
+
* error or a stop and never re-buffers a healthy stream; `error`/`_isStopped`
|
|
392
|
+
* is web's equivalent of idle. Re-preparing re-resolves the URL, which is the
|
|
393
|
+
* whole point — a signed URL or token may have expired since the failure, and
|
|
394
|
+
* replaying the cached one just fails again. iOS says the same thing in its
|
|
395
|
+
* own `retry()`: "Re-resolve rather than replay the cached URL".
|
|
396
|
+
*
|
|
397
|
+
* Returns whether it handled the call, so `play()` knows not to also poke the
|
|
398
|
+
* element.
|
|
399
|
+
*/
|
|
400
|
+
reprepare() {
|
|
401
|
+
if (!this.current) return false;
|
|
402
|
+
if (this.state.state !== State.Error && !this._isStopped) return false;
|
|
403
|
+
|
|
404
|
+
// Not for live: `currentTime` there is elapsed time on a connection that no
|
|
405
|
+
// longer exists, and a fresh connection already *is* the live edge. Seeking
|
|
406
|
+
// to the old value asks for a point the new stream does not have. The
|
|
407
|
+
// track's own `live` declaration is the gate, as it is in `seekToLiveEdge`
|
|
408
|
+
// and on both native platforms.
|
|
409
|
+
const remembered = this._resume?.track === this.current ? this._resume.position : undefined;
|
|
410
|
+
const resume = this.current.live === true ? undefined : remembered;
|
|
411
|
+
this.reloadCurrent(resume);
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
257
414
|
play() {
|
|
258
415
|
const element = this.requireElement();
|
|
259
416
|
this.playWhenReady = true;
|
|
260
|
-
if (this.state.state === State.Error && this.current) {
|
|
261
|
-
this.reloadCurrent();
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
417
|
|
|
265
|
-
//
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
418
|
+
// Matches Android's play(): set the intent, then prepare — which does
|
|
419
|
+
// something only when idle, i.e. after an error or a stop.
|
|
420
|
+
if (this.reprepare()) return;
|
|
421
|
+
element.play().catch(err => this.onPlayRejected(err));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* A rejected `element.play()`. Web-only: neither native platform can refuse
|
|
426
|
+
* a play intent, so there is no parity target here.
|
|
427
|
+
*
|
|
428
|
+
* `AbortError` means a newer load interrupted this one — that load owns the
|
|
429
|
+
* state and the intent stands. Anything else, autoplay policy above all, is
|
|
430
|
+
* the browser refusing: the intent cannot be honoured, so it is cleared and
|
|
431
|
+
* the state settles rather than stranding on `loading`/`buffering`, which is
|
|
432
|
+
* where suppressing `ready` under `playWhenReady` would otherwise leave it.
|
|
433
|
+
*/
|
|
434
|
+
onPlayRejected(err) {
|
|
435
|
+
console.error(err);
|
|
436
|
+
const name = typeof err === 'object' && err !== null && 'name' in err ? err.name : undefined;
|
|
437
|
+
if (name === 'AbortError') return;
|
|
438
|
+
this.playWhenReady = false;
|
|
439
|
+
this.dispatch({
|
|
440
|
+
type: 'paused',
|
|
441
|
+
hasAsset: this.current !== undefined
|
|
442
|
+
});
|
|
271
443
|
}
|
|
272
444
|
|
|
273
445
|
/**
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
446
|
+
* The track a reload re-feeds. `current` holds it as the caller queued it —
|
|
447
|
+
* `load()` takes the resolved URL separately, via `LoadOptions.src` — so
|
|
448
|
+
* re-feeding it is safe.
|
|
449
|
+
*
|
|
450
|
+
* The overridable part of {@link reloadCurrent}, rather than the whole
|
|
451
|
+
* method: a subclass backed by a queue changes only where the track comes
|
|
452
|
+
* from, and the reload itself stays in one place.
|
|
278
453
|
*/
|
|
279
|
-
|
|
280
|
-
|
|
454
|
+
trackToReload() {
|
|
455
|
+
return this.current;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** Reloads the track {@link trackToReload} names, resuming if asked to. */
|
|
459
|
+
reloadCurrent(resumePosition) {
|
|
460
|
+
const track = this.trackToReload();
|
|
461
|
+
if (!track) return;
|
|
462
|
+
this.load(track, resumePosition === undefined ? undefined : () => this.seekTo(resumePosition));
|
|
281
463
|
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Android's `retry()` is `player.prepare()` — the same call `play()` makes,
|
|
467
|
+
* without setting the intent. So this is `play()` minus the intent.
|
|
468
|
+
*
|
|
469
|
+
* It is emphatically not `shaka.Player.retryStreaming()`, which this used to
|
|
470
|
+
* call: that returns false and does nothing at all unless the load mode is
|
|
471
|
+
* MEDIA_SOURCE, so for a progressive file — the case a signed URL is for — it
|
|
472
|
+
* was a silent no-op, while the `play()` the same docs offer as the
|
|
473
|
+
* alternative recovered properly.
|
|
474
|
+
*/
|
|
282
475
|
retry() {
|
|
283
|
-
|
|
284
|
-
|
|
476
|
+
this.requirePlayer();
|
|
477
|
+
this.reprepare();
|
|
285
478
|
}
|
|
286
479
|
pause() {
|
|
287
480
|
const element = this.requireElement();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["playbackErrorKind","nextPlaybackState","SetupNotCalledError","State","Player","hasInitialized","_current","undefined","_playWhenReady","_state","state","None","_isStopped","_loadInProgress","current","cur","newState","playWhenReady","pwr","requireElement","element","requirePlayer","player","setupPlayer","_options","window","shaka","default","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","applyState","toNormalizedError","err","e","data","String","shakaError","unload","catch","console","status","httpStatus","navigator","onLine","toString","statusCode","debug","_loadGeneration","load","track","onLoaded","generation","src","_pendingSeek","then","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"],"source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AACqF,MAAM,GAAGA,MAAM;EACzB;EAEOC,SAASA,CAAA,EAAW;IACzB,MAAMtF,OAAO,GAAG,IAAI,CAACD,cAAc,CAAC,CAAC;IACrC,OAAOC,OAAO,CAACqF,MAAM;EACvB;EAEOE,WAAWA,CAAA,EAAa;IAC7B,MAAMvF,OAAO,GAAG,IAAI,CAACD,cAAc,CAAC,CAAC;IACrC,IAAIyF,QAAQ,GAAG,CAAC;IAChB,IAAIxF,OAAO,CAACwF,QAAQ,CAACL,MAAM,GAAG,CAAC,EAAE;MAC/BK,QAAQ,GAAGxF,OAAO,CAACwF,QAAQ,CAACN,GAAG,CAAClF,OAAO,CAACwF,QAAQ,CAACL,MAAM,GAAG,CAAC,CAAC;IAC9D;IACA,OAAO;MACLM,QAAQ,EAAEzF,OAAO,CAAC4D,WAAW;MAC7B8B,QAAQ,EAAE1F,OAAO,CAAC0F,QAAQ,IAAI,CAAC;MAC/BF;IACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["playbackErrorKind","LoadAttempt","nextPlaybackState","SetupNotCalledError","State","LOAD_INTERRUPTED","Player","hasInitialized","_current","undefined","_playWhenReady","_state","state","None","_isStopped","_loadInProgress","current","cur","newState","playWhenReady","pwr","requireElement","element","requirePlayer","player","setupPlayer","_options","window","shaka","default","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","applyState","toNormalizedError","err","e","data","String","shakaError","console","debug","rememberResumePosition","unload","catch","status","httpStatus","navigator","onLine","toString","statusCode","beginLoadAttempt","_attempt","cancel","attempt","cancelLoadAttempt","load","track","onLoaded","options","Object","keys","length","playbackSrc","src","_pendingSeek","then","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"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/Player.ts"],"mappings":";;AAUA,SAASA,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,KAAK,QAAQ,SAAS;;AAE/B;;AAOA;;AAYA;;AAkBA;;AAKA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,IAAI;AAQ7B,OAAO,MAAMC,MAAM,CAAC;EACRC,cAAc,GAAG,KAAK;EAGtBC,QAAQ,GAAWC,SAAS;EAC5BC,cAAc,GAAG,KAAK;EACtBC,MAAM,GAAa;IAAEC,KAAK,EAAER,KAAK,CAACS;EAAK,CAAC;EACxCC,UAAU,GAAG,KAAK;EAClBC,eAAe,GAAG,KAAK;;EAEjC;AACF;AACA;AACA;AACA;;EAGE;EACA,IAAWC,OAAOA,CAAA,EAAsB;IACtC,OAAO,IAAI,CAACR,QAAQ;EACtB;EACA,IAAWQ,OAAOA,CAACC,GAAsB,EAAE;IACzC,IAAI,CAACT,QAAQ,GAAGS,GAAG;EACrB;;EAEA;EACA,IAAcL,KAAKA,CAAA,EAAa;IAC9B,OAAO,IAAI,CAACD,MAAM;EACpB;EACA,IAAcC,KAAKA,CAACM,QAAkB,EAAE;IACtC,IAAI,CAACP,MAAM,GAAGO,QAAQ;EACxB;;EAEA;EACA,IAAWC,aAAaA,CAAA,EAAY;IAClC,OAAO,IAAI,CAACT,cAAc;EAC5B;EACA,IAAWS,aAAaA,CAACC,GAAY,EAAE;IACrC,IAAI,CAACV,cAAc,GAAGU,GAAG;EAC3B;;EAEA;AACF;AACA;EACYC,cAAcA,CAAA,EAAqB;IAC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ACzC,MAAM,GAAG,CAAC,CAAC;IAC9D;IACA,OAAO;MACLW,QAAQ,EAAElF,OAAO,CAAC6E,WAAW;MAC7BoC,QAAQ,EAAEjH,OAAO,CAACiH,QAAQ,IAAI,CAAC;MAC/BD;IACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -18,35 +18,56 @@ export class QueuePlayer extends Player {
|
|
|
18
18
|
// was a silent pause) and armed load()'s auto-play with phantom intent.
|
|
19
19
|
// Cleared before the state lands so consumers observe the native order
|
|
20
20
|
// (intent → state → queueEnded), independent of onQueueEnded overrides.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (state !== State.Ended) {
|
|
22
|
+
super.applyState(state);
|
|
23
|
+
return;
|
|
24
24
|
}
|
|
25
|
-
super.applyState(state);
|
|
26
25
|
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
26
|
+
// A track ending mid-queue is not an `ended` playback state: ExoPlayer
|
|
27
|
+
// reaches STATE_ENDED only at the end of the *playlist*, and an advance
|
|
28
|
+
// between items stays READY/BUFFERING. Web loads one track at a time, so
|
|
29
|
+
// the element's own `ended` arrives every time — reporting it flashed a
|
|
30
|
+
// terminal state, and dropped `PlayingState.playing` to false, between
|
|
31
|
+
// every pair of tracks. Repeat-one counts as mid-queue for the same
|
|
32
|
+
// reason: native reports nothing there either.
|
|
33
|
+
if (this.endsQueue()) {
|
|
34
|
+
// The real end: the intent goes with it, and the state is genuinely ended.
|
|
35
|
+
this.playWhenReady = false;
|
|
36
|
+
super.applyState(state);
|
|
37
|
+
// dispatch() already gates on _isStopped before reaching applyState, so a
|
|
38
|
+
// natural end while stopped never advances the queue.
|
|
30
39
|
this.onTrackEnded();
|
|
40
|
+
return;
|
|
31
41
|
}
|
|
42
|
+
|
|
43
|
+
// Suppressing `ended` is only safe when something takes over the state. A
|
|
44
|
+
// handler that declines to advance — the sleep timer set to end-of-track —
|
|
45
|
+
// leaves nothing to move it, and the player would sit reporting `playing`
|
|
46
|
+
// with nothing playing. Report the end in that case, as before.
|
|
47
|
+
if (!this.onTrackEnded()) super.applyState(state);
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
/** True when a natural end has nowhere to go: not repeating, no next track. */
|
|
35
51
|
endsQueue() {
|
|
36
52
|
return this.queue.repeatMode !== RepeatMode.Track && this.queue.repeatMode !== RepeatMode.Queue && this.queue.nextIndex() === undefined;
|
|
37
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @returns whether it started another load, and so owns the playback state
|
|
57
|
+
* from here. `false` means the caller still has to report the end itself.
|
|
58
|
+
*/
|
|
38
59
|
onTrackEnded() {
|
|
39
60
|
if (this.queue.repeatMode === RepeatMode.Track) {
|
|
40
|
-
if (this.queue.currentIndex
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return;
|
|
61
|
+
if (this.queue.currentIndex === undefined) return false;
|
|
62
|
+
this.goToIndex(this.queue.currentIndex);
|
|
63
|
+
return true;
|
|
44
64
|
}
|
|
45
65
|
if (this.endsQueue()) {
|
|
46
66
|
this.onQueueEnded();
|
|
47
|
-
return;
|
|
67
|
+
return false;
|
|
48
68
|
}
|
|
49
69
|
this.skipToNext();
|
|
70
|
+
return true;
|
|
50
71
|
}
|
|
51
72
|
|
|
52
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Player","QueueManager","RepeatMode","State","QueuePlayer","queue","applyState","state","Ended","endsQueue","playWhenReady","onTrackEnded","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"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/QueuePlayer.ts"],"mappings":";;AAKA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,KAAK,QAAQ,SAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAC5BK,KAAK,GAAG,IAAIJ,YAAY,CAAC,CAAC;EAE1BK,UAAUA,CAACC,KAAoB,EAAE;IACzC;IACA;IACA;IACA;IACA;IACA
|
|
1
|
+
{"version":3,"names":["Player","QueueManager","RepeatMode","State","QueuePlayer","queue","applyState","state","Ended","endsQueue","playWhenReady","onTrackEnded","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"],"sourceRoot":"../../../../src","sources":["web/TrackPlayer/QueuePlayer.ts"],"mappings":";;AAKA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,KAAK,QAAQ,SAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAC5BK,KAAK,GAAG,IAAIJ,YAAY,CAAC,CAAC;EAE1BK,UAAUA,CAACC,KAAoB,EAAE;IACzC;IACA;IACA;IACA;IACA;IACA,IAAIA,KAAK,KAAKJ,KAAK,CAACK,KAAK,EAAE;MACzB,KAAK,CAACF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,CAACgC,OAAO,CAAC7B,KAAK,CAAC;QAC7B;MACF,KAAK,SAAS;QACZ,IAAI,CAAC+B,OAAO,GAAGpC,SAAS;QACxB,IAAI,CAACqC,IAAI,CAAC,CAAC;QACX;IACJ;EACF;EAEOA,IAAIA,CAACC,UAAuB,EAAQ;IACzC,KAAK,CAACD,IAAI,CAACC,UAAU,CAAC;EACxB;EAEOC,KAAKA,CAAA,EAAS;IACnB;IACA;IACA;IACA,IAAI,CAAClD,KAAK,CAACmD,KAAK,CAAC,CAAC;IAClB,IAAI,CAACJ,OAAO,GAAGpC,SAAS;IACxB,IAAI,CAACqC,IAAI,CAAC,CAAC;EACb;EAEOI,oBAAoBA,CAAA,EAAS;IAClC,IAAI,CAACpD,KAAK,CAACqD,cAAc,CAAC,CAAC;EAC7B;EAEOC,IAAIA,CAACC,SAAiB,EAAEC,OAAe,EAAQ;IACpD,IAAI,CAACxD,KAAK,CAACsD,IAAI,CAACC,SAAS,EAAEC,OAAO,CAAC;EACrC;AACF","ignoreList":[]}
|
|
@@ -294,6 +294,9 @@ export class BrowserManager {
|
|
|
294
294
|
* results (no contextual URLs), like the native `makeSearchResult`.
|
|
295
295
|
* Matches Android's BrowserManager.search() which bypasses resolve() entirely.
|
|
296
296
|
*
|
|
297
|
+
* A failed search propagates, so `navigate` turns it into a navigation error
|
|
298
|
+
* the way it does a failed browse resolve.
|
|
299
|
+
*
|
|
297
300
|
* @param searchPath The search path (format: /__search?q=query)
|
|
298
301
|
* @returns ResolvedTrack containing search results as one untitled section
|
|
299
302
|
*/
|
|
@@ -323,14 +326,9 @@ export class BrowserManager {
|
|
|
323
326
|
}
|
|
324
327
|
// Handle request config-based search via the shared layered fetch.
|
|
325
328
|
else if (searchRoute.searchConfig) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
});
|
|
330
|
-
} catch (error) {
|
|
331
|
-
console.error('Search failed:', error);
|
|
332
|
-
return undefined;
|
|
333
|
-
}
|
|
329
|
+
searchResults = await this.fetchSearchResults(searchRoute.searchConfig, {
|
|
330
|
+
q: query
|
|
331
|
+
});
|
|
334
332
|
}
|
|
335
333
|
|
|
336
334
|
// Search callbacks should return fresh tracks without contextual paths (like Android)
|
|
@@ -347,10 +345,13 @@ export class BrowserManager {
|
|
|
347
345
|
* Matches Android's artwork URL transformation with full Track access.
|
|
348
346
|
*/
|
|
349
347
|
async transformArtworkForContent(content) {
|
|
348
|
+
// No short-circuit on a missing artwork config: Android gates per *track*
|
|
349
|
+
// (`artworkConfig == null && track.artwork == null`), so a track carrying a
|
|
350
|
+
// plain `artwork` URL still gets an `artworkSource`. Returning early here
|
|
351
|
+
// meant an app with no `artwork` block never populated the field at all —
|
|
352
|
+
// `resolveArtworkSourceAsync` already handles the no-config case the way
|
|
353
|
+
// `resolveArtworkUrl` does on Android.
|
|
350
354
|
const artworkConfig = this._configuration.artwork;
|
|
351
|
-
if (!artworkConfig) {
|
|
352
|
-
return content;
|
|
353
|
-
}
|
|
354
355
|
// The shared request layer applies to artwork too — use the resolved layer
|
|
355
356
|
// (resolver result or static config) so a resolver-only config still works.
|
|
356
357
|
await this.ensureLayersResolved();
|
|
@@ -430,6 +431,22 @@ export class BrowserManager {
|
|
|
430
431
|
return undefined;
|
|
431
432
|
}
|
|
432
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Ensures the request layer is resolved for the current generation and
|
|
436
|
+
* returns it — the resolver's result when a `requestResolver` is configured,
|
|
437
|
+
* else the static `request`.
|
|
438
|
+
*
|
|
439
|
+
* Consumers outside the browse path (media URL building, artwork) must reach
|
|
440
|
+
* the request layer through this rather than reading `configuration.request`,
|
|
441
|
+
* or a resolver-only config silently loses its baseUrl, headers and transform
|
|
442
|
+
* exactly where a credential is needed. Mirrors Android's
|
|
443
|
+
* `BrowserManager.resolvedRequestConfig()`, which carries the same warning.
|
|
444
|
+
*/
|
|
445
|
+
async resolvedRequestConfig() {
|
|
446
|
+
await this.ensureLayersResolved();
|
|
447
|
+
return this._resolvedRequest;
|
|
448
|
+
}
|
|
449
|
+
|
|
433
450
|
/**
|
|
434
451
|
* Ensures the request/browse layer configs are resolved for the current
|
|
435
452
|
* generation. Any present resolver is invoked once per generation and the
|
|
@@ -578,8 +595,9 @@ export class BrowserManager {
|
|
|
578
595
|
|
|
579
596
|
// Transform artwork URLs on tabs via the async resolver so the shared
|
|
580
597
|
// request layer (incl. its transform) applies, matching content/search.
|
|
598
|
+
// Gated per track inside the resolver, as on Android — see
|
|
599
|
+
// `transformArtworkForContent`.
|
|
581
600
|
const artworkConfig = this._configuration.artwork;
|
|
582
|
-
if (!artworkConfig) return tabs;
|
|
583
601
|
// Resolved request layer (resolver or static), matching content/search.
|
|
584
602
|
await this.ensureLayersResolved();
|
|
585
603
|
const requestConfig = this._resolvedRequest;
|