I am working a project of Video Calling using React Native Agora library. But when I run application I face this error "typeErro: undefined is not object ReactNativeAgora RtcEngine.init(config)
RN version: 0.62.2 react-native-agora": "^3.2.2
my Code is
import { View, StyleSheet, NativeModules, Platform } from 'react-native';
import { RtcEngine, AgoraView } from 'react-native-agora';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { Actions } from 'react-native-router-flux';
import { configureFonts } from 'react-native-paper';
const Agora = NativeModules; //Define Agora object as a native module
const {
FPS30,
AudioProfileDefault,
AudioScenarioDefault,
Adaptative,
} = Agora; //Set defaults for Stream
class Video extends Component {
constructor(props) {
super(props);
this.state = {
peerIds: [], //Array for storing connected peers
uid: Math.floor(Math.random() * 100),
appid: this.props.AppID,
channelName: this.props.ChannelName,
vidMute: false,
audMute: false,
joinSucceed: false,
};
if (Platform.OS === 'android') {
const Config = {
appid: this.state.appid,
channelProfile: 0,
mode: 1,
videoEncoderConfig: {
width: 720,
height: 1080,
bitrate: 1,
frameRate: FPS30,
orientationMode: Adaptative,
},
audioProfile: AudioProfileDefault,
audioScenario: AudioScenarioDefault,
};
RtcEngine //Initialize the RTC engine
}
}```
Have a try by running again project by npx react-native run-android command.
If you are using the iOS Device then:
if still not works try installing the npm package again and follow the documentation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.