@interlacejs/player 0.1.3 → 0.2.0
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 +7 -3
- package/dist/index.cjs +127 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +87 -88
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -27,11 +27,11 @@ const registry = new ContentTypeRegistry();
|
|
|
27
27
|
registry.register(QuizContentType);
|
|
28
28
|
|
|
29
29
|
<InteractiveVideoPlayer
|
|
30
|
-
adapter={adapter}
|
|
31
|
-
document={doc}
|
|
30
|
+
adapter={adapter} // a VideoAdapter (NativeVideoAdapter works)
|
|
31
|
+
document={doc} // SerializedInteractiveMediaDocument
|
|
32
32
|
registry={registry}
|
|
33
33
|
onError={(e) => showError(e)}
|
|
34
|
-
|
|
34
|
+
/>;
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Behavior notes:
|
|
@@ -43,6 +43,10 @@ Behavior notes:
|
|
|
43
43
|
|
|
44
44
|
Documents are produced by [`@interlacejs/editor`](https://github.com/farayolaj/interlace) but they are plain JSON — see the [root README](https://github.com/farayolaj/interlace) for the full document shape and the `apps/demo` source for a working wiring.
|
|
45
45
|
|
|
46
|
+
## Theming
|
|
47
|
+
|
|
48
|
+
Pass `theme` (an `InterlaceTheme` from `@interlacejs/core`) or set `--interlace-*` CSS variables on any ancestor. See the editor README's "Styling and theming" section for the full list.
|
|
49
|
+
|
|
46
50
|
## License
|
|
47
51
|
|
|
48
52
|
ISC
|
package/dist/index.cjs
CHANGED
|
@@ -45,52 +45,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
45
45
|
var import_react = __toESM(require("react"), 1);
|
|
46
46
|
|
|
47
47
|
// src/tokens.ts
|
|
48
|
-
var
|
|
49
|
-
accent: "#0066cc",
|
|
50
|
-
accentHover: "#0052a3",
|
|
51
|
-
accentLight: "rgba(0, 102, 204, 0.15)",
|
|
52
|
-
accentLighter: "rgba(0, 102, 204, 0.08)",
|
|
53
|
-
text: "#0f172a",
|
|
54
|
-
textMuted: "#64748b",
|
|
55
|
-
border: "#e2e8f0",
|
|
56
|
-
borderStrong: "#cbd5e1",
|
|
57
|
-
surface: "#ffffff",
|
|
58
|
-
surfaceRaised: "#f8fafc",
|
|
59
|
-
ground: "#f6f7f9",
|
|
60
|
-
errorBg: "#fef2f2",
|
|
61
|
-
errorText: "#b91c1c",
|
|
62
|
-
errorBorder: "#fecaca",
|
|
63
|
-
white: "#ffffff",
|
|
64
|
-
black: "#000000"
|
|
65
|
-
};
|
|
66
|
-
var FONTS = {
|
|
67
|
-
display: 'Georgia, "Times New Roman", Times, serif',
|
|
68
|
-
body: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
69
|
-
};
|
|
70
|
-
var SPACE = {
|
|
71
|
-
1: 4,
|
|
72
|
-
2: 8,
|
|
73
|
-
3: 12,
|
|
74
|
-
4: 16,
|
|
75
|
-
5: 24
|
|
76
|
-
};
|
|
77
|
-
var RADIUS = {
|
|
78
|
-
sm: 4,
|
|
79
|
-
md: 8,
|
|
80
|
-
lg: 12
|
|
81
|
-
};
|
|
82
|
-
var SHADOWS = {
|
|
83
|
-
sm: "0 1px 2px 0 rgba(15, 23, 42, 0.04)",
|
|
84
|
-
md: "0 4px 12px -2px rgba(15, 23, 42, 0.08)"
|
|
85
|
-
};
|
|
86
|
-
var TYPE = {
|
|
87
|
-
xs: 12,
|
|
88
|
-
sm: 13,
|
|
89
|
-
base: 15,
|
|
90
|
-
md: 16,
|
|
91
|
-
lg: 20,
|
|
92
|
-
xl: 24
|
|
93
|
-
};
|
|
48
|
+
var import_core = require("@interlacejs/core");
|
|
94
49
|
|
|
95
50
|
// src/components/anchor.tsx
|
|
96
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -116,16 +71,16 @@ var Anchor = import_react.default.forwardRef(
|
|
|
116
71
|
height: `${height}%`,
|
|
117
72
|
minWidth: `${minSize}px`,
|
|
118
73
|
minHeight: `${minSize}px`,
|
|
119
|
-
padding: `${SPACE[2]}px ${SPACE[3]}px`,
|
|
120
|
-
fontSize: TYPE.md,
|
|
74
|
+
padding: `${import_core.SPACE[2]}px ${import_core.SPACE[3]}px`,
|
|
75
|
+
fontSize: import_core.TYPE.md,
|
|
121
76
|
fontWeight: 600,
|
|
122
|
-
border: `2px solid ${COLORS.accent}`,
|
|
123
|
-
borderRadius: `${RADIUS.sm}
|
|
124
|
-
backgroundColor: isOpened ? COLORS.accent : COLORS.surface,
|
|
125
|
-
color: isOpened ? COLORS.
|
|
77
|
+
border: `2px solid ${import_core.COLORS.accent}`,
|
|
78
|
+
borderRadius: `${import_core.RADIUS.sm}`,
|
|
79
|
+
backgroundColor: isOpened ? import_core.COLORS.accent : import_core.COLORS.surface,
|
|
80
|
+
color: isOpened ? import_core.COLORS.accentContrast : import_core.COLORS.accent,
|
|
126
81
|
cursor: "pointer",
|
|
127
82
|
transition: "background-color 150ms ease, color 150ms ease, box-shadow 150ms ease",
|
|
128
|
-
boxShadow: isOpened ? "0 4px 8px rgba(0, 102, 204, 0.3)" : SHADOWS.sm,
|
|
83
|
+
boxShadow: isOpened ? "0 4px 8px rgba(0, 102, 204, 0.3)" : import_core.SHADOWS.sm,
|
|
129
84
|
zIndex: 2,
|
|
130
85
|
// The anchors layer is pointer-transparent; each anchor
|
|
131
86
|
// re-enables pointer events for itself.
|
|
@@ -218,8 +173,8 @@ var BlockingOverlay = ({
|
|
|
218
173
|
flexDirection: "column",
|
|
219
174
|
alignItems: "center",
|
|
220
175
|
justifyContent: "center",
|
|
221
|
-
gap: `${SPACE[3]}px`,
|
|
222
|
-
padding: `${SPACE[4]}px 0`
|
|
176
|
+
gap: `${import_core.SPACE[3]}px`,
|
|
177
|
+
padding: `${import_core.SPACE[4]}px 0`
|
|
223
178
|
},
|
|
224
179
|
children: [
|
|
225
180
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -229,12 +184,12 @@ var BlockingOverlay = ({
|
|
|
229
184
|
width: 56,
|
|
230
185
|
height: 56,
|
|
231
186
|
borderRadius: "50%",
|
|
232
|
-
backgroundColor: COLORS.accentLighter,
|
|
233
|
-
color: COLORS.accent,
|
|
187
|
+
backgroundColor: import_core.COLORS.accentLighter,
|
|
188
|
+
color: import_core.COLORS.accent,
|
|
234
189
|
display: "flex",
|
|
235
190
|
alignItems: "center",
|
|
236
191
|
justifyContent: "center",
|
|
237
|
-
fontSize: TYPE.xl,
|
|
192
|
+
fontSize: import_core.TYPE.xl,
|
|
238
193
|
fontWeight: 600,
|
|
239
194
|
lineHeight: 1,
|
|
240
195
|
opacity: revealed ? 1 : 0,
|
|
@@ -252,12 +207,12 @@ var BlockingOverlay = ({
|
|
|
252
207
|
display: "flex",
|
|
253
208
|
flexDirection: "column",
|
|
254
209
|
alignItems: "center",
|
|
255
|
-
gap: `${SPACE[1]}px`,
|
|
210
|
+
gap: `${import_core.SPACE[1]}px`,
|
|
256
211
|
margin: 0,
|
|
257
|
-
fontFamily: FONTS.display,
|
|
258
|
-
fontSize: TYPE.lg,
|
|
212
|
+
fontFamily: import_core.FONTS.display,
|
|
213
|
+
fontSize: import_core.TYPE.lg,
|
|
259
214
|
fontWeight: 600,
|
|
260
|
-
color: COLORS.text,
|
|
215
|
+
color: import_core.COLORS.text,
|
|
261
216
|
opacity: revealed ? 1 : 0,
|
|
262
217
|
transform: revealed ? "none" : "translateY(6px)",
|
|
263
218
|
transition: "opacity 250ms ease 120ms, transform 250ms ease 120ms"
|
|
@@ -270,11 +225,11 @@ var BlockingOverlay = ({
|
|
|
270
225
|
"aria-label": `completion-score-${completingScore}`,
|
|
271
226
|
style: {
|
|
272
227
|
display: "inline-block",
|
|
273
|
-
padding: `0 ${SPACE[2]}px`,
|
|
274
|
-
borderRadius: `${RADIUS.sm}
|
|
275
|
-
backgroundColor: COLORS.accent,
|
|
276
|
-
color: COLORS.
|
|
277
|
-
fontSize: TYPE.sm,
|
|
228
|
+
padding: `0 ${import_core.SPACE[2]}px`,
|
|
229
|
+
borderRadius: `${import_core.RADIUS.sm}`,
|
|
230
|
+
backgroundColor: import_core.COLORS.accent,
|
|
231
|
+
color: import_core.COLORS.accentContrast,
|
|
232
|
+
fontSize: import_core.TYPE.sm,
|
|
278
233
|
fontWeight: 600,
|
|
279
234
|
verticalAlign: "middle"
|
|
280
235
|
},
|
|
@@ -295,14 +250,14 @@ var BlockingOverlay = ({
|
|
|
295
250
|
type: "button",
|
|
296
251
|
onClick: onContinue,
|
|
297
252
|
style: {
|
|
298
|
-
marginTop: `${SPACE[3]}px`,
|
|
299
|
-
padding: `${SPACE[2]}px ${SPACE[5]}px`,
|
|
300
|
-
backgroundColor: COLORS.accent,
|
|
301
|
-
color: COLORS.
|
|
253
|
+
marginTop: `${import_core.SPACE[3]}px`,
|
|
254
|
+
padding: `${import_core.SPACE[2]}px ${import_core.SPACE[5]}px`,
|
|
255
|
+
backgroundColor: import_core.COLORS.accent,
|
|
256
|
+
color: import_core.COLORS.accentContrast,
|
|
302
257
|
border: "none",
|
|
303
|
-
borderRadius: `${RADIUS.sm}
|
|
258
|
+
borderRadius: `${import_core.RADIUS.sm}`,
|
|
304
259
|
cursor: "pointer",
|
|
305
|
-
fontSize: TYPE.md,
|
|
260
|
+
fontSize: import_core.TYPE.md,
|
|
306
261
|
fontWeight: 600,
|
|
307
262
|
transition: "background-color 150ms ease",
|
|
308
263
|
opacity: revealed ? 1 : 0
|
|
@@ -340,9 +295,9 @@ var BlockingOverlay = ({
|
|
|
340
295
|
"div",
|
|
341
296
|
{
|
|
342
297
|
style: {
|
|
343
|
-
backgroundColor: COLORS.surface,
|
|
344
|
-
borderRadius: `${RADIUS.lg}
|
|
345
|
-
padding: `${SPACE[5]}px`,
|
|
298
|
+
backgroundColor: import_core.COLORS.surface,
|
|
299
|
+
borderRadius: `${import_core.RADIUS.lg}`,
|
|
300
|
+
padding: `${import_core.SPACE[5]}px`,
|
|
346
301
|
maxWidth: "500px",
|
|
347
302
|
width: "90%",
|
|
348
303
|
maxHeight: "80vh",
|
|
@@ -357,7 +312,7 @@ var BlockingOverlay = ({
|
|
|
357
312
|
display: "flex",
|
|
358
313
|
justifyContent: "space-between",
|
|
359
314
|
alignItems: "flex-start",
|
|
360
|
-
gap: `${SPACE[2]}px`
|
|
315
|
+
gap: `${import_core.SPACE[2]}px`
|
|
361
316
|
},
|
|
362
317
|
children: [
|
|
363
318
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -366,10 +321,10 @@ var BlockingOverlay = ({
|
|
|
366
321
|
id: `blocking-content-${content.getId()}`,
|
|
367
322
|
style: {
|
|
368
323
|
marginTop: 0,
|
|
369
|
-
fontFamily: FONTS.display,
|
|
370
|
-
fontSize: TYPE.lg,
|
|
324
|
+
fontFamily: import_core.FONTS.display,
|
|
325
|
+
fontSize: import_core.TYPE.lg,
|
|
371
326
|
fontWeight: 600,
|
|
372
|
-
color: COLORS.text
|
|
327
|
+
color: import_core.COLORS.text
|
|
373
328
|
},
|
|
374
329
|
children: content.getTitle()
|
|
375
330
|
}
|
|
@@ -383,13 +338,13 @@ var BlockingOverlay = ({
|
|
|
383
338
|
onSkip?.();
|
|
384
339
|
},
|
|
385
340
|
style: {
|
|
386
|
-
padding: `${SPACE[1]}px ${SPACE[2]}px`,
|
|
341
|
+
padding: `${import_core.SPACE[1]}px ${import_core.SPACE[2]}px`,
|
|
387
342
|
backgroundColor: "red",
|
|
388
|
-
color: COLORS.white,
|
|
343
|
+
color: import_core.COLORS.white,
|
|
389
344
|
border: "none",
|
|
390
|
-
borderRadius: `${RADIUS.sm}
|
|
345
|
+
borderRadius: `${import_core.RADIUS.sm}`,
|
|
391
346
|
cursor: "pointer",
|
|
392
|
-
fontSize: TYPE.sm,
|
|
347
|
+
fontSize: import_core.TYPE.sm,
|
|
393
348
|
fontWeight: 600,
|
|
394
349
|
transition: "background-color 150ms ease"
|
|
395
350
|
},
|
|
@@ -399,7 +354,7 @@ var BlockingOverlay = ({
|
|
|
399
354
|
]
|
|
400
355
|
}
|
|
401
356
|
),
|
|
402
|
-
completing ? completionSurface : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { margin: `${SPACE[4]}px 0` }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: bodyRef }) })
|
|
357
|
+
completing ? completionSurface : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { margin: `${import_core.SPACE[4]}px 0` }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: bodyRef }) })
|
|
403
358
|
]
|
|
404
359
|
}
|
|
405
360
|
)
|
|
@@ -427,15 +382,15 @@ var CompletedTag = ({
|
|
|
427
382
|
display: "flex",
|
|
428
383
|
alignItems: "center",
|
|
429
384
|
justifyContent: "center",
|
|
430
|
-
backgroundColor: COLORS.accent,
|
|
431
|
-
color: COLORS.
|
|
432
|
-
fontSize: TYPE.xs,
|
|
385
|
+
backgroundColor: import_core.COLORS.accent,
|
|
386
|
+
color: import_core.COLORS.accentContrast,
|
|
387
|
+
fontSize: import_core.TYPE.xs,
|
|
433
388
|
fontWeight: 700,
|
|
434
|
-
borderRadius: `${RADIUS.sm}
|
|
435
|
-
padding: `${SPACE[1]}px ${SPACE[2]}px`,
|
|
389
|
+
borderRadius: `${import_core.RADIUS.sm}`,
|
|
390
|
+
padding: `${import_core.SPACE[1]}px ${import_core.SPACE[2]}px`,
|
|
436
391
|
textAlign: "center",
|
|
437
392
|
zIndex: 4,
|
|
438
|
-
boxShadow: SHADOWS.sm
|
|
393
|
+
boxShadow: import_core.SHADOWS.sm
|
|
439
394
|
},
|
|
440
395
|
children: [
|
|
441
396
|
"\u2713 ",
|
|
@@ -465,17 +420,17 @@ var ContentErrorBoundary = class extends import_react3.default.Component {
|
|
|
465
420
|
"div",
|
|
466
421
|
{
|
|
467
422
|
style: {
|
|
468
|
-
padding: `${SPACE[4]}px`,
|
|
469
|
-
backgroundColor: COLORS.errorBg,
|
|
470
|
-
color: COLORS.errorText,
|
|
471
|
-
border: `1px solid ${COLORS.errorBorder}`,
|
|
472
|
-
borderRadius: `${RADIUS.md}
|
|
473
|
-
fontSize: TYPE.md,
|
|
423
|
+
padding: `${import_core.SPACE[4]}px`,
|
|
424
|
+
backgroundColor: import_core.COLORS.errorBg,
|
|
425
|
+
color: import_core.COLORS.errorText,
|
|
426
|
+
border: `1px solid ${import_core.COLORS.errorBorder}`,
|
|
427
|
+
borderRadius: `${import_core.RADIUS.md}`,
|
|
428
|
+
fontSize: import_core.TYPE.md,
|
|
474
429
|
lineHeight: 1.5
|
|
475
430
|
},
|
|
476
431
|
children: [
|
|
477
432
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "Content Error" }),
|
|
478
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: `${SPACE[1]}px 0 0 0` }, children: this.state.error?.message })
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: `${import_core.SPACE[1]}px 0 0 0` }, children: this.state.error?.message })
|
|
479
434
|
]
|
|
480
435
|
}
|
|
481
436
|
);
|
|
@@ -485,10 +440,11 @@ var ContentErrorBoundary = class extends import_react3.default.Component {
|
|
|
485
440
|
};
|
|
486
441
|
|
|
487
442
|
// src/components/interactive-video-player.tsx
|
|
443
|
+
var import_core3 = require("@interlacejs/core");
|
|
488
444
|
var import_react6 = require("react");
|
|
489
445
|
|
|
490
446
|
// src/hooks/use-interactive-media.ts
|
|
491
|
-
var
|
|
447
|
+
var import_core2 = require("@interlacejs/core");
|
|
492
448
|
var import_react4 = require("react");
|
|
493
449
|
function useInteractiveMedia(options) {
|
|
494
450
|
const {
|
|
@@ -506,13 +462,13 @@ function useInteractiveMedia(options) {
|
|
|
506
462
|
const [items, setItems] = (0, import_react4.useState)(null);
|
|
507
463
|
(0, import_react4.useEffect)(() => {
|
|
508
464
|
try {
|
|
509
|
-
const result = (0,
|
|
465
|
+
const result = (0, import_core2.deserialize)(doc, registry);
|
|
510
466
|
if (result.validationErrors.length > 0) {
|
|
511
467
|
throw new Error(
|
|
512
468
|
`Document validation failed: ${result.validationErrors[0]}`
|
|
513
469
|
);
|
|
514
470
|
}
|
|
515
|
-
const controller = new
|
|
471
|
+
const controller = new import_core2.InteractiveMediaController(
|
|
516
472
|
result.items,
|
|
517
473
|
result.videoDuration
|
|
518
474
|
);
|
|
@@ -538,6 +494,9 @@ function useInteractiveMedia(options) {
|
|
|
538
494
|
const unsubscribePlaying = adapter.on("play", () => {
|
|
539
495
|
isPlayingRef.current = true;
|
|
540
496
|
});
|
|
497
|
+
const unsubscribeProgrammaticSeek = adapter.on("programmaticSeek", () => {
|
|
498
|
+
controller.setPosition(adapter.getCurrentTime());
|
|
499
|
+
});
|
|
541
500
|
const unsubscribeRequestPause = controller.on("requestPause", () => {
|
|
542
501
|
adapter.pause();
|
|
543
502
|
});
|
|
@@ -547,6 +506,7 @@ function useInteractiveMedia(options) {
|
|
|
547
506
|
return () => {
|
|
548
507
|
unsubscribePause();
|
|
549
508
|
unsubscribePlaying();
|
|
509
|
+
unsubscribeProgrammaticSeek();
|
|
550
510
|
unsubscribeRequestPause();
|
|
551
511
|
unsubscribeRequestSeek();
|
|
552
512
|
};
|
|
@@ -677,7 +637,9 @@ var InteractiveVideoPlayer = ({
|
|
|
677
637
|
adapter,
|
|
678
638
|
document: doc,
|
|
679
639
|
registry,
|
|
680
|
-
onError
|
|
640
|
+
onError,
|
|
641
|
+
theme,
|
|
642
|
+
className
|
|
681
643
|
}) => {
|
|
682
644
|
const [renderState, setRenderState] = (0, import_react6.useState)({
|
|
683
645
|
visibleAnchorIds: [],
|
|
@@ -690,6 +652,9 @@ var InteractiveVideoPlayer = ({
|
|
|
690
652
|
void 0
|
|
691
653
|
);
|
|
692
654
|
const lastAutoOpenedBlockingIdRef = (0, import_react6.useRef)(null);
|
|
655
|
+
(0, import_react6.useEffect)(() => {
|
|
656
|
+
(0, import_core3.ensureInterlaceStyles)();
|
|
657
|
+
}, []);
|
|
693
658
|
const { controller, items, initialized, error } = useInteractiveMedia({
|
|
694
659
|
adapter,
|
|
695
660
|
document: doc,
|
|
@@ -713,6 +678,14 @@ var InteractiveVideoPlayer = ({
|
|
|
713
678
|
lastAutoOpenedBlockingIdRef.current = null;
|
|
714
679
|
}
|
|
715
680
|
}, [renderState.activeBlockingContentId]);
|
|
681
|
+
const overlayShowingRef = (0, import_react6.useRef)(false);
|
|
682
|
+
overlayShowingRef.current = (activeContentId ?? completingId) !== null;
|
|
683
|
+
(0, import_react6.useEffect)(
|
|
684
|
+
() => adapter.on("play", () => {
|
|
685
|
+
if (overlayShowingRef.current) adapter.pause();
|
|
686
|
+
}),
|
|
687
|
+
[adapter]
|
|
688
|
+
);
|
|
716
689
|
const handleContentComplete = (0, import_react6.useCallback)(
|
|
717
690
|
(score) => {
|
|
718
691
|
if (!controller || !activeContentId) return;
|
|
@@ -727,6 +700,7 @@ var InteractiveVideoPlayer = ({
|
|
|
727
700
|
const handleContinueAfterCompletion = (0, import_react6.useCallback)(() => {
|
|
728
701
|
setCompletingId(null);
|
|
729
702
|
setCompletingScore(void 0);
|
|
703
|
+
overlayShowingRef.current = false;
|
|
730
704
|
void adapter.play();
|
|
731
705
|
}, [adapter]);
|
|
732
706
|
if (error) {
|
|
@@ -734,12 +708,12 @@ var InteractiveVideoPlayer = ({
|
|
|
734
708
|
"div",
|
|
735
709
|
{
|
|
736
710
|
style: {
|
|
737
|
-
padding: `${SPACE[4]}px`,
|
|
738
|
-
color: COLORS.errorText,
|
|
739
|
-
backgroundColor: COLORS.errorBg,
|
|
740
|
-
border: `1px solid ${COLORS.errorBorder}`,
|
|
741
|
-
borderRadius: `${RADIUS.md}
|
|
742
|
-
fontSize: TYPE.md,
|
|
711
|
+
padding: `${import_core.SPACE[4]}px`,
|
|
712
|
+
color: import_core.COLORS.errorText,
|
|
713
|
+
backgroundColor: import_core.COLORS.errorBg,
|
|
714
|
+
border: `1px solid ${import_core.COLORS.errorBorder}`,
|
|
715
|
+
borderRadius: `${import_core.RADIUS.md}`,
|
|
716
|
+
fontSize: import_core.TYPE.md,
|
|
743
717
|
lineHeight: 1.5
|
|
744
718
|
},
|
|
745
719
|
children: [
|
|
@@ -755,9 +729,9 @@ var InteractiveVideoPlayer = ({
|
|
|
755
729
|
"div",
|
|
756
730
|
{
|
|
757
731
|
style: {
|
|
758
|
-
padding: `${SPACE[4]}px`,
|
|
759
|
-
color: COLORS.textMuted,
|
|
760
|
-
fontSize: TYPE.md
|
|
732
|
+
padding: `${import_core.SPACE[4]}px`,
|
|
733
|
+
color: import_core.COLORS.textMuted,
|
|
734
|
+
fontSize: import_core.TYPE.md
|
|
761
735
|
},
|
|
762
736
|
children: "Loading player\u2026"
|
|
763
737
|
}
|
|
@@ -772,35 +746,48 @@ var InteractiveVideoPlayer = ({
|
|
|
772
746
|
(item) => item.content.getId() === overlayContentId
|
|
773
747
|
);
|
|
774
748
|
const activeContentType = activeItem ? registry.get(activeItem.content.getContentTypeId()) : void 0;
|
|
775
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ContentErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ContentErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
750
|
+
"div",
|
|
751
|
+
{
|
|
752
|
+
className: ["interlace-player", className].filter(Boolean).join(" "),
|
|
753
|
+
style: {
|
|
754
|
+
...(0, import_core3.themeToCssVariables)(theme),
|
|
755
|
+
position: "relative",
|
|
756
|
+
width: "100%",
|
|
757
|
+
height: "100%"
|
|
758
|
+
},
|
|
759
|
+
children: [
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
761
|
+
OverlayLayer,
|
|
762
|
+
{
|
|
763
|
+
renderState,
|
|
764
|
+
items: overlayItems,
|
|
765
|
+
onAnchorClick: handleAnchorClick
|
|
766
|
+
}
|
|
767
|
+
),
|
|
768
|
+
activeItem && activeContentType && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
769
|
+
BlockingOverlay,
|
|
770
|
+
{
|
|
771
|
+
content: activeItem.content,
|
|
772
|
+
contentType: activeContentType,
|
|
773
|
+
onSkip: () => {
|
|
774
|
+
const item = (items ?? []).find(
|
|
775
|
+
(it) => it.getId() === overlayContentId
|
|
776
|
+
);
|
|
777
|
+
item?.skip();
|
|
778
|
+
setActiveContentId(null);
|
|
779
|
+
overlayShowingRef.current = false;
|
|
780
|
+
void adapter.play();
|
|
781
|
+
},
|
|
782
|
+
onContentComplete: handleContentComplete,
|
|
783
|
+
onContinue: handleContinueAfterCompletion,
|
|
784
|
+
completing: completingId !== null && completingId === overlayContentId,
|
|
785
|
+
completingScore
|
|
786
|
+
}
|
|
787
|
+
)
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
) });
|
|
804
791
|
};
|
|
805
792
|
|
|
806
793
|
// src/utils/preload-scheduler.ts
|