The rawdata plugin for react-native-agora.
The plugin only exports four methods to the javascript layer that can register or unregister the observer.
type AgoraRawdataType = {
registerAudioFrameObserver(engineHandle: number): Promise<void>;
unregisterAudioFrameObserver(): Promise<void>;
registerVideoFrameObserver(engineHandle: number): Promise<void>;
unregisterVideoFrameObserver(): Promise<void>;
};
The plugin changes the color of the video stream by the default:
- Change local video to green
- Change remote video to pink
You can find the code at:
- Android: AgoraRawdataModule.kt
- Local video:
onCaptureVideoFrame
- Remote video:
onRenderVideoFrame
- Local video:
- iOS: AgoraRawdata.swift
- Local video:
onCapture
- Remote video:
onRenderVideoFrame
- Local video:
If you can program with C++, you should process raw data on the C++ layer to improve performance and remove code about calling Android and iOS.
You can find the code at:
- Android:
- Audio: AudioFrameObserver.cpp
- Video: VideoFrameObserver.cpp
- iOS:
- Audio: AgoraAudioFrameObserver.mm
- Video: AgoraVideoFrameObserver.mm
npm install react-native-agora-rawdata
You should fork this repository, and modify the code to implement your requirement, such as use third-party beauty SDK.
import AgoraRawdata from "react-native-agora-rawdata";
import RtcEngine from 'react-native-agora';
const agora = await RtcEngine.create(appId);
await AgoraRawdata.registerAudioFrameObserver(
await agora.getNativeHandle()
);
await AgoraRawdata.registerVideoFrameObserver(
await agora.getNativeHandle()
);
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT