Search code examples
ionic-frameworkwebrtcpeerjs

Why the event on stream is not fired with peerjs and with cordova-plugin-iosrtc when i receive a call?


i 'm working with peerjs and iosrtc plugin and i have got a problem on reception with ios, this method is never fired.

call.on('stream', (stream) => {
document.getElementById('camera').srcObject = stream;
});

And this event neither:

call.peerConnection.addEventListener('addstream', (e: any) => {
document.getElementById('camera').srcObject = e.stream;
});

And to finish as i've read on other post, this method doesn't exist anymore today

call.peerConnection.onaddstream = function (stream) { // do something with stream }.

Someone find the solution ?


Solution

  • I did a lot of testing to try and figure out the problem with various recommendations and help. I created a project from scratch to reproduce the problem. But when I finished, the POC, the project is running and I couldn't reproduce the problem.

    Finally after looking everywhere, I noticed that the plugin version was different. my poc used 6.0.20 and my project 6.0.18. So I changed the version and now the event is triggered when I get a call.

    For information, I share the POC if it can help anyone. https://github.com/iometrine/ionic-iosrtc-peerjs