well I will jump into code part since the header is the problem im facing and I couldnt find any better ways to describe it
function addIceCandidate(message) {
if (message.candidate != null) {
console.trace('add ice candidate');
var iceCandidate = new RTCIceCandidate(message.candidate);
pc1.addIceCandidate(iceCandidate);
}
}
is the function who tries to send ice candidate to the remote peer but in remote peer's chrome debugger it says
Uncaught TypeError: Cannot read property 'addIceCandidate' of undefined and
pc1.addIceCandidate(iceCandidate);
is the line where the error happens
But to my knowladge addIceCandidate
is a WebRTC function which is already defined.
so what am I doing wrong?
I have already gone through here , and for similar problems here, here and also here
and also for the full project Gist is here
Ty for helps in advance and please inform me if you need additional infomation