@kubohiroya/turbowarp-camera-source 0.13.0 → 0.14.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.ja.md CHANGED
@@ -26,13 +26,13 @@ TurboWarp-Camera-Sourceは、MediaDevicesのカメラストリームを名前付
26
26
  次のURLをunsandboxed custom extensionとして読み込みます。
27
27
 
28
28
  ```text
29
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.13.0/dist/camera-source.js
29
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.14.0/dist/camera-source.js
30
30
  ```
31
31
 
32
32
  npm hostでは次を使います。
33
33
 
34
34
  ```bash
35
- pnpm add @kubohiroya/turbowarp-camera-source@0.13.0
35
+ pnpm add @kubohiroya/turbowarp-camera-source@0.14.0
36
36
  ```
37
37
 
38
38
  ## Quick start
@@ -122,6 +122,32 @@ await qrLease.release();
122
122
  await poseLease.release();
123
123
  ```
124
124
 
125
+ consumerが`MediaStream`を既に持っている場合は`adoptCamera()`を使います。`<usermedia>` capability
126
+ elementで取得したもの、別フレームから渡されたもの、テスト用の作りものでも同じです。Camera Sourceは
127
+ それを`cameraId`のもとで共有し、どのconsumerも同じ`getFrameSource()`から読みます。
128
+
129
+ **採用したstreamのtrackをCamera Sourceは止めません。** 最後のleaseを解放するとセッションは終わり、
130
+ streamはdetachされます。カメラを使い終えたときに止めるのは呼び出し側です。trackの停止は取り消せず、
131
+ 同じstreamを見ているほかのconsumer全員からフレームを奪うので、それが正しいときを知りうるのは
132
+ streamを開いた側だけです。自分で取得したstreamは従来どおりCamera Sourceが止めます。
133
+
134
+ ```js
135
+ if (typeof cameraSource.adoptCamera === "function") {
136
+ const hostLease = await cameraSource.adoptCamera({
137
+ owner: "app-shell",
138
+ cameraId: "pose",
139
+ stream: streamTheHostAlreadyHolds,
140
+ });
141
+ const frame = hostLease.getFrameSource();
142
+ await hostLease.release();
143
+ }
144
+ ```
145
+
146
+ このメソッドはfeature detectしてください。このsurfaceはversionではなく形で絞られるため、現行の宣言に
147
+ 対してコンパイルしたconsumerが、それより前のビルドに出会うことがあります。既に別のstreamが動いている
148
+ `cameraId`へ2つめを採用しようとすると拒否します。呼び出し側に他人のフレームを返すと、自分のstreamが
149
+ 使われていると誤解させるためです。同じstreamをもう一度採用した場合はそのセッションに参加します。
150
+
125
151
  `preview: true`を指定したleaseは、GPU-backed stage previewを利用します。専用video skinは共有
126
152
  `HTMLVideoElement`を`texImage2D(video)`でアップロードし、preview drawableのX scaleで左右反転します。
127
153
  `drawImage()`、`getImageData()`、CPUでのフレームピクセル走査は行いません。既定値は`false`で、同じ
@@ -253,6 +279,10 @@ if <(stored camera profile result for [pose]) = [restored]> then
253
279
 
254
280
  ## 互換性
255
281
 
282
+ 0.14.0では呼び出し側が持っているstreamを共有する`adoptCamera`と、`./runtime`に`CameraAdoptOptions`・
283
+ `CameraLeaseOptions`の宣言を追加した。`CameraAcquireOptions`のメンバーは変えていない。既存のブロックと
284
+ capabilityのメンバーは変えていない。
285
+
256
286
  0.13.0ではframe sourceに`frameTime`を追加した。既存のブロックとcapabilityのメンバーは変えていない。
257
287
 
258
288
  0.12.0ではデバイスで絞る復元、`bind camera profile ... to its current device`、`camera profile ... belongs to its current device?`、`start shared camera [CAMERA_ID] requested by this page`を追加した。既存のブロックとcapabilityのメンバーは変えていない。
package/README.md CHANGED
@@ -30,13 +30,13 @@ or select separate cameras for separate roles.
30
30
  Load this URL as an unsandboxed custom extension:
31
31
 
32
32
  ```text
