@kubohiroya/turbowarp-camera-source 0.19.1 → 0.19.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.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.19.1/dist/camera-source.js
29
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.19.2/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.19.1
35
+ pnpm add @kubohiroya/turbowarp-camera-source@0.19.2
36
36
  ```
37
37
 
38
38
  ## Quick start
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.19.1/dist/camera-source.js
33
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.19.2/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.19.1
39
+ pnpm add @kubohiroya/turbowarp-camera-source@0.19.2
40
40
  ```
41
41
 
42
42
  ## Quick Start
@@ -4110,6 +4110,7 @@
4110
4110
  this.controls = /* @__PURE__ */ new Set();
4111
4111
  this.standaloneControls = null;
4112
4112
  this.cameraButtons = /* @__PURE__ */ new Map();
4113
+ this.cameraButtonStreams = /* @__PURE__ */ new WeakSet();
4113
4114
  this.profiles = new CameraProfileRegistry();
4114
4115
  this.generations = /* @__PURE__ */ new Map();
4115
4116
  this.lastConditions = /* @__PURE__ */ new Map();
@@ -4543,6 +4544,7 @@
4543
4544
  return;
4544
4545
  }
4545
4546
  try {
4547
+ this.cameraButtonStreams.add(outcome.stream);
4546
4548
  this.blockLeases.set(cameraId, await this.adoptCamera({
4547
4549
  owner: "camera-source-block",
4548
4550
  cameraId,
@@ -5053,7 +5055,11 @@
5053
5055
  session.preview?.dispose();
5054
5056
  session.frameTimes?.dispose();
5055
5057
  session.frameTimes = null;
5056
- if (!session.adopted) session.stream?.getTracks().forEach((track) => track.stop());
5058
+ const stream = session.stream;
5059
+ if (stream && (!session.adopted || this.cameraButtonStreams.has(stream))) {
5060
+ this.cameraButtonStreams.delete(stream);
5061
+ stream.getTracks().forEach((track) => track.stop());
5062
+ }
5057
5063
  if (session.video) session.video.srcObject = null;
5058
5064
  session.stream = null;
5059
5065
  session.video = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/turbowarp-camera-source",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
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",