3

我创建了一个视频聊天会议会话,并且能够通过 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)

这是我的测试代码的另一个视图

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-native-connectycube 3.0.1

4

1 回答 1

2

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

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

于 2020-05-03T12:10:08.460 回答