@kubohiroya/turbowarp-camera-source 0.13.0 → 0.15.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.15.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.15.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,14 @@ if <(stored camera profile result for [pose]) = [restored]> then
253
279
 
254
280
  ## 互換性
255
281
 
282
+ 0.15.0では`getInfo()`に`docsURI`と`blockIconURI`を宣言した。この拡張を同梱するホストが、
283
+ パレットのアイコンとドキュメントボタンを描けるようになる。既存のブロックとcapabilityのメンバーは
284
+ 変えていない。
285
+
286
+ 0.14.0では呼び出し側が持っているstreamを共有する`adoptCamera`と、`./runtime`に`CameraAdoptOptions`・
287
+ `CameraLeaseOptions`の宣言を追加した。`CameraAcquireOptions`のメンバーは変えていない。既存のブロックと
288
+ capabilityのメンバーは変えていない。
289
+
256
290
  0.13.0ではframe sourceに`frameTime`を追加した。既存のブロックとcapabilityのメンバーは変えていない。
257
291
 
258
292
  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.15.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.15.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,14 @@ 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.15.0 declares `docsURI` and `blockIconURI` in `getInfo()`, so a host that
684
+ bundles this extension can draw its palette icon and its documentation button. No existing block
685
+ or capability member changes.
686
+
687
+ Version 0.14.0 adds `adoptCamera` for sharing a stream the caller already holds, and the
688
+ `CameraAdoptOptions` and `CameraLeaseOptions` declarations to `./runtime`. `CameraAcquireOptions`
689
+ keeps every member it had. No existing block or capability member changes.
690
+
654
691
  Version 0.13.0 adds `frameTime` to the frame source. No existing block or capability member changes.
655
692
 
656
693
  Version 0.12.0 adds device-scoped restore, `bind camera profile ... to its current device`,
@@ -716,10 +753,9 @@ The generated JavaScript is a single, non-minified TurboWarp extension file with
716
753
  - `src/block-definitions.json`: canonical block metadata used by both the extension and README generator
717
754
  - `src/extension.ts`: extension implementation
