【问题标题】:React native Agora 3.5.0 TypeError: _reactNativeAgora.RtcEngineContext is not a constructorReact native Agora 3.5.0 TypeError: _reactNativeAgora.RtcEngineContext 不是构造函数
【发布时间】:2021-12-31 20:08:01
【问题描述】:

我将我们的 apss agora 版本更新为 3.5.0,因为它无法在 ios 15 上运行。现在它可以在 ios 15 上运行,但不能在 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

【问题讨论】:

    标签: react-native agora.io


    【解决方案1】:

    您正在使用UNSAFE_componentWillMount,这可能会导致问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-14
      • 2022-08-23
      • 2018-06-27
      • 2016-04-16
      相关资源
      最近更新 更多