@kubohiroya/turbowarp-camera-source 0.23.1 → 0.23.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 +2 -2
- package/README.md +2 -2
- package/dist/camera-source.js +39 -10
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -40,13 +40,13 @@ TurboWarp Camera Sourceは、MediaDevicesのカメラストリームを名前付
|
|
|
40
40
|
次のURLをunsandboxed custom extensionとして読み込みます。
|
|
41
41
|
|
|
42
42
|
```text
|
|
43
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.23.
|
|
43
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.23.2/dist/camera-source.js
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
npm hostでは次を使います。
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
pnpm add @kubohiroya/turbowarp-camera-source@0.23.
|
|
49
|
+
pnpm add @kubohiroya/turbowarp-camera-source@0.23.2
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## 最初の使い方
|
package/README.md
CHANGED
|
@@ -44,13 +44,13 @@ the original description when no translation is available. Translation does not
|
|
|
44
44
|
Load this URL as an unsandboxed custom extension:
|
|
45
45
|
|
|
46
46
|
```text
|
|
47
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.23.
|
|
47
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.23.2/dist/camera-source.js
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
For npm hosts:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
pnpm add @kubohiroya/turbowarp-camera-source@0.23.
|
|
53
|
+
pnpm add @kubohiroya/turbowarp-camera-source@0.23.2
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
## Quick start
|
package/dist/camera-source.js
CHANGED
|
@@ -4349,18 +4349,32 @@ var CameraSourceExtension = class {
|
|
|
4349
4349
|
this.storedProfileOutcomes = /* @__PURE__ */ new Map();
|
|
4350
4350
|
this.storedProfilesGeneration = 0;
|
|
4351
4351
|
this.removeFixedEditors = () => {};
|
|
4352
|
+
this.editorsReleased = false;
|
|
4352
4353
|
this.dispose = () => {
|
|
4353
|
-
this.
|
|
4354
|
-
this.
|
|
4355
|
-
this.
|
|
4354
|
+
Scratch.vm.runtime.off?.("RUNTIME_DISPOSED", this.handleRuntimeDisposed);
|
|
4355
|
+
Scratch.vm.runtime.off?.("PROJECT_LOADED", this.restoreEditors);
|
|
4356
|
+
this.editorsReleased = false;
|
|
4357
|
+
this.removeEditors();
|
|
4358
|
+
this.tearDown();
|
|
4359
|
+
};
|
|
4360
|
+
this.handleRuntimeDisposed = () => {
|
|
4361
|
+
this.removeEditors();
|
|
4362
|
+
this.editorsReleased = true;
|
|
4363
|
+
this.handleProjectBoundary();
|
|
4356
4364
|
this.standaloneControls?.dispose();
|
|
4357
4365
|
this.standaloneControls = null;
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
this.
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4366
|
+
};
|
|
4367
|
+
this.restoreEditors = () => {
|
|
4368
|
+
if (!this.editorsReleased) return;
|
|
4369
|
+
this.editorsReleased = false;
|
|
4370
|
+
this.removeSourceEditors = registerSourceEditors(Scratch);
|
|
4371
|
+
try {
|
|
4372
|
+
this.removeFixedEditors = registerFixedInputEditors(Scratch, fixedInputEditors);
|
|
4373
|
+
} catch (error) {
|
|
4374
|
+
this.removeEditors();
|
|
4375
|
+
this.editorsReleased = true;
|
|
4376
|
+
throw error;
|
|
4377
|
+
}
|
|
4364
4378
|
};
|
|
4365
4379
|
this.handleProjectBoundary = () => {
|
|
4366
4380
|
this.stopAllCameras();
|
|
@@ -4388,7 +4402,8 @@ var CameraSourceExtension = class {
|
|
|
4388
4402
|
Scratch.vm.runtime[cameraSourceCapabilityKey] = this.capability;
|
|
4389
4403
|
Scratch.vm.runtime.on?.("PROJECT_STOP_ALL", this.handleProjectBoundary);
|
|
4390
4404
|
Scratch.vm.runtime.on?.("PROJECT_LOADED", this.handleProjectBoundary);
|
|
4391
|
-
Scratch.vm.runtime.on?.("RUNTIME_DISPOSED", this.
|
|
4405
|
+
Scratch.vm.runtime.on?.("RUNTIME_DISPOSED", this.handleRuntimeDisposed);
|
|
4406
|
+
Scratch.vm.runtime.on?.("PROJECT_LOADED", this.restoreEditors);
|
|
4392
4407
|
} catch (error) {
|
|
4393
4408
|
this.dispose();
|
|
4394
4409
|
throw error;
|
|
@@ -4564,6 +4579,20 @@ var CameraSourceExtension = class {
|
|
|
4564
4579
|
this.blockLeases.clear();
|
|
4565
4580
|
this.blockPreviewLeases.clear();
|
|
4566
4581
|
}
|
|
4582
|
+
removeEditors() {
|
|
4583
|
+
this.removeFixedEditors();
|
|
4584
|
+
this.removeSourceEditors();
|
|
4585
|
+
}
|
|
4586
|
+
tearDown() {
|
|
4587
|
+
this.stopAllCameras();
|
|
4588
|
+
this.standaloneControls?.dispose();
|
|
4589
|
+
this.standaloneControls = null;
|
|
4590
|
+
const runtime = Scratch.vm.runtime;
|
|
4591
|
+
if (runtime["kubohiroyaCameraSourceCapability"] === this.capability) delete runtime[cameraSourceCapabilityKey];
|
|
4592
|
+
this.profileChannel?.close();
|
|
4593
|
+
Scratch.vm.runtime.off?.("PROJECT_STOP_ALL", this.handleProjectBoundary);
|
|
4594
|
+
Scratch.vm.runtime.off?.("PROJECT_LOADED", this.handleProjectBoundary);
|
|
4595
|
+
}
|
|
4567
4596
|
registerCameraProfile(args = {}) {
|
|
4568
4597
|
this.registerProfileText(args.PROFILE_JSON, (document) => document);
|
|
4569
4598
|
}
|