Nosmai  Effects Nosmai  Moderation Nosmai Try-ons coming soon
Docs menu React Native
How-to guide

Replace the background in React Native

Replace the React Native camera background with a color, local image, or local video through the Nosmai API.

Platform React Native SDK version 1.0.0 Updated Aug 19, 2026 Time 7 min

Prerequisites

Apply an image

if (await NosmaiCameraSdk.isAdvancedFiltersEnabled()) {
  await NosmaiCameraSdk.setBackground({
    mode: 'image',
    uri: localImageFileUri,
  });
}

Use mode: 'color' with normalized RGBA values, or mode: 'video' with a local video URI.

Portable image formats are JPEG, PNG, and WebP. Portable video formats are MP4, M4V, and MOV. Do not pass a Metro asset number, remote URL, query, or fragment.

Clear it

await NosmaiCameraSdk.clearBackground();

This clears manual segmentation. It does not remove an authored background package.

Verify it worked

The native preview should update without remounting NosmaiCameraView. Test both native platforms in Release builds.

Common errors

ErrorCauseFix
E_BACKGROUND_RESOURCEURI is unreadable or format is unsupportedCopy to a local file and use a supported extension
No visible resultPreview is not ready or capability is disabledWait for onReady and check isAdvancedFiltersEnabled
Memory rises after repeated videosPrevious resources are retained by application stateClear the background and release temporary files when finished

Next steps

References

Was this page helpful?

Your response helps us prioritize documentation improvements.

Nosmai

An AR and AI company. Founded on the idea that the next decade of software will be visual, and that the tools for it should be within reach of anyone building.

Newsletter

Product updates and release notes. No spam.

© 2026 nosmai, inc · all rights reserved