每当我运行此代码时,我都会收到存在房间的错误:false, 在firebase数据库中创建了room,但是,当我在服务器上运行它时,仍然在控制台上看到一个错误,指出房间存在:false
function joinRoom() {
document.querySelector('#createBtn').disabled = true;
document.querySelector('#joinBtn').disabled = true;
document.querySelector('#confirmJoinBtn').
addEventListener('click', async () => {
roomId = document.querySelector('#room-id').value;
console.log('Join room: ', roomId);
document.querySelector(
'#currentRoom').innerText = `Current room is ${roomId} - You are the callee!`;
await joinRoomById(roomId);
}, {once: true});
roomDialog.open();
}
async function joinRoomById(roomId) {
const db = firebase.firestore();
const roomRef = db.collection('rooms').doc(`${roomId}`);
const roomSnapshot = await roomRef.get();
console.log('Got room:', roomSnapshot);
console.log('Got room:', roomSnapshot.exists);
if (roomSnapshot.exists) {
console.log('Create PeerConnection with configuration: ', configuration);
peerConnection = new RTCPeerConnection(configuration);
registerPeerConnectionListeners();
localStream.getTracks().forEach(track => {
peerConnection.addTrack(track, localStream);
});
}