@kubohiroya/turbowarp-camera-source 0.19.1 → 0.19.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.
- package/README.ja.md +2 -2
- package/README.md +2 -2
- package/dist/camera-source.js +8 -1
- package/package.json +1 -1
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.
|
|
29
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.19.3/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.
|
|
35
|
+
pnpm add @kubohiroya/turbowarp-camera-source@0.19.3
|
|
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.
|
|
33
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.19.3/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.
|
|
39
|
+
pnpm add @kubohiroya/turbowarp-camera-source@0.19.3
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Quick Start
|
package/dist/camera-source.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Description: Share one MediaDevices camera stream between TurboWarp extensions.
|
|
4
4
|
// By: Hiroya Kubo
|
|
5
5
|
// License: MPL-2.0
|
|
6
|
+
// Unsandboxed: required
|
|
6
7
|
|
|
7
8
|
(function (Scratch) {
|
|
8
9
|
'use strict';
|
|
@@ -4110,6 +4111,7 @@
|
|
|
4110
4111
|
this.controls = /* @__PURE__ */ new Set();
|
|
4111
4112
|
this.standaloneControls = null;
|
|
4112
4113
|
this.cameraButtons = /* @__PURE__ */ new Map();
|
|
4114
|
+
this.cameraButtonStreams = /* @__PURE__ */ new WeakSet();
|
|
4113
4115
|
this.profiles = new CameraProfileRegistry();
|
|
4114
4116
|
this.generations = /* @__PURE__ */ new Map();
|
|
4115
4117
|
this.lastConditions = /* @__PURE__ */ new Map();
|
|
@@ -4543,6 +4545,7 @@
|
|
|
4543
4545
|
return;
|
|
4544
4546
|
}
|
|
4545
4547
|
try {
|
|
4548
|
+
this.cameraButtonStreams.add(outcome.stream);
|
|
4546
4549
|
this.blockLeases.set(cameraId, await this.adoptCamera({
|
|
4547
4550
|
owner: "camera-source-block",
|
|
4548
4551
|
cameraId,
|
|
@@ -5053,7 +5056,11 @@
|
|
|
5053
5056
|
session.preview?.dispose();
|
|
5054
5057
|
session.frameTimes?.dispose();
|
|
5055
5058
|
session.frameTimes = null;
|
|
5056
|
-
|
|
5059
|
+
const stream = session.stream;
|
|
5060
|
+
if (stream && (!session.adopted || this.cameraButtonStreams.has(stream))) {
|
|
5061
|
+
this.cameraButtonStreams.delete(stream);
|
|
5062
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
5063
|
+
}
|
|
5057
5064
|
if (session.video) session.video.srcObject = null;
|
|
5058
5065
|
session.stream = null;
|
|
5059
5066
|
session.video = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-camera-source",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
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",
|