Repository navigation
feat!: feed the mixer from a VisionCamera output - #1
Merged
Merged
Conversation
…mera The library no longer captures the camera itself. `CameraLayer` owns a VisionCamera 5 `CameraOutput` (an AVCaptureVideoDataOutput on iOS, a CameraX Preview use case drawing into the mixer's SurfaceTexture on Android) that VisionCamera negotiates, rotates, starts and stops with its session. Frames still go from the camera to the mixer natively; JavaScript only hands `stream.cameraOutput` to `<Camera outputs>`. - Remove CameraSource (AVCaptureSession / Camera2), camera permission handling and the `camera`, `flipCamera`, `setCameraPosition` hook API - Add `createCameraLayer()`, `RtmpStream.cameraOutput`; the hook requests the microphone permission only - Rename the native view to `RtmpPreviewView` (VisionCamera registers `PreviewView`); the JS `PreviewView` and `RtmpPreview` names stay - Android: one SurfaceTexture per SurfaceRequest, released only after CameraX reports the surface unused and the mixer retired it - Depend on react-native-vision-camera ^5.2.3 (pod, gradle module, prefab) and limit nitrogen to this package's specs (`**/node_modules`) - Example app runs VisionCamera's Camera with the stream's output BREAKING CHANGE: react-native-vision-camera (and its peer react-native-nitro-image) is required. `useRtmpStream` no longer takes `camera` and no longer exposes `camera`, `flipCamera` or `setCameraPosition`; pass `stream.cameraOutput` to VisionCamera and switch cameras through its `device` prop. `createCameraSource` is replaced by `createCameraLayer`.
- README: a "Migrating from 0.3" section mapping the removed camera API to VisionCamera's device, permission and constraints - CONTRIBUTING: which VisionCamera surfaces the output may use, why nitrogen ignores nested node_modules, how to build the native library alone, and that camera streaming needs a device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The library no longer opens the camera itself. VisionCamera (v5) owns the camera session, and the stream plugs into it as a
CameraOutputthat feeds the mixer.Breaking change:
CameraSourceis replaced byCameraLayer.API
createCameraSource()→createCameraLayer(). The layer exposesoutput(a VisionCameraCameraOutput),isFrontCameraandisReceivingFrames.useRtmpStreamreturnscameraOutputfor<Camera outputs={[stream.cameraOutput]}>. Thecameraoption,stream.camera,flipCamera()andsetCameraPosition()are removed; switch cameras by changing VisionCamera'sdevice.useCameraPermission);requestStreamPermissionsonly handles the microphone.RtmpPreviewViewto avoid clashing with VisionCamera'sPreviewView. The JS export names are unchanged.react-native-vision-camera^5.2.3 is a new peer dependency (it bringsreact-native-nitro-image).iOS
RtmpCameraOutput: anAVCaptureVideoDataOutputadded to VisionCamera's session. BGRA frames are rotated tooutputOrientationand never mirrored.Android
RtmpCameraOutput: a CameraXPreviewuse case that renders straight into a mixerSurfaceTexture, so frames stay on the GPU.SurfaceRequestgets a newCameraSurface, released only once both CameraX (the request result) and the mixer (retire) are done with it.camera-coreis added.Migration
Documented in README → "Migrating from 0.3".
Test plan
yarn jest(32 tests) andtscpassisActive={false}) while publishing, to check that the stream continues via timer framesFollow-ups
compileOnlyso this library never changes the version VisionCamera resolves.request.camerais a restricted API; widen the catch (or use a public API) to survive CameraX alpha changes.readyno longer waits for camera frames, so the first published frames may be timer frames until the camera delivers.