Skip to content

TensorCamera is getting blank in android react native expo #8629

@Pranith-Kanchan

Description

@Pranith-Kanchan

System information

Have I written custom code: Yes
OS Platform and Distribution: Android (specific device/model if known)
Mobile device: [Your Android device model]
TensorFlow.js installed from: npm
TensorFlow.js version: 4.22.0
TensorFlow.js React Native version: 1.0.0
TensorFlow.js Converter Version: N/A
Expo: 54.0.33
React Native: 0.81.5

Describe the current behavior
When using cameraWithTensors to wrap CameraView from Expo Camera on Android, the camera preview displays a blank/black screen while pose detection still works in the background. The issue occurs only on Android devices, while iOS works correctly.

Describe the expected behavior
The camera preview should display normally on Android, just like it does on iOS, while still processing frames for pose detection.

Standalone code to reproduce the issue

javascript
import { CameraView } from 'expo-camera';
import { cameraWithTensors } from '@tensorflow/tfjs-react-native';

const TensorCamera = cameraWithTensors(CameraView);

export default function App() {
const handleCameraStream = (images, updatePreview, gl) => {
const imageTensor = images.next().value;
// Pose detection logic here
updatePreview();
};

return (
<TensorCamera
style={{ width: 300, height: 400 }}
facing="front"
cameraTextureHeight={1080}
cameraTextureWidth={720}
resizeHeight={224}
resizeWidth={224}
resizeDepth={3}
onReady={handleCameraStream}
autorender={false}
useCustomShadersToResize={false}
/>
);
}

Additional context:
This occurs specifically with the combination of:
@tensorflow/tfjs-react-native: 1.0.0
expo-camera: ~17.0.10
expo-gl: ~16.0.10
The issue is platform-specific (Android only)
Pose detection still functions despite the blank preview
Similar setups work correctly on iOS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions