ere is my code make changes and fix according to above code
const banubaClientToken =
“Qk5CIB/iJPOUGRYK6NphqGCSEynvb00pE1nqJ9J06oN+uANFR03raxwoinPFox8jDCuHdrM1aSR1GFf8vGAM7adbMhTgONRmJgwjCnoljfHFvO6x+DdUEoDeR9H5odtTBR6oOyFOp8wvy/+cYZTpTDO1lDQsBfw58EnaVVsbfvzRZcSUODStwPc733bNFFn0Zf+r34VvWWMjmelSNtKyHNaDgQsDuv31AVwoq/4NVBqQUooim6eVTjGR5Crnd4DCuRcSmfrpow4dWODsZJWd2k7iIbzjylwUIYsRQpcG8o0urgzKTc40J1IhzA3j2UwZ31dJSlAfwHPDGo0/DvAVNMaHKaQ17fneP26pyogEM3fqxpskjo+1YoqO/3tUOF9drOSiW4Ttqfm9+TJkgbqOiI/Yl+pdAezTUOj6FNDb4uX1MqTQOJCfbudXx28Xo1gB/49ALcUBqlPPID/2/fszaKB73u6nkwniAR5U911IOxfQUafLzKG9IwSTlnVLXWfAVC/liTkrJ21XRu27TilWk9XWkEQx2hnwKueUVcNp0rxmiTlMIRFAoYZl2by7zSOfQo2SlYUhOtWKb+7jd0OHdWv76qFvrtbHPA3Gop6TG0g7Xq9/NL5kBfqKkXePD+a8EeLx5rAYYv/yJxfntsnh9A==”;
const appId = “6f77bbc9e67d4ae586e2d4c57382d880”;
export const BNBKeyVendorName = “Banuba”;
export const BNBKeyExtensionName = “BanubaFilter”;
export const BNBKeyLoadEffect = “load_effect”;
export const BNBKeyUnloadEffect = “unload_effect”;
export const BNBKeySetBanubaLicenseToken =
Platform.OS === “android” ? “initialize” : banubaClientToken;
export const BNBKeySetEffectsPath = “…/…/effects”;
export const BNBKeyEvalJSMethod = “eval_js”;
export const banubaLicenseToken = banubaClientToken;
const init = async () => {
try {
console.log(“Initializing RTC engine…”);
rtcEngine.current = createAgoraRtcEngine();
console.log(“RTC Engine instance:”, rtcEngine);
if (!rtcEngine.current) {
throw new Error("Failed to create the RTC Engine instance.");
}
rtcEngine.current.initialize({
appId: appId,
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
rtcEngine.current.registerEventHandler({
onError: (err, msg) => {
console.error(Error: ${msg}, err);
},
onJoinChannelSuccess: (connection, elapsed) => {
console.log("Join channel success", connection, elapsed);
setLocalUid(connection.localUid);
const response = rtcEngine.current.setExtensionProperty(
BNBKeyVendorName,
BNBKeyExtensionName,
BNBKeyLoadEffect,
"Glasses",
);
console.log("Banuba load effect response:", response);
setJoinChannelSuccess(true);
},
onLeaveChannel: (connection, stats) => {
console.log("Leave channel", connection, stats);
rtcEngine.current.setExtensionProperty(
BNBKeyVendorName,
BNBKeyExtensionName,
BNBKeyUnloadEffect,
"Glasses",
);
setJoinChannelSuccess(false);
},
onUserJoined: (connection, remoteUid, elapsed) => {
console.log("User joined", connection, remoteUid, elapsed);
setRemoteUsers((prevUsers) => [...prevUsers, remoteUid]);
},
onUserOffline: (connection, remoteUid, reason) => {
console.log("User offline", connection, remoteUid, reason);
setRemoteUsers((prevUsers) =>
prevUsers.filter((uid) => uid !== remoteUid),
);
},
onLocalVideoStateChanged: (source, state, error) => {
console.log("Local video state changed", source, state, error);
},
});
if (Platform.OS === "android") {
rtcEngine.current.loadExtensionProvider("banuba-plugin");
console.log("Banuba plugin loaded for Android");
}
const response2 = rtcEngine.current.enableExtension(
BNBKeyVendorName,
BNBKeyExtensionName,
true,
);
console.log("Banuba enable extension response:", response2);
const response3 = await rtcEngine.current.setExtensionProperty(
BNBKeyVendorName,
BNBKeyExtensionName,
BNBKeySetBanubaLicenseToken,
banubaLicenseToken,
);
console.log("Banuba set license token response:", response3);
rtcEngine.current.enableVideo();
rtcEngine.current.startPreview();
setStartPreview(true);
} catch (error) {
console.error("Initialization error:", error);
}
};