Docs / React Native / Agora
Agora on React Native
Beautify the published camera of a react-native-agora 4.x call. Facevity registers a native frame observer on Agora's engine with one call.
Demo app: facevity-react-native-demo on GitHub
Agora’s native engine is a process singleton. After JavaScript has created and initialised it, Facevity registers a native video frame observer on it (Agora’s documented raw-data path), processes each captured frame in place, and Agora encodes the result. The local view and every remote participant receive the beautified frames.
1. Requirements
react-native-facevityset up as in the quick startreact-native-agora4.x- iOS:
'agora'in$FacevityRtcHooksin the Podfile. Android detects it automatically. - Licence feature
buffer.path(I420 frames)
2. Attach before preview and joining
import { createAgoraRtcEngine } from 'react-native-agora';
import { Beauty, Facevity } from 'react-native-facevity';
const fv = await Facevity.initialize({ licenseToken });
await fv.setParams(Beauty.NATURAL);
const engine = createAgoraRtcEngine();
engine.initialize({ appId: AGORA_APP_ID });
await fv.rtc.agora.attach({ appId: AGORA_APP_ID }); // before startPreview / joinChannel
engine.enableVideo();
engine.startPreview();
engine.joinChannel(token, channel, 0, {});
3. Tear down
await fv.rtc.agora.detach();
engine.leaveChannel();
engine.release();
Notes
- Render Agora’s own local view (
RtcSurfaceView) during the call, not<FacevityCameraView>: most devices give the camera to one client. - Beauty settings apply to the call live.
Need help with an integration? Contact the Facevity team. We answer integration questions during trials.