718
755
  - `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
756
  - `src/index.ts`: extension registration entry point
721
757
  - `src/globals.d.ts`: Scratch API declarations used by the project
722
- - `schemas/extension-manifest.schema.json`: JSON Schema for the generated API contract
758
+ - the manifest generator and its JSON Schema come from [`@kubohiroya/turbowarp-extension-manifest`](https://github.com/kubohiroya/turbowarp-extension-manifest)
723
759
  - `scripts/generate-readme.ts`: updates the generated README block section
724
760
  - `tests/`: unit tests
725
761
  - `vite.config.ts`: TurboWarp-compatible Vite build configuration
@@ -731,7 +767,7 @@ Each build emits `dist/extension-manifest.json` with `formatVersion: 1`. It reco
731
767
  block opcodes and types, argument IDs and types, and menu references in a deterministic order. Tools
732
768
  such as `sb3-toolchain` can compare this contract before updating an embedded extension or migrating
733
769
  its ID. See [the architecture document](docs/architecture.md) and the
734
- [JSON Schema](schemas/extension-manifest.schema.json) for the v1 contract.
770
+ [JSON Schema](https://github.com/kubohiroya/turbowarp-extension-manifest/blob/main/schemas/extension-manifest.schema.json) for the v1 contract.
735
771
 
736
772
  After changing runtime or block metadata, regenerate and verify the tracked release artifacts:
737
773
 
@@ -2288,6 +2288,13 @@
2288
2288
  //#region src/extension.ts
2289
2289
  var blockDefinitions = block_definitions_default.blocks;
2290
2290
  var menuDefinitions = block_definitions_default.menus;
2291
+ /**
2292
+ * The documentation site this extension's palette button opens, and the icon the palette draws
2293
+ * on every block. Hosts that bundle several extensions read both out of `getInfo()`, so a
2294
+ * bundled Camera Source without them loses its docs button in the host's palette.
2295
+ */
2296
+ var EXTENSION_DOCS_URI = "https://kubohiroya.github.io/turbowarp-camera-source/";
2297
+ var BLOCK_ICON_URI = `data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><g fill=\"none\" stroke=\"#fff\" stroke-width=\"5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 20h24a4 4 0 0 1 4 4v16a4 4 0 0 1-4 4H12a4 4 0 0 1-4-4V24a4 4 0 0 1 4-4Z\"/><path d=\"m40 29 14-9v24l-14-9\"/></g></svg>")}`;
2291
2298
  var defaultCameraId = "default";
2292
2299
  function mediaDevices() {
2293
2300
  const devices = globalThis.navigator?.mediaDevices;
@@ -2469,6 +2476,8 @@
2469
2476
  return {
2470
2477
  id: extensionConfig.id,
2471
2478
  name: Scratch.translate(block_definitions_default.extensionName),
2479
+ docsURI: EXTENSION_DOCS_URI,
2480
+ blockIconURI: BLOCK_ICON_URI,
2472
2481
  blocks: blockDefinitions.map((block) => this.toScratchBlock(block)),
2473
2482
  menus: Object.fromEntries(Object.entries(menuDefinitions).map(([id, menu]) => [id, {
2474
2483
  acceptReporters: menu.acceptReporters,
@@ -2518,9 +2527,31 @@
2518
2527
  async acquireCamera(options = {}) {
2519
2528
  const cameraId = normalizeId(options.cameraId);
2520
2529
  const session = this.session(cameraId);
2521
- const token = Symbol(String(options.owner ?? "camera-lease"));
2522
2530
  if (session.startPromise) await session.startPromise;
2523
2531
  else if (!session.stream) await this.start(session, options);
2532
+ return this.lease(session, options);
2533
+ }
2534
+ /**
2535
+ * Shares a stream the caller already holds, under a camera id, without opening a camera.
2536
+ *
2537
+ * Refuses when the id already runs a different stream rather than quietly joining it: the caller
2538
+ * asked for its own stream to be shared, and answering with somebody else's would leave it
2539
+ * believing a stream is in use that nobody reads. Adopting the same stream twice is the one case
2540
+ * that joins, because that is what the caller asked for and already got.
2541
+ */
2542
+ async adoptCamera(options) {
2543
+ const stream = options?.stream;
2544
+ if (typeof stream !== "object" || stream === null || typeof stream.getTracks !== "function") throw new TypeError("Camera Source adoptCamera requires a MediaStream.");
2545
+ const cameraId = normalizeId(options.cameraId);
2546
+ const session = this.session(cameraId);
2547
+ if (session.startPromise) await session.startPromise;
2548
+ if (session.stream && session.stream !== stream) throw new Error(`Camera id ${cameraId} already runs another stream. Release its leases before adopting.`);
2549
+ if (!session.stream) await this.adopt(session, stream);
2550
+ return this.lease(session, options);
2551
+ }
2552
+ lease(session, options) {
2553
+ const cameraId = session.cameraId;
2554
+ const token = Symbol(String(options.owner ?? "camera-lease"));
2524
2555
  session.leases.add(token);
2525
2556
  try {
2526
2557
  if (options.preview === true) {
@@ -3009,11 +3040,48 @@
3009
3040
  preview: null,
3010
3041
  startPromise: null,
3011
3042
  activeDeviceId: "",
3012
- frameTimes: null
3043
+ frameTimes: null,
3044
+ adopted: false
3013
3045
  };
3014
3046
  this.sessions.set(cameraId, session);
3015
3047
  return session;
3016
3048
  }
3049
+ /**
3050
+ * Brings a caller's stream into a session, taking the same path `start` takes after acquisition.
3051
+ *
3052
+ * `adopted` is set before anything can fail, so no failure path can reach the tracks.
3053
+ */
3054
+ async adopt(session, stream) {
3055
+ session.adopted = true;
3056
+ session.startPromise = (async () => {
3057
+ let video = null;
3058
+ try {
3059
+ if (!session.active) throw new Error("Camera adoption was cancelled.");
3060
+ video = document.createElement("video");
3061
+ video.muted = true;
3062
+ video.playsInline = true;
3063
+ video.srcObject = stream;
3064
+ await video.play();
3065
+ if (!session.active) throw new Error("Camera adoption was cancelled.");
3066
+ session.stream = stream;
3067
+ session.video = video;
3068
+ session.frameTimes = new FrameTimeWatcher(video, globalThis.performance?.timeOrigin ?? 0);
3069
+ this.watchStreamEnd(session, stream);
3070
+ this.updateActiveDevice(session);
3071
+ this.cameraFailures.delete(session.cameraId);
3072
+ } catch (error) {
3073
+ if (video) video.srcObject = null;
3074
+ throw error;
3075
+ }
3076
+ })();
3077
+ try {
3078
+ await session.startPromise;
3079
+ } catch (error) {
3080
+ if (this.sessions.get(session.cameraId) === session) this.stopCameraSession(session.cameraId);
3081
+ this.cameraFailures.set(session.cameraId, cameraFailure(error));
3082
+ throw error;
3083
+ }
3084
+ }
3017
3085
  async start(session, options) {
3018
3086
  session.startPromise = (async () => {
3019
3087
  const stream = await mediaDevices().getUserMedia(videoConstraints(options));
@@ -3109,7 +3177,7 @@
3109
3177
  session.preview?.dispose();
3110
3178
  session.frameTimes?.dispose();
3111
3179
  session.frameTimes = null;
3112
- session.stream?.getTracks().forEach((track) => track.stop());
3180
+ if (!session.adopted) session.stream?.getTracks().forEach((track) => track.stop());
3113
3181
  if (session.video) session.video.srcObject = null;
3114
3182
  session.stream = null;
3115
3183
  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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C;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.15.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
- }