@interlacejs/player 0.1.0 → 0.1.3

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 (2) hide show
  1. package/README.md +48 -0
  2. package/package.json +9 -5
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,13 +1,17 @@
1
1
  {
2
2
  "name": "@interlacejs/player",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "Interlace content player.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
- ".": "./src/index.ts"
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
11
15
  },
12
16
  "sideEffects": false,
13
17
  "files": [
@@ -48,8 +52,8 @@
48
52
  "vitest": "^2.1.9"
49
53
  },
50
54
  "dependencies": {
51
- "@interlacejs/core": "0.1.0",
52
- "@interlacejs/quiz": "0.1.0"
55
+ "@interlacejs/core": "0.1.3",
56
+ "@interlacejs/quiz": "0.1.3"
53
57
  },
54
58
  "scripts": {
55
59
  "build": "tsup",