FirebaseRTC
FirebaseRTC copied to clipboard
bug on the sample code
the sample code
roomRef.onSnapshot(async snapshot -> {
console.log('Got updated room:', snapshot.data());
const data = snapshot.data();
if (!peerConnection.currentRemoteDescription && data.answer) {
console.log('Set remote description: ', data.answer);
const answer = new RTCSessionDescription(data.answer)
await peerConnection.setRemoteDescription(answer);
}
});
should use => instead of ->
on this page: https://webrtc.org/getting-started/firebase-rtc-codelab
another bug on sample code
const roomRef = await db.collection('rooms').add(roomWithOffer);
const roomId = roomRef.id;
Need to turn const roomId into a global variable roomId
Otherwise, in the state of no callee, the caller execution hangup will not delete the room on firestore, because the roomId is null.