我将我们的apss-agora版本更新到3.5.0,因为它在ios 15上不起作用。nwo它适用于ios15,但不适用于android。
代码正是从这个开始的
https://github.com/AgoraIO-Community/react-native-agora/blob/master/example/src/examples/basic/JoinChannelVideo/JoinChannelVideo.tsx
UNSAFE_componentWillMount() {
this._initEngine();
}
componentWillUnmount() {
this._engine?.destroy();
}
_initEngine = async () => {
this._engine = await RtcEngine.createWithContext(
new RtcEngineContext(config.appId)
);
this._addListeners();
await this._engine.enableVideo();
await this._engine.startPreview();
await this._engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
await this._engine.setClientRole(ClientRole.Broadcaster);
};
上面写着
TypeError: _reactNativeAgora.RtcEngineContext is not a constructor
您使用的UNSAFE_componentWillMount
可能会导致问题。