react-native-webrtc 无法创建 RTCPeerConnection

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

我正在尝试使用react-native-webrtc创建一个基本的RN应用程序,但我无法创建RTCPeerConnection类实例。

import {RTCPeerConnection} from 'react-native-webrtc';

const App: () => React$Node = () => {
   const configuration = { "iceServers": [{ "url": "stun:stun.l.google.com:19302" }] };
   const pc = new RTCPeerConnection(configuration);
   ...
   return(<>)
}

出现错误:

无法创建 RTCPeerConnection 类实例的原因可能是什么?所有依赖项均已安装。

react-native webrtc peer-connection
1个回答
0
投票

注意,{ "url": ... } 已弃用,您应该使用 { "urls": ... } 代替。

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