@applooma/beauty-react-native
v0.2.0
Published
Looma Beauty Camera for React Native: free real-time beauty, make-up, filters, masks and backgrounds for AppLooma RTC
Maintainers
Readme
Looma Beauty Camera for React Native
Free real-time beauty camera for AppLooma RTC: skin smoothing and tone, face shape, make-up, 52 colour filters, face masks that follow the head, and background blur or replacement. What it draws is what viewers receive and what you see in your own preview. Ready-made panels included.
Guide: https://docs.applooma.dev/guides/beauty-camera
Install
npm install @applooma/beauty-react-native
cd ios && pod installIt works next to @applooma/rtc-react-native (and its two native packages,
@applooma/rtc-native-core and @applooma/rtc-native-webrtc). Rebuild the
app after installing; autolinking adds the native half.
Requirements: Android 7.0 (API 24)+ with OpenGL ES 2.0; iOS 14+ with Metal.
Use
import { AppEngine } from '@applooma/rtc-react-native';
import { LoomaBeauty } from '@applooma/beauty-react-native';
const beauty = await LoomaBeauty.create(); // Smart Beauty is on
beauty.attachToEngine(engine); // stays on through camera switches
beauty.showPanel(); // Presets, Beauty, Make up, Filter
beauty.showMagicPanel(); // Mask and BackgroundOr in code:
await beauty.setPreset('NATURAL');
await beauty.setItem('SMOOTH', 0.7); // 0..1; face-shape items -1..1
await beauty.setFilter('PEARL', 0.8);
await beauty.setMakeup('NONE');
await beauty.setMask('kitty'); // null for none
await beauty.setBackground('BLUR'); // 'NONE' for off
await beauty.setCustomBackground('file:///.../beach.jpg');
await beauty.close();Every id is typed and listed: PRESETS, ITEMS, FILTERS, MAKEUP,
BACKGROUNDS, MASKS, BIPOLAR_ITEMS. Mask and background pictures download
from AppLooma's CDN the first time they are chosen and then stay on the device.
Your own camera track
attachToLocalVideo(track) puts the beauty camera on one local camera track
(a local video track, or its mediaStreamTrack). Muting or switching the
camera replaces the track, so call it again then, or use attachToEngine.
One frame processor runs per camera track: the beauty camera replaces the RTC
SDK's engine.setVideoEnhance(). Use one or the other.
How it connects
The media package keeps a registry of named camera-frame processors. This
package registers one named applooma-beauty and the JS side puts it on the
camera track. On Android it runs Looma Beauty Camera
(com.applooma:beauty-android, from Maven Central) on the GPU texture of each
frame; on iOS it runs it on the frame's pixel buffer with Metal.
iOS: why one pod
Looma Beauty Camera for iOS is a Swift package, and CocoaPods cannot depend on
a Swift package. So this package's own pod (applooma-beauty-react-native)
compiles the beauty camera's Swift sources, which ship in the npm tarball
under ios/LoomaBeautyCamera/. Nothing extra goes in your Podfile, and the
pod is found by autolinking like any other.
License
Free to use under the Looma Beauty Camera Free License; see LICENSE.
© AppLooma LLC.
