WebsiteBeaver / CordovaCall

Cordova CallKit & ConnectionService plugin for iOS/Android that displays the native call UI for VOIP apps
MIT License
196 stars 91 forks source link

How to use this plugin with peerjs #86

Open mickytroxxy opened 4 years ago

mickytroxxy commented 4 years ago

Im calling my real device from my laptop using peerjs. on.call function i use cordavaCall plugin on my device and my phone can ring well and i can answer the incoming call. How do i pass the stream to cordovaCall plugin so that i can hear or see the remote video? Right now i can't hear anything and i believe this is because im not passing the remote media stream. How do i pass it please. I use peerjs.

mickytroxxy commented 4 years ago

does this work when i call from pc then use this plugin on my real device to answer calls?

Bobisback commented 4 years ago

I was using peerjs at first as well, but found it did not work correctly for ios. So switched to iosrtc combined with my own implementation of peerjs. Aka I basically wrote my own version of peerjs. This was like 1-2years ago though so things might have changed with peerjs.

mehthaf commented 4 years ago

Im calling my real device from my laptop using peerjs. on.call function i use cordavaCall plugin on my device and my phone can ring well and i can answer the incoming call. How do i pass the stream to cordovaCall plugin so that i can hear or see the remote video? Right now i can't hear anything and i believe this is because im not passing the remote media stream. How do i pass it please. I use peerjs.

kindly share your code with us how to implement cordova call with peerjs

mattkhaw commented 4 years ago

@mickytroxxy @mehthaf Ok, I know this issue is from 2019, but still, I'm gonna put in my 2 cents on this.

Direct replying to the issue where you can't see or hear the stream from remote, you just can't pass the stream into CordovaCall plugin. It just doesn't work that way. That's what peerjs is for. Peerjs handles the data exchange and the signals for video call.

What you need to do is, when the receiver receives the call event, just call receiveCall to display the UI first. If the receiver answers the call, then just answer the call. Of course, before you do that, you have to hook the stream event first, so that you can actually display the stream.

On caller side, it is pretty straightforward. Just call sendCall to lock your phone so that it is actually calling, then hook the stream event first before actually using peerjs call method.

I do believe this is the entire workflow on exactly how video call should be. I won't go further since I didn't use peerjs to do this but the basic idea is exactly the same. Hope it helps.

danielehrhardt commented 4 years ago

You say "Just call sendCall" but how to call the function when the App is closed? Over a Push?

I am very interested in this call Solution here. Does anyone want to share his code? I am also open to pay something.

Send me a Message (WhatsApp or So) +4915161018772

Bobisback commented 4 years ago

So the latest version of ios broke cordovacall with push notifications. Basically to get this to work with voip push notifications, this plugin had to be combined with the cordova voip push plugin. There is a huge thread about it I started. Someone combined the two plugins to get it to work with ios 13. He code is in that conversation.

mattkhaw commented 4 years ago

@danielehrhardt The sendCall function is just to lock the caller's phone from making another call. Basically, putting the caller's phone in engaged state. If not mistaken, CordovaCall doesn't have a UI for this. You need to create this on your own.

As for app's closed state, this have to be done using Background Notifications for Android and PushKit for iOS. As @Bobisback stated, for iOS, there's no way around it other than modifying the current plugin to include PushKit functionality. As for Android, no modifications to the plugin is required.