peerjs
peerjs copied to clipboard
[SOLVED] call.on('stream') never triggered
Hello, I am writing a video calling application with ionic 4. I start a search but the stream never returns. My image and voice go to the other side. Android is ok, but I have this situation in iOS. I use iosrtc.
` const call = this.peer.call(partnerId, this.localStream);
call.on('stream', (stream) => {
// never comes
this.loadingElement.classList.add('hidden');
this.remoteElement.classList.remove('hidden');
this.remoteElement.srcObject = stream;
});
`
fighting with the same issue on iOS. As far it looks like peerConnection.ontrack in PeerJS is the issue. Have a look at https://github.com/Zemke/react-native-peerjs. He changed .ontrack to .onaddstream
My solution is as follows:
call.peerConnection.addEventListener('addstream', (e: any) => {
console.log(e.stream);
});