@interlacejs/player 0.1.0 → 0.1.2
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 +48 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @interlacejs/player
|
|
2
|
+
|
|
3
|
+
The React playback runtime for [Interlace](https://github.com/farayolaj/interlace) interactive videos: render the interactive layer (anchors, blocking content, completed tags) over any video stream backed by a `VideoAdapter`.
|
|
4
|
+
|
|
5
|
+
## What's inside
|
|
6
|
+
|
|
7
|
+
- **`InteractiveVideoPlayer`** — the top-level component: controller wiring, overlay layers, blocking-overlays with completion feedback and a Continue acknowledgment, playback-resume, and render-state-driven rendering.
|
|
8
|
+
- **`useInteractiveMedia`** — the hook underneath: adapter event wiring, the rAF tick loop, and the deserialized content instances.
|
|
9
|
+
- **Overlay components** — `Anchor` (with a Skip affordance), `BlockingOverlay` (focus-trapped; cannot be dismissed — blocks until completed), `CompletedTag`, and `ContentErrorBoundary`.
|
|
10
|
+
- **`PreloadScheduler`** — content preloading with configurable lead time.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @interlacejs/player @interlacejs/core @interlacejs/native-adapter
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Minimal example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { InteractiveVideoPlayer } from "@interlacejs/player";
|
|
22
|
+
import { NativeVideoAdapter } from "@interlacejs/native-adapter";
|
|
23
|
+
import { QuizContentType } from "@interlacejs/quiz";
|
|
24
|
+
import { ContentTypeRegistry } from "@interlacejs/core";
|
|
25
|
+
|
|
26
|
+
const registry = new ContentTypeRegistry();
|
|
27
|
+
registry.register(QuizContentType);
|
|
28
|
+
|
|
29
|
+
<InteractiveVideoPlayer
|
|
30
|
+
adapter={adapter} // a VideoAdapter (NativeVideoAdapter works)
|
|
31
|
+
document={doc} // SerializedInteractiveMediaDocument
|
|
32
|
+
registry={registry}
|
|
33
|
+
onError={(e) => showError(e)}
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Behavior notes:
|
|
38
|
+
|
|
39
|
+
- Blocking hooks pause the video and open content; only completion lets playback continue (the completion surface needs **Continue** click). Blocking content cannot be dismissed.
|
|
40
|
+
- Non-blocking hooks stay anchored inside their time window, can be opened or **skipped** (skip hides it for that window visit; re-approaching the window re-arms it), and completion swaps the anchor for a tag that cannot be re-taken.
|
|
41
|
+
|
|
42
|
+
## Types and authoring
|
|
43
|
+
|
|
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
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interlacejs/player",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Interlace content player.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"vitest": "^2.1.9"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@interlacejs/core": "0.1.
|
|
52
|
-
"@interlacejs/quiz": "0.1.
|
|
51
|
+
"@interlacejs/core": "0.1.2",
|
|
52
|
+
"@interlacejs/quiz": "0.1.2"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsup",
|