Skip to content

FCE-3838: React Native camera effects on Fishjam's own camera - #287

Open
MiloszFilimowski wants to merge 4 commits into
mainfrom
FCE-3838
Open

MiloszFilimowski wants to merge 4 commits into
mainfrom
FCE-3838

Conversation

@MiloszFilimowski

@MiloszFilimowski MiloszFilimowski commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Description

The React Native docs now send users to camera effects on the camera Fishjam already manages, instead of VisionCamera. VisionCamera stays as an integration.

An effect is a camera track middleware. Peers keep receiving it as peer.cameraTrack:

const blur = createCameraEffectMiddleware(createBackgroundBlurEffect(() => ({ segmentation, radius: 24 })));
setCameraTrackMiddleware(isBlurOn ? null : blur);

Menu changes

  • Tutorials: new "Add background blur to your camera". "Draw WebGPU effects into your published camera" is rewritten on createCameraFrameProcessorSession, with no VisionCamera.
  • How-to → Camera effects (new): overview, background effects (blur and image), WebGPU effects, frame processing in a worklet, and stream middleware (moved here, now covering React Native too).
  • How-to → Custom sources: keeps non-camera content (web, React Native, low-level frame API).
  • Integrations → Vision Camera (new): the VisionCamera tutorial, how-to, and WebGPU-on-VisionCamera guide, moved from the pages above.
  • Concepts: new "How camera effects work". "How custom sources work" links to it.
  • Redirects for the four moved pages.

Build and API reference

  • web-client-sdk submodule bumped to fff4e570 (web-client-sdk#606).
  • New submodules video-effects (v0.1.5) and react-native-worklets (v0.12.1), with TypeDoc pages.
  • typegpu pinned to 0.12.4 (the version video-effects uses). The VisionCamera WebGPU snippet maps typegpu to the SDK's 0.11 through hidden Twoslash flags, so every snippet still type-checks.

Tested

  • All snippets type-check, yarn build passes with no broken links, and the pre-commit checks (format, spellcheck, typecheck) pass.
  • Ran the tutorial code end to end in a test app: iOS simulator (SimCam) and Galaxy S23, debug and release builds, staging room. Blur, grayscale + watermark and the frame monitor work, and each device receives the other's effect.

Testing found these, now fixed in the docs:

  • Android needs minSdkVersion: 26 (react-native-webgpu). The docs add it with expo-build-properties.
  • In Android release builds, expo-asset keeps bundled images as drawable resources, so reading them with File fails. The docs include a workaround, checked in a release build.
  • tgpu.resolve({ externals }) returns empty WGSL in TypeGPU 0.12. The examples use the array form.

Performance on the Galaxy S23 (release build, 720x1280): blur runs at 30 fps with no dropped frames at about 110% CPU of 800% and 33% GPU; the WebGPU tutorial effect at about 111% CPU and 12% GPU. Graphics memory showed a 200 MB to 1 GB saw-tooth with any effect on react-native-webgpu 0.5.15. The cause was in react-native-webgpu (GPUExternalTexture.destroy() did not release the imported frame); fixed upstream in wcandillon/react-native-webgpu#478, released in 0.10.1, memory flat at about 145 MB after it.

Fixes opened in our repos along the way:

The docs require @fishjam-cloud/react-native-client 0.30.2 or newer, @fishjam-cloud/video-effects 0.1.5 or newer and react-native-webgpu 0.10.1 or newer.

Direct React Native users to camera effects that run on the camera Fishjam
already manages (camera track middleware, react-native-worklets frame
callbacks, @fishjam-cloud/video-effects) instead of VisionCamera.

- How-to: new "Camera effects" category with background effects, WebGPU
  effects, frame processing and stream middleware (now for both platforms)
- Tutorials: new background blur tutorial; WebGPU effects tutorial rewritten
  on createCameraFrameProcessorSession
- Integrations: VisionCamera tutorial and how-tos moved to their own section
- Concepts: new "How camera effects work" page
- API reference: video-effects and react-native-worklets submodules with
  TypeDoc; web-client-sdk bumped to fff4e570 (#606)
- Redirects for the moved pages

Validated end to end on the iOS simulator (SimCam) and a Galaxy S23 (debug
and release), which surfaced the Android minSdkVersion 26 requirement and the
expo-asset workaround for bundled images in Android release builds.
0.1.4 makes background images load on React Native and reports image load failures. Bump the video-effects submodule to v0.1.4.
@linear

linear Bot commented Sep 15, 2026

Copy link
Copy Markdown

FCE-3838

…camera effects

react-native-webgpu 0.10.1 releases the imported camera frame on destroy()
(wcandillon/react-native-webgpu#478); older versions leak one frame of graphics
memory per frame on Android until garbage collection. Since 0.8.4 the flag
constants re-exported by react-native-webgpu are undefined at import time, so
the WebGPU tutorial uses the GPUTextureUsage / GPUShaderStage globals instead,
and video-effects 0.1.5 does the same internally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant