@urun-sh/core 0.2.21 → 0.2.22
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 +12 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ const session = app.generate({ prompt: 'A sunset' })
|
|
|
26
26
|
// arrive ASYNCHRONOUSLY — subscribe with `.on('track', …)`; never read `.track` once.
|
|
27
27
|
const video = session.stream('video')
|
|
28
28
|
video.on('track', (track) => {
|
|
29
|
-
videoElement.srcObject = new MediaStream([track])
|
|
29
|
+
if (track) videoElement.srcObject = new MediaStream([track])
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
// Drive the app by writing DESIRED state into the control doc; the runtime reactively
|
|
@@ -70,13 +70,22 @@ second hand-poll (`pipeline.bind` / `stage.bind(doc, mapping)` are retired). Kee
|
|
|
70
70
|
- `session.stream(name)` — get a named symmetric stream (media or data); first use decides direction.
|
|
71
71
|
- `session.stream(name).track` — read the latest inbound track (consume side).
|
|
72
72
|
- `session.stream(name).on('track', cb)` — subscribe to inbound tracks as they arrive.
|
|
73
|
-
- `session.stream(name).attach(track)` — produce: send a local browser track upstream.
|
|
74
|
-
- `session.stream(name).
|
|
73
|
+
- `session.stream(name).attach(track)` — produce: send a local browser MIC/AUDIO track upstream.
|
|
74
|
+
- `session.stream(name).attachVideo(track)` — produce: send a local browser VIDEO track upstream
|
|
75
|
+
(a later call swaps the source via `replaceTrack`). `detach()` / `detachVideo()` stop producing.
|
|
76
|
+
- `session.stream(name).emit(payload)` / `.messages()` — the DATA lane: produce a payload on the
|
|
77
|
+
named stream / consume it as an async iterable (subscribing is opt-in).
|
|
75
78
|
- `session.stream(name).seek(seconds)` — seek a persisted finite stream to seconds from start.
|
|
76
79
|
- `session.stream(name).seek('live')` — return a live stream to the live edge.
|
|
77
80
|
- `session.doc(name).get()` — read the merged document snapshot.
|
|
78
81
|
- `session.doc(name).set(patch)` — write desired state into a session document.
|
|
79
82
|
- `session.doc(name).on('change', cb)` — react to runtime-published document changes.
|
|
83
|
+
- `session.request(payload)` / `.requestStream(payload)` / `.complete(payload)` — correlated
|
|
84
|
+
request/response riding a session doc (reconnect-safe); `requestStream` yields incremental deltas.
|
|
85
|
+
- `session.onPhase(cb)` / `session.whenLive()` — the nine honest lifecycle phases and the
|
|
86
|
+
"is media ready?" gate (rejects with a typed `SessionFailedError`).
|
|
87
|
+
- `session.end()` / `session.disconnect()` — terminal release vs. detach-and-stay-reconnectable.
|
|
88
|
+
- `Session.attach(sessionId, options)` — join a running session as a consume-only viewer.
|
|
80
89
|
- `createStore(options)` — content-addressed global store: `get(key)` / `has(key)` reads and
|
|
81
90
|
`on(name, cb)` / `emit(name, data)` global streams. (App-scoped `store.cache` is a runtime
|
|
82
91
|
concern; content-addressed blobs — `store.model`/`store.path`/`store.repo` — are not app-scoped.)
|