Skip to main content
Version: 2.x.x

Video Processor - React Native

A video processor is your own native code that changes each camera frame before it is sent. You register the processor under a name in your Android or iOS code, then apply it from JavaScript by that name.

For the full steps, see the Video Processor Android Setup and Video Processor iOS Setup guides.

setVideoProcessor()​

  • setVideoProcessor() applies the processor registered under name to your camera video. It is a method of useRoom().
  • Call it after join(). Before that, no room exists and the call rejects.
  • It rejects with ERROR_INVALID_PARAMETER (3073) when no processor is registered under name.
  • Applying a processor replaces the one that is already applied.
  • On Android, the processor stays applied after you leave, so your next room uses it too. Remove it before you leave if you do not want that.
  • While video effects run with pipeline: "GRAPH", the processor receives no frames.

Parameters​

  • name: String, the name you registered the processor under.

Returns​

  • Promise<void>

Example​

import { useRoom } from "@videosdk.live/react-native-sdk";

const { setVideoProcessor } = useRoom();

const applyProcessor = async () => {
try {
await setVideoProcessor("ProcessorName");
} catch (error) {
console.warn("Video processor:", error.code, error.message);
}
};

removeVideoProcessor()​

  • removeVideoProcessor() removes the processor that is applied. Calling it when no processor is applied does nothing.
  • It is a method of useRoom().
  • Like setVideoProcessor(), it rejects before join().

Returns​

  • Promise<void>

Example​

import { useRoom } from "@videosdk.live/react-native-sdk";

const { removeVideoProcessor } = useRoom();

const removeProcessor = async () => {
try {
await removeVideoProcessor();
} catch (error) {
console.warn("Video processor:", error.code, error.message);
}
};

VideoProcessorRegistry (Android)​

VideoProcessorRegistry from live.videosdk.rncore holds your processors by name. Use it from your app's native Android code, for example in a native module that your app calls once when it starts.

  • VideoProcessorRegistry.register(name, processor) registers processor under name. The processor implements VideoFrameProcessor from live.videosdk.rtc.android.listeners. Registering another processor under the same name replaces the first one.
  • VideoProcessorRegistry.unregister(name) removes the processor registered under name.

The Video Processor Android Setup guide shows the processor class and the native module in Kotlin and Java.


VideoProcessorRegistry (iOS)​

VideoProcessorRegistry from the VideoSDKReactNative module holds your processors by name on iOS. Use it from your app's own Swift code, for example in a native module that your app calls once when it starts.

  • VideoProcessorRegistry.shared.register(name:processor:) registers processor under name. The processor conforms to VideoSDKVideoProcessor from VideoSDKRTC. Registering another processor under the same name replaces the first one.
  • VideoProcessorRegistry.shared.unregister(name:) removes the processor registered under name.

The Video Processor iOS Setup guide shows the processor class and the native module in Swift.

Got a Question? Ask us on discord