33
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.13.0/dist/camera-source.js
33
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.14.0/dist/camera-source.js
34
34
  ```
35
35
 
36
36
  For npm hosts:
37
37
 
38
38
  ```bash
39
- pnpm add @kubohiroya/turbowarp-camera-source@0.13.0
39
+ pnpm add @kubohiroya/turbowarp-camera-source@0.14.0
40
40
  ```
41
41
 
42
42
  ## Quick Start
@@ -469,6 +469,35 @@ await qrLease.release();
469
469
  await poseLease.release();
470
470
  ```
471
471
 
472
+ Use `adoptCamera()` instead when the consumer already holds a `MediaStream` — one obtained
473
+ through the `<usermedia>` capability element, from another frame, or from a test fixture.
474
+ Camera Source shares it under a `cameraId` exactly as an acquired stream, and every consumer
475
+ reads it through the same `getFrameSource()`.
476
+
477
+ **Camera Source never stops the tracks of an adopted stream.** Releasing the last lease ends
478
+ the session and detaches the stream, leaving the caller to stop it when it is finished with the
479
+ camera. Stopping a track cannot be undone and takes the frames away from every other consumer
480
+ of the same stream, so the side that opened it is the only side that can know when that is
481
+ right. An acquired stream is still stopped by Camera Source as before.
482
+
483
+ ```js
484
+ if (typeof cameraSource.adoptCamera === "function") {
485
+ const hostLease = await cameraSource.adoptCamera({
486
+ owner: "app-shell",
487
+ cameraId: "pose",
488
+ stream: streamTheHostAlreadyHolds,
489
+ });
490
+ const frame = hostLease.getFrameSource();
491
+ await hostLease.release();
492
+ }
493
+ ```
494
+
495
+ Feature detect the method. This surface is narrowed by shape rather than by a version, so a
496
+ consumer compiled against the current declarations can still meet a build that predates it.
497
+ Adopting a second, different stream under a `cameraId` that already runs one is refused:
498
+ answering the caller with somebody else's frames would leave it believing its own stream is in
499
+ use. Adopting the same stream again joins the session.
500
+
472
501
  `preview: true` opts that lease into the GPU-backed stage preview. The dedicated video skin uploads
473
502
  the shared `HTMLVideoElement` with `texImage2D(video)` and mirrors by changing the preview drawable's
474
503
  X scale. It does not call `drawImage()`, `getImageData()`, or scan frame pixels on the CPU. The option
@@ -651,6 +680,10 @@ profile), and save it. An app that opens the calibration app for one camera name
651
680
 
652
681
  ## Compatibility
653
682
 
683
+ Version 0.14.0 adds `adoptCamera` for sharing a stream the caller already holds, and the
684
+ `CameraAdoptOptions` and `CameraLeaseOptions` declarations to `./runtime`. `CameraAcquireOptions`
685
+ keeps every member it had. No existing block or capability member changes.
686
+
654
687
  Version 0.13.0 adds `frameTime` to the frame source. No existing block or capability member changes.
655
688
 
656
689
  Version 0.12.0 adds device-scoped restore, `bind camera profile ... to its current device`,
@@ -716,10 +749,9 @@ The generated JavaScript is a single, non-minified TurboWarp extension file with
716
749
  - `src/block-definitions.json`: canonical block metadata used by both the extension and README generator
717
750
  - `src/extension.ts`: extension implementation
718
751
  - `src/video-preview.ts`: GPU-backed `HTMLVideoElement` preview skin and drawable lifecycle
719
- - `src/extension-manifest.ts`: canonical manifest generator and Vite output plugin
720
752
  - `src/index.ts`: extension registration entry point
721
753
  - `src/globals.d.ts`: Scratch API declarations used by the project
