使用react-native-webrtc在expo go上出现错误“无法读取null的属性'senderGetCapability',js引擎:hermes”

问题描述 投票:0回答:1

当我导入此报表时

import {
  RTCPeerConnection,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView,
  MediaStream,
  MediaStreamTrack,
  mediaDevices,
  registerGlobals
} from 'react-native-webrtc';

这个错误出现在我的expo Go中(在android手机中):

错误类型错误:无法读取 null 属性“senderGetCapability”, js 引擎:hermes 错误不变违规:“main”尚未被 挂号的。如果出现以下情况,就会发生这种情况:

  • Metro(本地开发服务器)从错误的文件夹运行。检查Metro是否正在运行,停止它并在当前项目中重新启动它。
  • 模块由于错误而无法加载,并且`AppRegistry.registerCompon ent未被调用。,js引擎:hermes
"dependencies": {
    "@config-plugins/react-native-webrtc": "^7.0.0",
    "@expo-google-fonts/dev": "^0.2.3",
    "@expo-google-fonts/heebo": "^0.2.3",
    "@expo-google-fonts/inter": "^0.2.3",
    "@expo-google-fonts/kanit": "^0.2.3",
    "@expo-google-fonts/merriweather-sans": "^0.2.3",
    "@expo-google-fonts/open-sans": "^0.2.3",
    "@expo-google-fonts/patua-one": "^0.2.3",
    "@expo-google-fonts/roboto": "^0.2.3",
    "@expo-google-fonts/roboto-slab": "^0.2.3",
    "@expo-google-fonts/rubik": "^0.2.3",
    "@expo/webpack-config": "^19.0.0",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "expo": "~49.0.8",
    "expo-camera": "^13.4.3",
    "expo-dev-client": "~2.4.8",
    "expo-splash-screen": "^0.20.5",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.72.4",
    "react-native-dotenv": "^3.4.9",
    "react-native-vector-icons": "^10.0.0",
    "react-native-web": "~0.19.6",
    "react-native-webrtc": "^111.0.3",
    "socket.io-client": "^4.7.2",
    "validator": "^13.11.0"
  }

平台信息:

React Native 版本:“0.72.4”

WebRTC 模块版本:“^111.0.3”

平台操作系统+版本:windows:10

世博会Go:2.29.6

铬:116.0.5845.141

但是如果我不导入

react-native-webrtc
那么它就会顺利运行。 我需要创建使用
webrtc
的功能,我该如何解决这个问题?

react-native webrtc expo-go react-native-webrtc
1个回答
0
投票

react-native-webrtc 是本机代码,如果您想在 Expo 上使用它,您必须按照此文档使用开发版本https://docs.expo.dev/develop/development-builds/create-a-build/
并像这样在 app.json 文件中添加权限

© www.soinside.com 2019 - 2024. All rights reserved.