react-native-webrtc-kaleidoscope 2.7.9 → 2.7.12
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/dist/web-driver/tuning.d.ts +1 -0
- package/dist/web-driver/tuning.d.ts.map +1 -1
- package/dist/web-driver/tuning.js +15 -5
- package/dist/web-driver/tuning.js.map +1 -1
- package/llms.txt +15 -2
- package/package.json +23 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuning.d.ts","sourceRoot":"","sources":["../../web-driver/tuning.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D,cAAM,iBAAiB;IACrB,SAAS,
|
|
1
|
+
{"version":3,"file":"tuning.d.ts","sourceRoot":"","sources":["../../web-driver/tuning.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D,cAAM,iBAAiB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IAGtB,2BAA2B,EAAE,MAAM,CAAC;IACpC,WAAW,EAAE,OAAO,CAAC;IAKrB,cAMC;IAED,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEnC;IAED,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpC;IAED,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAElD;IAED,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEnC;IAED,KAAK,IAAI,IAAI,CAMZ;CACF;AAED,eAAO,MAAM,MAAM,mBAA0B,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,SAAU,SAAS,KAAG,IAG/C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aACpB,MAAM,aACL,MAAM,KAChB,SAAS,CAAC,MAAM,EAAE,MAAM,CAK1B,CAAC"}
|
|
@@ -12,13 +12,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.maskSmoothstepRange = exports.setMaskTuning = exports.tuning = void 0;
|
|
13
13
|
const clamp = (value, lo, hi) => Math.min(Math.max(value, lo), hi);
|
|
14
14
|
class EffectTuningState {
|
|
15
|
-
blurSigma
|
|
16
|
-
maskHardness
|
|
17
|
-
maskThreshold
|
|
15
|
+
blurSigma;
|
|
16
|
+
maskHardness;
|
|
17
|
+
maskThreshold;
|
|
18
18
|
// Native-only knobs stored here for cross-platform API parity; the web
|
|
19
19
|
// MediaPipe pipeline does not currently consume them.
|
|
20
|
-
segmentationTargetShortSide
|
|
21
|
-
debugTiming
|
|
20
|
+
segmentationTargetShortSide;
|
|
21
|
+
debugTiming;
|
|
22
|
+
// Defaults are assigned in the constructor rather than as field initializers;
|
|
23
|
+
// Bun 1.4 counts field initializers as a function that coverage never marks
|
|
24
|
+
// hit, which fails the 100% function threshold.
|
|
25
|
+
constructor() {
|
|
26
|
+
this.blurSigma = 5;
|
|
27
|
+
this.maskHardness = 0.5;
|
|
28
|
+
this.maskThreshold = 0.5;
|
|
29
|
+
this.segmentationTargetShortSide = 384;
|
|
30
|
+
this.debugTiming = false;
|
|
31
|
+
}
|
|
22
32
|
setBlurSigma(value) {
|
|
23
33
|
this.blurSigma = clamp(value, 0.5, 7);
|
|
24
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuning.js","sourceRoot":"","sources":["../../web-driver/tuning.ts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,8DAA8D;AAC9D,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,kDAAkD;;;AAIlD,MAAM,KAAK,GAAG,CAAC,KAAa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AAO,CAAC,gBAAgB,GAAG,KAAK,GAAG,GAAG,EAAE,gBAAgB,GAAG,KAAK,GAAG,GAAG,CAAU,CAAC;AACnF,CAAC,CAAC;AARW,QAAA,mBAAmB,GAAnB,mBAAmB,CAQ9B","sourcesContent":["// Mutable runtime state for the web GLSL effects. Mirrors\n// android/.../EffectTuning.kt and ios/.../EffectTuning.swift.\n//\n// The mask edge (hardness/threshold) is written here through exactly two\n// doors: the setMask closure that `bindKaleidoscope` (src/index.web.ts) wires\n// up, and `setMaskTuning` below (re-exported by the `/livekit` subpath for the\n// processor path, where LiveKit owns the sender and there is no binding). The\n// composite compositor in `web-driver/effects/*.ts` reads it when uploading\n// uniforms. Writes take effect on the next frame.\n\nimport type { MaskInput } from '../src/kaleidoscope/types';\n\nconst clamp = (value: number, lo: number, hi: number): number => Math.min(Math.max(value, lo), hi);\n\nclass EffectTuningState {\n blurSigma: number;\n maskHardness: number;\n maskThreshold: number;\n // Native-only knobs stored here for cross-platform API parity; the web\n // MediaPipe pipeline does not currently consume them.\n segmentationTargetShortSide: number;\n debugTiming: boolean;\n\n // Defaults are assigned in the constructor rather than as field initializers;\n // Bun 1.4 counts field initializers as a function that coverage never marks\n // hit, which fails the 100% function threshold.\n constructor() {\n this.blurSigma = 5;\n this.maskHardness = 0.5;\n this.maskThreshold = 0.5;\n this.segmentationTargetShortSide = 384;\n this.debugTiming = false;\n }\n\n setBlurSigma(value: number): void {\n this.blurSigma = clamp(value, 0.5, 7);\n }\n\n setMaskHardness(value: number): void {\n this.maskHardness = clamp(value, 0, 1);\n }\n\n setMaskThreshold(value: number): void {\n this.maskThreshold = clamp(value, 0.05, 0.95);\n }\n\n setSegmentationTargetShortSide(value: number): void {\n this.segmentationTargetShortSide = clamp(value, 128, 1080);\n }\n\n setDebugTiming(value: boolean): void {\n this.debugTiming = value;\n }\n\n reset(): void {\n this.blurSigma = 5;\n this.maskHardness = 0.5;\n this.maskThreshold = 0.5;\n this.segmentationTargetShortSide = 384;\n this.debugTiming = false;\n }\n}\n\nexport const tuning = new EffectTuningState();\n\n/**\n * Write the segmentation mask edge (`hardness`, `threshold`) that every\n * running composite reads each frame. This is the processor-path twin of the\n * `mask` verb on a `bindKaleidoscope` binding: the mask edge is page-shared\n * state (one value every kaleidoscope pipeline on the page reads), so a write\n * here reaches every active pipeline on the next frame with no rebuild.\n * Values clamp to the `mask` verb's ranges (hardness 0..1, threshold\n * 0.05..0.95).\n *\n * Module-level rather than per-instance because that is the true scope today;\n * a per-pipeline mask would be a different (future) API, not this one.\n */\nexport const setMaskTuning = (mask: MaskInput): void => {\n tuning.setMaskHardness(mask.hardness);\n tuning.setMaskThreshold(mask.threshold);\n};\n\n/**\n * Derive a smoothstep (lo, hi) range from a hardness factor in [0, 1] and\n * a threshold in [0.05, 0.95]. Matches `MaskTuning.smoothstepRange` on the\n * Android side; keep in sync.\n *\n * hardness controls width: 0 = soft halo (wide transition), 1 = near-step.\n * threshold controls the center: 0.5 = neutral, higher = reject low-\n * confidence pixels (rejects chair-edge regions), lower = more inclusive.\n */\nexport const maskSmoothstepRange = (\n hardness: number,\n threshold: number,\n): readonly [number, number] => {\n const clampedHardness = clamp(hardness, 0, 1);\n const clampedThreshold = clamp(threshold, 0.05, 0.95);\n const width = 0.6 * (1 - clampedHardness) + 0.02;\n return [clampedThreshold - width * 0.5, clampedThreshold + width * 0.5] as const;\n};\n"]}
|
package/llms.txt
CHANGED
|
@@ -16,11 +16,11 @@ It is **not** a fork of `react-native-webrtc`, **not** a managed-cloud SaaS, and
|
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
bun add react-native-webrtc react-native-webrtc-kaleidoscope
|
|
19
|
-
bunx expo install expo-build-properties expo-dev-client
|
|
19
|
+
bunx expo install expo-asset expo-build-properties expo-dev-client
|
|
20
20
|
# or npm install / yarn add / pnpm add
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Peer dependencies: `expo` (>=51), `expo-asset` (>=10
|
|
23
|
+
Peer dependencies: `expo` (>=51), `expo-asset` (>=10; install it directly with `expo install` even though `expo` depends on it: `expo-doctor` requires native-module peers to be direct dependencies and warns the app may crash outside Expo Go otherwise), `react` (>=18.2), `react-native` (>=0.74). `react-native-webrtc` (>=124) is an **optional** peer you supply (or `@livekit/react-native-webrtc` + `livekit-client` if you use the `/livekit` adapter; pick ONE fork, never both). `nativewind` (>=4) and `@react-native-community/slider` (>=4.5) are **optional** peers, only needed for the styled UI / live-controls extras.
|
|
24
24
|
|
|
25
25
|
## Configure (copy-paste; every entry here is load-bearing)
|
|
26
26
|
|
|
@@ -563,6 +563,19 @@ setMaskTuning({ hardness: 0.2, threshold: 0.85 }); // the mask verb's twin on th
|
|
|
563
563
|
- **Android** native >= API 24; OpenGL ES 3.0 pipeline; MediaPipe Tasks segmentation.
|
|
564
564
|
- **Web** Chromium browsers with `MediaStreamTrackProcessor`; WebGL2 compositor; MediaPipe Selfie Segmentation (WASM).
|
|
565
565
|
|
|
566
|
+
## Upgrading dependencies: verify on Android, never on web alone
|
|
567
|
+
|
|
568
|
+
**Any dependency upgrade that can reach the binary MUST be verified with a real Android build before you ship it.** This is the fastest way to break a React Native app, and it is the failure mode web testing cannot see: the web pipeline fetches assets as URLs and runs entirely in JS, so it never exercises native autolinking, the Gradle build, native asset bundling, the manifest merger, or the ABI split. A change can be green on web and on every typecheck and unit test while the Android app fails to build or crashes on launch.
|
|
569
|
+
|
|
570
|
+
"Can reach the binary" covers more than it first appears: `react-native` and `expo` themselves, any package with an `android/` directory or a podspec (`react-native-webrtc`, `@react-native-async-storage/async-storage`, `@react-native-community/slider`, `react-native-webrtc-kaleidoscope`), anything an Expo config plugin touches (`expo-build-properties` and the SDK version that sets `minSdkVersion`, `compileSdkVersion`, and the iOS deployment target), and transitive native dependencies a lockfile refresh may move underneath you. A pure JS or types-only bump is the only safe exception, and a lockfile refresh can turn one of those into a native one without warning.
|
|
571
|
+
|
|
572
|
+
The verification, in order:
|
|
573
|
+
|
|
574
|
+
1. **Check alignment first.** Run `bunx expo-doctor` and `bunx react-native doctor` (or the `npx` equivalents) and resolve what they report. Doctor catches SDK-to-package version drift, duplicate or mismatched native dependencies, and misconfigured build settings faster than reading a diff does, and version compatibility is not something to settle by inspection.
|
|
575
|
+
2. **Build the Android app, do not just compile the module.** A Gradle module compile proves the Kotlin still typechecks; it does not prove the app links, packages, and starts. Produce an installable artifact (`npx expo run:android`, `./gradlew assembleRelease`, or an EAS build).
|
|
576
|
+
3. **Run it and look at it.** Install on an emulator or a device, launch, exercise the effects, and confirm no crash and no blank render. Bundled images and thumbnails in particular resolve by a native path that only a standalone build exercises, so a web run or a Metro dev-client run can hide a broken asset entirely.
|
|
577
|
+
4. **Then confirm on iOS and web.** Android is the first gate because it is where dependency drift surfaces soonest, not because the other two platforms are optional.
|
|
578
|
+
|
|
566
579
|
## The demo is the canonical working example
|
|
567
580
|
|
|
568
581
|
The repo's `demo/` is a complete consuming app exercising everything above on all three platforms: `demo/app.config.js` (the config-plugin + build-properties + permissions wiring, with comments explaining each entry), `demo/kaleidoscope.preset-book.ts` (a full book including a consumer-owned `wolf-cave.webp` background and per-preset `controls`), `demo/src/use-loopback-stream{,.web}.ts` and `demo/src/video-preview{,.web}.tsx` (the platform-split wiring), and `demo/app/index.tsx` (picker + editor + verbs on one screen). When this file and the demo disagree, trust the demo and file an issue: https://github.com/simiancraft/react-native-webrtc-kaleidoscope
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-webrtc-kaleidoscope",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.12",
|
|
4
4
|
"description": "Live video effects (blur, background replacement, generative backgrounds, flip/rotate) for react-native-webrtc, packaged as a managed-Expo-friendly Expo Module. Working on web, Android, and iOS. Active development.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -557,9 +557,9 @@
|
|
|
557
557
|
],
|
|
558
558
|
"scripts": {
|
|
559
559
|
"clean": "rm -rf dist",
|
|
560
|
-
"build": "bun run clean &&
|
|
561
|
-
"typecheck": "
|
|
562
|
-
"typecheck:test": "
|
|
560
|
+
"build": "bun run clean && tsc -p tsconfig.build.json && bun run copy:assets",
|
|
561
|
+
"typecheck": "tsc --noEmit",
|
|
562
|
+
"typecheck:test": "tsc --noEmit --project tsconfig.test.json",
|
|
563
563
|
"typecheck:demo": "cd demo && bunx tsc --noEmit",
|
|
564
564
|
"prepare": "command -v lefthook >/dev/null 2>&1 && lefthook install || true",
|
|
565
565
|
"lint": "biome check",
|
|
@@ -570,7 +570,7 @@
|
|
|
570
570
|
"check:assets": "bun run scripts/check-book-assets.ts",
|
|
571
571
|
"check:package": "publint --strict",
|
|
572
572
|
"check:knip": "knip",
|
|
573
|
-
"check:react-compiler": "eslint src/components 'catalog/composites/**/*.controls.tsx' 'catalog/shaders/**/*.form.tsx'",
|
|
573
|
+
"check:react-compiler": "bun install --cwd tools/lint --frozen-lockfile --silent && eslint src/components 'catalog/composites/**/*.controls.tsx' 'catalog/shaders/**/*.form.tsx'",
|
|
574
574
|
"check:kotlin": "bun run scripts/ktlint.ts",
|
|
575
575
|
"format:kotlin": "bun run scripts/ktlint.ts --format",
|
|
576
576
|
"check:swift": "bun run scripts/swift.ts",
|
|
@@ -634,32 +634,29 @@
|
|
|
634
634
|
"@mediapipe/selfie_segmentation": "^0.1.1675465747"
|
|
635
635
|
},
|
|
636
636
|
"devDependencies": {
|
|
637
|
-
"@biomejs/biome": "^2.
|
|
638
|
-
"@expo/config-plugins": "~56.0.
|
|
639
|
-
"@react-native-async-storage/async-storage": "1.
|
|
640
|
-
"@react-native-community/slider": "5.2.
|
|
641
|
-
"@semantic-release/changelog": "^
|
|
642
|
-
"@semantic-release/git": "^
|
|
637
|
+
"@biomejs/biome": "^2.5.14",
|
|
638
|
+
"@expo/config-plugins": "~56.0.16",
|
|
639
|
+
"@react-native-async-storage/async-storage": "1.24.0",
|
|
640
|
+
"@react-native-community/slider": "5.2.1",
|
|
641
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
642
|
+
"@semantic-release/git": "^11.0.1",
|
|
643
643
|
"@semantic-release/npm": "^13.1.5",
|
|
644
|
-
"@types/bun": "^1.
|
|
644
|
+
"@types/bun": "^1.4.2",
|
|
645
645
|
"@types/react": "~18.2.79",
|
|
646
|
-
"
|
|
647
|
-
"
|
|
648
|
-
"
|
|
649
|
-
"
|
|
650
|
-
"
|
|
651
|
-
"
|
|
652
|
-
"knip": "^6.5.0",
|
|
653
|
-
"lefthook": "^2.1.9",
|
|
654
|
-
"livekit-client": "^2.0.0",
|
|
646
|
+
"eslint": "^10.11.0",
|
|
647
|
+
"expo": "^51.0.39",
|
|
648
|
+
"expo-modules-core": "^56.0.26",
|
|
649
|
+
"knip": "^6.37.0",
|
|
650
|
+
"lefthook": "^2.1.14",
|
|
651
|
+
"livekit-client": "^2.22.3",
|
|
655
652
|
"nativewind": "4.2.x",
|
|
656
|
-
"playwright": "1.
|
|
657
|
-
"publint": "^0.3.
|
|
653
|
+
"playwright": "1.63.0",
|
|
654
|
+
"publint": "^0.3.24",
|
|
658
655
|
"react": "18.2.0",
|
|
659
656
|
"react-native": "0.74.5",
|
|
660
|
-
"react-native-webrtc": "^124.0.
|
|
661
|
-
"semantic-release": "^25.0.
|
|
662
|
-
"typescript": "^
|
|
657
|
+
"react-native-webrtc": "^124.0.8",
|
|
658
|
+
"semantic-release": "^25.0.9",
|
|
659
|
+
"typescript": "^7.0.2"
|
|
663
660
|
},
|
|
664
661
|
"publishConfig": {
|
|
665
662
|
"access": "public",
|