@applicaster/quick-brick-player 16.0.0-rc.97 → 16.0.0-rc.99
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "16.0.0-rc.
|
|
3
|
+
"version": "16.0.0-rc.99",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.93",
|
|
39
39
|
"@applicaster/quick-brick-tv-transport-controls": "16.0.0-rc.69",
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "16.0.0-rc.
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-rc.
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "16.0.0-rc.99",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.99",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-rc.99",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
44
|
"shaka-player": "4.3.5",
|
|
45
45
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -129,7 +129,17 @@ export class PlaylistNavigationController {
|
|
|
129
129
|
try {
|
|
130
130
|
const plugins = appStore?.get?.("plugins") || [];
|
|
131
131
|
const queuePlugin = findPluginByIdentifier("queue-action", plugins, true);
|
|
132
|
-
const
|
|
132
|
+
const module = (queuePlugin as any)?.module;
|
|
133
|
+
const QueueManager = module?.QueueManager;
|
|
134
|
+
const setupQuickBrickQueue = module?.setupQuickBrickQueue;
|
|
135
|
+
|
|
136
|
+
if (
|
|
137
|
+
QueueManager &&
|
|
138
|
+
!QueueManager.isInitialized?.() &&
|
|
139
|
+
typeof setupQuickBrickQueue === "function"
|
|
140
|
+
) {
|
|
141
|
+
setupQuickBrickQueue();
|
|
142
|
+
}
|
|
133
143
|
|
|
134
144
|
if (QueueManager?.isInitialized?.()) {
|
|
135
145
|
return QueueManager.instance;
|
|
@@ -192,19 +202,15 @@ export class PlaylistNavigationController {
|
|
|
192
202
|
return;
|
|
193
203
|
}
|
|
194
204
|
|
|
195
|
-
const isPlayingFromQueue = Boolean(this.entry?.extensions?.queueItemId);
|
|
196
205
|
const staticNextUrl = this.entry?.extensions?.play_next_feed_url;
|
|
197
206
|
const staticPrevUrl = this.entry?.extensions?.play_previous_feed_url;
|
|
198
207
|
|
|
199
|
-
const hasNext =
|
|
200
|
-
? upcoming.length > 0 || Boolean(staticNextUrl)
|
|
201
|
-
: Boolean(staticNextUrl) || upcoming.length > 0;
|
|
208
|
+
const hasNext = upcoming.length > 0 || Boolean(staticNextUrl);
|
|
202
209
|
|
|
203
210
|
const canRestart = (this.playerState?.seekableDuration ?? 0) > 0;
|
|
204
211
|
|
|
205
|
-
const hasPrevious =
|
|
206
|
-
|
|
207
|
-
: Boolean(staticPrevUrl) || history.length > 0 || canRestart;
|
|
212
|
+
const hasPrevious =
|
|
213
|
+
history.length > 0 || Boolean(staticPrevUrl) || canRestart;
|
|
208
214
|
|
|
209
215
|
if (this.hasNext$.getValue() !== hasNext) {
|
|
210
216
|
this.hasNext$.next(hasNext);
|
|
@@ -227,9 +233,7 @@ export class PlaylistNavigationController {
|
|
|
227
233
|
|
|
228
234
|
if (this.isDestroyed) return;
|
|
229
235
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (isPlayingFromQueue && upcoming.length > 0) {
|
|
236
|
+
if (upcoming.length > 0) {
|
|
233
237
|
const nextItem = upcoming[0];
|
|
234
238
|
|
|
235
239
|
log_info(
|
|
@@ -259,20 +263,6 @@ export class PlaylistNavigationController {
|
|
|
259
263
|
);
|
|
260
264
|
|
|
261
265
|
this.navigator?.replaceTop?.(target);
|
|
262
|
-
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (upcoming.length > 0) {
|
|
267
|
-
const nextItem = upcoming[0];
|
|
268
|
-
|
|
269
|
-
log_info(
|
|
270
|
-
`goNext: playing next item from queue "${nextItem.title}", id: ${nextItem.id}`,
|
|
271
|
-
{ targetId: nextItem.id }
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
if (this.isDestroyed) return;
|
|
275
|
-
this.navigator?.replaceTop?.(nextItem);
|
|
276
266
|
}
|
|
277
267
|
} catch (error) {
|
|
278
268
|
log_error("goNext: could not navigate to next entry", { error });
|
|
@@ -293,7 +283,6 @@ export class PlaylistNavigationController {
|
|
|
293
283
|
|
|
294
284
|
if (this.isDestroyed) return;
|
|
295
285
|
|
|
296
|
-
const isPlayingFromQueue = Boolean(this.entry?.extensions?.queueItemId);
|
|
297
286
|
const staticPrevUrl = this.entry?.extensions?.play_previous_feed_url;
|
|
298
287
|
|
|
299
288
|
const currentTime = this.playerState?.currentTime ?? 0;
|
|
@@ -302,9 +291,7 @@ export class PlaylistNavigationController {
|
|
|
302
291
|
const hasQueueHistory = history.length > 0;
|
|
303
292
|
const hasStaticPrev = Boolean(staticPrevUrl);
|
|
304
293
|
|
|
305
|
-
const hasTarget =
|
|
306
|
-
? hasQueueHistory || hasStaticPrev
|
|
307
|
-
: hasStaticPrev || hasQueueHistory;
|
|
294
|
+
const hasTarget = hasQueueHistory || hasStaticPrev;
|
|
308
295
|
|
|
309
296
|
const shouldRestart =
|
|
310
297
|
canRestart && (currentTime > RESTART_THRESHOLD_SECONDS || !hasTarget);
|
|
@@ -316,7 +303,7 @@ export class PlaylistNavigationController {
|
|
|
316
303
|
return;
|
|
317
304
|
}
|
|
318
305
|
|
|
319
|
-
if (
|
|
306
|
+
if (hasQueueHistory) {
|
|
320
307
|
const prevItem = history[history.length - 1];
|
|
321
308
|
|
|
322
309
|
log_info(
|
|
@@ -344,20 +331,6 @@ export class PlaylistNavigationController {
|
|
|
344
331
|
);
|
|
345
332
|
|
|
346
333
|
this.navigator?.replaceTop?.(target);
|
|
347
|
-
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (hasQueueHistory) {
|
|
352
|
-
const prevItem = history[history.length - 1];
|
|
353
|
-
|
|
354
|
-
log_info(
|
|
355
|
-
`goPrevious: playing previous item from queue "${prevItem.title}", id: ${prevItem.id}`,
|
|
356
|
-
{ targetId: prevItem.id }
|
|
357
|
-
);
|
|
358
|
-
|
|
359
|
-
if (this.isDestroyed) return;
|
|
360
|
-
this.navigator?.replaceTop?.(prevItem);
|
|
361
334
|
}
|
|
362
335
|
} catch (error) {
|
|
363
336
|
log_error("goPrevious: could not navigate to previous entry", { error });
|
|
@@ -380,7 +380,7 @@ describe("PlaylistNavigationController", () => {
|
|
|
380
380
|
controller.destroy();
|
|
381
381
|
});
|
|
382
382
|
|
|
383
|
-
it("prioritizes static feed URLs when entry is not from queue", async () => {
|
|
383
|
+
it("prioritizes queue navigation over static feed URLs even when entry is not from queue", async () => {
|
|
384
384
|
const queueNextItem = { id: "queue_next" } as ZappEntry;
|
|
385
385
|
const queuePrevItem = { id: "queue_prev" } as ZappEntry;
|
|
386
386
|
const staticNextTarget = { id: "static_next" } as ZappEntry;
|
|
@@ -411,30 +411,28 @@ describe("PlaylistNavigationController", () => {
|
|
|
411
411
|
});
|
|
412
412
|
|
|
413
413
|
await controller.goNext();
|
|
414
|
-
expect(loadFeedEntryMock).
|
|
415
|
-
expect(navigator.replaceTop).toHaveBeenCalledWith(
|
|
414
|
+
expect(loadFeedEntryMock).not.toHaveBeenCalled();
|
|
415
|
+
expect(navigator.replaceTop).toHaveBeenCalledWith(queueNextItem);
|
|
416
416
|
|
|
417
417
|
await controller.goPrevious();
|
|
418
|
-
expect(loadFeedEntryMock).
|
|
419
|
-
expect(navigator.replaceTop).toHaveBeenCalledWith(
|
|
418
|
+
expect(loadFeedEntryMock).not.toHaveBeenCalled();
|
|
419
|
+
expect(navigator.replaceTop).toHaveBeenCalledWith(queuePrevItem);
|
|
420
420
|
|
|
421
421
|
controller.destroy();
|
|
422
422
|
});
|
|
423
423
|
|
|
424
|
-
it("
|
|
425
|
-
const
|
|
426
|
-
const
|
|
424
|
+
it("falls back to static feed URLs when queue is empty", async () => {
|
|
425
|
+
const staticNextTarget = { id: "static_next" } as ZappEntry;
|
|
426
|
+
const staticPrevTarget = { id: "static_prev" } as ZappEntry;
|
|
427
427
|
|
|
428
|
-
mockQueueManager.instance.getUpcomingQueue.mockResolvedValue([
|
|
429
|
-
|
|
430
|
-
]);
|
|
428
|
+
mockQueueManager.instance.getUpcomingQueue.mockResolvedValue([]);
|
|
429
|
+
mockQueueManager.instance.getHistoryQueue.mockResolvedValue([]);
|
|
431
430
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
loadFeedEntryMock.mockImplementation((url) =>
|
|
432
|
+
Promise.resolve(url === NEXT_URL ? staticNextTarget : staticPrevTarget)
|
|
433
|
+
);
|
|
435
434
|
|
|
436
435
|
const entry = entryWith({
|
|
437
|
-
queueItemId: "current_queue_slot",
|
|
438
436
|
play_next_feed_url: NEXT_URL,
|
|
439
437
|
play_previous_feed_url: PREV_URL,
|
|
440
438
|
});
|
|
@@ -447,11 +445,12 @@ describe("PlaylistNavigationController", () => {
|
|
|
447
445
|
});
|
|
448
446
|
|
|
449
447
|
await controller.goNext();
|
|
450
|
-
expect(loadFeedEntryMock).
|
|
451
|
-
expect(navigator.replaceTop).toHaveBeenCalledWith(
|
|
448
|
+
expect(loadFeedEntryMock).toHaveBeenCalledWith(NEXT_URL, entry);
|
|
449
|
+
expect(navigator.replaceTop).toHaveBeenCalledWith(staticNextTarget);
|
|
452
450
|
|
|
453
451
|
await controller.goPrevious();
|
|
454
|
-
expect(
|
|
452
|
+
expect(loadFeedEntryMock).toHaveBeenCalledWith(PREV_URL, entry);
|
|
453
|
+
expect(navigator.replaceTop).toHaveBeenCalledWith(staticPrevTarget);
|
|
455
454
|
|
|
456
455
|
controller.destroy();
|
|
457
456
|
});
|