gpt4 book ai didi

react-native - 无法读取未定义的属性 'getUserMedia' [React Native]

转载 作者:行者123 更新时间:2023-12-04 15:29:23 24 4
gpt4 key购买 nike

我创建了一个 videochatconference session ,可以通过 ID 进入聊天室并查看参与者。但是,当我尝试使用 getUserMedia 获取本地用户流时,它返回未定义函数的错误

this._session = ConnectyCube.videochatconference.createNewSession();
this._session.getUserMedia({
audio: true,
video: { facingMode: 'user' }
})
.then(localStream => {
console.log(localStream);
})
.catch((error) => {
console.log(error);
});

this._session.join('xxxxxxxxxx', userCredentials.id, userCredentials.login)

这是我的测试代码的另一个 View

const env = Configs.connectyCube;
const { credentials, config } = env;
let userCredentials = {
id: 123,
login: 'xxxxxx',
password: '*****',
};
ConnectyCube.init(credentials, config);
ConnectyCube.createSession(userCredentials)
.then(session => {
ConnectyCube.chat.connect({
userId: userCredentials.id,
password: userCredentials.password
});

ConnectyCube.login(userCredentials)
.then((user) => {
console.log(user);
const opponentsIds = users.filter(opponent => opponent.id !== userCredentials.id);
.map(opponent => opponent.id);
console.log(opponentsIds);
this._session = ConnectyCube.videochatconference.createNewSession();
this._session.getUserMedia({
audio: true,
video: { facingMode: 'user' }
})
.then(localStream => {
console.log(localStream);
})
.catch((error) => {
console.log(error);
})
})
.catch((error) => {
console.log(error);
});
}).catch(error => {
console.log(error);
});

使用: react native 0.62.2 react 原生 connectycube 3.0.1

最佳答案

ConnectyCube 文档中提到必须安装 react-native-webrtc。

请检查以下内容: https://developers.connectycube.com/reactnative/videocalling-conference

关于react-native - 无法读取未定义的属性 'getUserMedia' [React Native],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61574173/

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