gpt4 book ai didi

react-native - 如何在 react-native-webrtc 中使用 simple-peer

转载 作者:行者123 更新时间:2023-12-03 14:52:43 33 4
gpt4 key购买 nike

我正在尝试在简单对等方的构造函数中使用 react-native-webrtc

import wrtc from 'react-native-webrtc';

const peer = new SimplePeer({initiator: true, wrtc: wrtc});

我得到的错误是
ExceptionsManager.js:179 Error: No WebRTC support: Not a supported browser

最佳答案

你必须像这样导入它


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

const peer = new SimplePeer(
{initiator: true,
wrtc: {
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
RTCView,
MediaStream,
MediaStreamTrack,
mediaDevices,
registerGlobals
},
});

关于react-native - 如何在 react-native-webrtc 中使用 simple-peer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63997590/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com