722
- - `schemas/extension-manifest.schema.json`: JSON Schema for the generated API contract
754
+ - the manifest generator and its JSON Schema come from [`@kubohiroya/turbowarp-extension-manifest`](https://github.com/kubohiroya/turbowarp-extension-manifest)
723
755
  - `scripts/generate-readme.ts`: updates the generated README block section
724
756
  - `tests/`: unit tests
725
757
  - `vite.config.ts`: TurboWarp-compatible Vite build configuration
@@ -731,7 +763,7 @@ Each build emits `dist/extension-manifest.json` with `formatVersion: 1`. It reco
731
763
  block opcodes and types, argument IDs and types, and menu references in a deterministic order. Tools
732
764
  such as `sb3-toolchain` can compare this contract before updating an embedded extension or migrating
733
765
  its ID. See [the architecture document](docs/architecture.md) and the
734
- [JSON Schema](schemas/extension-manifest.schema.json) for the v1 contract.
766
+ [JSON Schema](https://github.com/kubohiroya/turbowarp-extension-manifest/blob/main/schemas/extension-manifest.schema.json) for the v1 contract.
735
767
 
736
768
  After changing runtime or block metadata, regenerate and verify the tracked release artifacts:
737
769
 
@@ -2518,9 +2518,31 @@
2518
2518
  async acquireCamera(options = {}) {
2519
2519
  const cameraId = normalizeId(options.cameraId);
2520
2520
  const session = this.session(cameraId);
2521
- const token = Symbol(String(options.owner ?? "camera-lease"));
2522
2521
  if (session.startPromise) await session.startPromise;
2523
2522
  else if (!session.stream) await this.start(session, options);
2523
+ return this.lease(session, options);
2524
+ }
2525
+ /**
2526
+ * Shares a stream the caller already holds, under a camera id, without opening a camera.
2527
+ *
2528
+ * Refuses when the id already runs a different stream rather than quietly joining it: the caller
2529
+ * asked for its own stream to be shared, and answering with somebody else's would leave it
2530
+ * believing a stream is in use that nobody reads. Adopting the same stream twice is the one case
2531
+ * that joins, because that is what the caller asked for and already got.
2532
+ */
2533
+ async adoptCamera(options) {
2534
+ const stream = options?.stream;
2535
+ if (typeof stream !== "object" || stream === null || typeof stream.getTracks !== "function") throw new TypeError("Camera Source adoptCamera requires a MediaStream.");
2536
+ const cameraId = normalizeId(options.cameraId);
2537
+ const session = this.session(cameraId);
2538
+ if (session.startPromise) await session.startPromise;
2539
+ if (session.stream && session.stream !== stream) throw new Error(`Camera id ${cameraId} already runs another stream. Release its leases before adopting.`);
2540
+ if (!session.stream) await this.adopt(session, stream);
2541
+ return this.lease(session, options);
2542
+ }
2543
+ lease(session, options) {
2544
+ const cameraId = session.cameraId;
2545
+ const token = Symbol(String(options.owner ?? "camera-lease"));
2524
2546
  session.leases.add(token);
2525
2547
  try {
2526
2548
  if (options.preview === true) {
@@ -3009,11 +3031,48 @@
3009
3031
  preview: null,
3010
3032
  startPromise: null,
3011
3033
  activeDeviceId: "",
3012
- frameTimes: null
3034
+ frameTimes: null,
3035
+ adopted: false
3013
3036
  };
3014
3037
  this.sessions.set(cameraId, session);
3015
3038
  return session;
3016
3039
  }
3040
+ /**
3041
+ * Brings a caller's stream into a session, taking the same path `start` takes after acquisition.
3042
+ *
3043
+ * `adopted` is set before anything can fail, so no failure path can reach the tracks.
3044
+ */
3045
+ async adopt(session, stream) {
3046
+ session.adopted = true;
3047
+ session.startPromise = (async () => {
3048
+ let video = null;
3049
+ try {
3050
+ if (!session.active) throw new Error("Camera adoption was cancelled.");
3051
+ video = document.createElement("video");
3052
+ video.muted = true;
3053
+ video.playsInline = true;
3054
+ video.srcObject = stream;
3055
+ await video.play();
3056
+ if (!session.active) throw new Error("Camera adoption was cancelled.");
3057
+ session.stream = stream;
3058
+ session.video = video;
3059
+ session.frameTimes = new FrameTimeWatcher(video, globalThis.performance?.timeOrigin ?? 0);
3060
+ this.watchStreamEnd(session, stream);
3061
+ this.updateActiveDevice(session);
3062
+ this.cameraFailures.delete(session.cameraId);
3063
+ } catch (error) {
3064
+ if (video) video.srcObject = null;
3065
+ throw error;
3066
+ }
3067
+ })();
3068
+ try {
3069
+ await session.startPromise;
3070
+ } catch (error) {
3071
+ if (this.sessions.get(session.cameraId) === session) this.stopCameraSession(session.cameraId);
3072
+ this.cameraFailures.set(session.cameraId, cameraFailure(error));
3073
+ throw error;
3074
+ }
3075
+ }
3017
3076
  async start(session, options) {
3018
3077
  session.startPromise = (async () => {
3019
3078
  const stream = await mediaDevices().getUserMedia(videoConstraints(options));
@@ -3109,7 +3168,7 @@
3109
3168
  session.preview?.dispose();
3110
3169
  session.frameTimes?.dispose();
3111
3170
  session.frameTimes = null;
3112
- session.stream?.getTracks().forEach((track) => track.stop());
3171
+ if (!session.adopted) session.stream?.getTracks().forEach((track) => track.stop());
3113
3172
  if (session.video) session.video.srcObject = null;
3114
3173
  session.stream = null;
3115
3174
  session.video = null;
package/dist/runtime.d.ts CHANGED
@@ -38,17 +38,37 @@ export declare const cameraSourceCapabilityVersion: 1;
38
38
  * rotation and not a flip, and once both exist their order matters.
39
39
  */
40
40
  export type Flip = 'none' | 'horizontal' | 'vertical' | 'both';
41
- export interface CameraAcquireOptions {
41
+ /** What taking a lease needs, however the stream behind it was obtained. */
42
+ export interface CameraLeaseOptions {
42
43
  /** Free text naming the caller. Appears in diagnostics; never used to decide anything. */
43
44
  owner?: string;
44
45
  /** The role name of the stream, such as `pose` or `qr`. Callers naming the same one share it. */
45
46
  cameraId?: string;
46
- deviceId?: string;
47
- video?: MediaTrackConstraints | boolean;
48
47
  /** How this consumer wants the stage preview drawn. Only meaningful together with `preview`. */
49
48
  previewFlip?: Flip;
50
49
  preview?: boolean;
51
50
  }
51
+ export interface CameraAcquireOptions extends CameraLeaseOptions {
52
+ deviceId?: string;
53
+ video?: MediaTrackConstraints | boolean;
54
+ }
55
+ /**
56
+ * What adopting a stream the caller already holds needs.
57
+ *
58
+ * No `deviceId` or `video`: the stream exists, so there is nothing left to constrain. Which device
59
+ * it came from is readable from the track, and `CameraFrameSource.deviceId` reports it.
60
+ */
61
+ export interface CameraAdoptOptions extends CameraLeaseOptions {
62
+ /**
63
+ * The stream to share. Camera Source never stops its tracks.
64
+ *
65
+ * Releasing the last lease ends the session and detaches the stream, leaving the caller to stop
66
+ * it when it is finished with the camera. Stopping a track cannot be undone and takes the frames
67
+ * away from every other consumer of the same stream, so the side that opened it is the only side
68
+ * that can know when that is right.
69
+ */
70
+ stream: MediaStream;
71
+ }
52
72
  export interface CameraFrameSource {
53
73
  readonly kind: 'video';
54
74
  readonly element: HTMLVideoElement;
@@ -106,6 +126,15 @@ export interface CameraLease {
106
126
  */
107
127
  export interface CameraSourceRuntime {
108
128
  acquireCamera(options?: CameraAcquireOptions): Promise<CameraLease>;
129
+ /**
130
+ * Shares a stream the caller already obtained, instead of opening a camera.
131
+ *
132
+ * Optional because this surface is narrowed by shape rather than by a version, so a consumer
133
+ * compiled against these declarations can still meet a build that predates the method. Feature
134
+ * detect it: `typeof runtime.adoptCamera === 'function'`. A caller reaching for it is already
135
+ * feature detecting whatever produced the stream.
136
+ */
137
+ adoptCamera?(options: CameraAdoptOptions): Promise<CameraLease>;
109
138
  }
110
139
  /**
111
140
  * The profile contract, re-exported so a consumer states it rather than restating it.
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AAExD;;;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AC;AAEnE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kCAAkC,CAAC;AAE5E,wFAAwF;AACxF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAU,CAAC;AAmKxD,oGAAoG;AACpG,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,SAAS,GAAI,OAAmC,CAAC,sBAAsB,CAAC,CAAC;IAC/E,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC1E,MAAM,EAAC,aAAa,EAAC,GAAG,SAAsC,CAAC;IAC/D,OAAO,OAAO,aAAa,KAAK,UAAU,CAAC,CAAC,CAAE,SAAiC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAgB;IAEhB,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,SAAS,GAAI,OAAmC,CAAC,yBAAyB,CAAC,CAAC;IAClF,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC1E,MAAM,EAAC,cAAc,EAAC,GAAG,SAAuC,CAAC;IACjE,OAAO,OAAO,cAAc,KAAK,UAAU,CAAC,CAAC,CAAE,SAAsC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/turbowarp-camera-source",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
5
5
  "description": "A TurboWarp capability extension for sharing one MediaDevices camera stream across extensions.",
6
6
  "type": "module",
@@ -61,6 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@eslint/js": "^9.39.5",
64
+ "@kubohiroya/turbowarp-extension-manifest": "0.2.0",
64
65
  "@kubohiroya/vite-plugin-turbowarp-extension": "0.4.0",
65
66
  "@types/node": "^24.13.3",
66
67
  "ajv": "^8.20.0",
@@ -1,49 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/kubohiroya/turbowarp-extension-template/main/schemas/extension-manifest.schema.json",
4
- "title": "TurboWarp Extension API Manifest",
5
- "type": "object",
6
- "additionalProperties": false,
7
- "required": ["formatVersion", "id", "blocks", "menus"],
8
- "properties": {
9
- "formatVersion": {"const": 1},
10
- "id": {"type": "string", "pattern": "^[a-z0-9]+$"},
11
- "blocks": {
12
- "type": "array",
13
- "items": {
14
- "type": "object",
15
- "additionalProperties": false,
16
- "required": ["opcode", "blockType", "arguments"],
17
- "properties": {
18
- "opcode": {"type": "string", "minLength": 1},
19
- "blockType": {"type": "string", "minLength": 1},
20
- "arguments": {
21
- "type": "array",
22
- "items": {
23
- "type": "object",
24
- "additionalProperties": false,
25
- "required": ["id", "type"],
26
- "properties": {
27
- "id": {"type": "string", "minLength": 1},
28
- "type": {"type": "string", "minLength": 1},
29
- "menu": {"type": "string", "minLength": 1}
30
- }
31
- }
32
- }
33
- }
34
- }
35
- },
36
- "menus": {
37
- "type": "array",
38
- "items": {
39
- "type": "object",
40
- "additionalProperties": false,
41
- "required": ["id", "acceptReporters"],
42
- "properties": {
43
- "id": {"type": "string", "minLength": 1},
44
- "acceptReporters": {"type": "boolean"}
45
- }
46
- }
47
- }
48
- }
49
- }