I am able to make the initial connection between two devices, but after ending the first call, I am unable to re-connect. I get the following error:
Error: Possible Unhandled Promise Rejection (id: 9): "peerConnection is null"
My code:
const pc_config = {
"iceServers": [{
url: 'stun:stun.l.google.com:19302'}]
};
this.localPC = new RTCPeerConnection(pc_config);
// this function call after end call
endCall = () => {
console.log(this.socket.id, " reciver ===== caller ", this.reciverid);
this.socket.emit('callend', {
socketID: this.reciverid});
this.state.allUser.map((item) => {
if (this.socket.id == item.socket_id) {
Toast.show("Call end by " + item.name);}
})
this.localPC.close();
}