Comments (30)
Oh... It was bad idea. I have some troubles with using PayPal. I'll try to workaround or reject.
Ah shit, sorry i had my own issue with paypal account, feel free to reject and i will send elsewhere, you can reach me here hthetiot at sylaps.com if you want to share privatly the paypal account to use.
from cordova-plugin-iosrtc.
Reached out to Apple through the dev program, basically they said "tough luck" on earpiece to speaker toggle for WKWebView.
So, we're having to work around it by suspending calls while the app is in the background and re-establish when the users brings it back.
Not ideal, really takes away from the experience.
from cordova-plugin-iosrtc.
While using ios-rtc plugin or just WKWebView's webrtc?
Both we test both mode and on ios <= 14.5 we use iosrtc when missing in webview.
from cordova-plugin-iosrtc.
Do you have audio playing all the time while app is in background? if not - it's expected behavior. iOs tend to suspend app sooner or later and you should use push notifications to wake up it for audio output (VoIP or PTT pushs)
from cordova-plugin-iosrtc.
Do you have audio playing all the time while app is in background? if not - it's expected behavior. iOs tend to suspend app sooner or later and you should use push notifications to wake up it for audio output (VoIP or PTT pushs)
Yes, a VoIP call in progress.
Like I mentioned, if I completely remove RTCAudioController from the plugin calls will continue normally when the app is placed in the background just by selecting the "Voice Over IP" background mode in XCode.
from cordova-plugin-iosrtc.
Are you sure have AVAudioSession activated? I had to disable audio session management completely in WebRTC library, but don't remember why exactly...
from cordova-plugin-iosrtc.
Are you sure have AVAudioSession activated? I had to disable audio session management completely in WebRTC library, but don't remember why exactly...
Did you retain speakerphone/earpiece toggle ability with the plugin?
from cordova-plugin-iosrtc.
yes, but I have a little bit complicated configuration - I'm using iosrtc only for realtime video calls (and it's not supported to use it in backgrounded mode), and my own native implementation for audio messages (since I have to use PTT Framework). And only audio messages can be played/recorded in background in my case.
But the main idea is audio session have to be activated and some audio should play, or iOs suspends app. And it's not possible to workaround it. This answer I got some time ago directly from one of Apple support engineers.
from cordova-plugin-iosrtc.
Maybe I should ask this ... has anyone been able to use the plugin with iOS 17.5 with a call staying up when placing the app in the background and be able to toggle earpiece/speaker in the foreground?
from cordova-plugin-iosrtc.
Well, looks like there's no way to use the plugin any longer if you want voip calls to continue in the background. Used to work fine. Not sure when or how this broke, assuming an iOS 17.5 bug. If I remove the plugin it does work, but no way to send audio to earpiece, even with a custom plugin that just changes AVAudioSession's route, does nothing.
With the plugin, calls (and all websockets) shut down in 5-15 seconds. Without the plugin (and no earpiece/speakerphone control) calls and websockets will stay up indefinitely in the background.
from cordova-plugin-iosrtc.
@bkervaski what do you mean by "If I remove the plugin it does work"? Do you mean you are switching to use WebRTC implementation from WebView?
from cordova-plugin-iosrtc.
@bkervaski what do you mean by "If I remove the plugin it does work"? Do you mean you are switching to use WebRTC implementation from WebView?
Yes, but no way to redirect audio to the earpiece using native WebRTC.
from cordova-plugin-iosrtc.
The reason is simple. WebView works in separate process. And obviously that process has it's own reference to AVAudioSession with it's own settings. And your app just doesn't have access to that AVAudioSession and can't do any changes to it.
from cordova-plugin-iosrtc.
So if you need extended AVAudioSession management - you have to use WebRTC implementation inside your app (with iosrtc or your own). It's also related to use PTT Framework and CallKit.
from cordova-plugin-iosrtc.
Do you have any minimal example with reproducible issue? For me it still looks like as not activated Audio Session or missing background mode.
from cordova-plugin-iosrtc.
Hello @bkervaski, did you send 100 USD to me for this issue via Paypal ? If so please 🙏 provide email so I can give it back or I can give it to another good cause or to @RSATom that is really helping you instead.
I don't have the bandwidth to tackle this issue right now and @RSATom is more knowledgeable. That why I can't accept your donation.
Harold.
from cordova-plugin-iosrtc.
@bkervaski you need to provide sample javascript to reproduce.
You can provide in this issue a modified version of this file if you don't know where to start:
https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/extra/renderer-and-libwebrtc-tests.js
from cordova-plugin-iosrtc.
Hello @bkervaski, did you send 100 USD to me for this issue via Paypal ? If so please 🙏 provide email so I can give it back or I can give it to another good cause or to @RSATom that is really helping you instead.
I don't have the bandwidth to tackle this issue right now and @RSATom is more knowledgeable. That why I can't accept your donation.
Harold.
I did. Please pay it forward to @RSATom if you like or I'll donate to him separately.
from cordova-plugin-iosrtc.
The issue appears to be that when using the plugin's WebRTC binaries, iOS will close WKWebView's JsSIP websocket after a few seconds, terminating the call.
Whereas, when using WKWebView's native WebRTC it will keep the websocket open, but no earpiece/speaker control.
Is there anyone pulling this off successfully?
@RSATom Thank you, I'm going to copy and strip the project down to just the plugin and JsSIP and post it for review. It's not a missing background mode.
from cordova-plugin-iosrtc.
@bkervaski I have an idea what is going on in your case.
First of all, as I said before, WebView always works in separate process (read separate application). And if take this into account, when you use iosrtc
, you have different parts of logic of your app spread across 2 separate processes (signalling part, and WebRTC Peer Connection part). And iOs manages state of that processes independently. And since WebView's process doesn't play any sound (and as consequence doesn't have activated Audio Session) - iOs have all reasons to to suspend that process on backgrounding. And no, it's not possible to have 2 separate processes with activated Audio Session at the same time (except mixWithOthers AVAudioSession option but it's totally different story).
So the only solution I see here - implement Cordova plugin with signalling part inside (I have this in my app). Then all parts will be in the same process and suspending WebView's process will not affect your logic.
Also, you should keep in mind, if app loses activation of AudioSession in backgrounded state - it's not possible to reactivate it again without foregrounding app by user. The only exception is - VoIP push notifications (+ CallKit) or PTT push notifications.
from cordova-plugin-iosrtc.
I did. Please pay it forward to @RSATom if you like or I'll donate to him separately.
@bkervaski Done, @RSATom you should have received a 100 USD paypal payment on your github public email.
Thank you @RSATom for helping the community as always.
from cordova-plugin-iosrtc.
Oh... It was bad idea. I have some troubles with using PayPal. I'll try to workaround or reject.
from cordova-plugin-iosrtc.
Yep, WKWebView is in separate process -> it has separate Audio Session -> there is no any control from your app over Audio Session in separate process...
from cordova-plugin-iosrtc.
Yep, WKWebView is in separate process -> it has separate Audio Session -> there is no any control from your app over Audio Session in separate process...
Right, and ios rtc gets suspended now, so no more phone calls in the background.
from cordova-plugin-iosrtc.
To make iosrtc works in background you need to add this plugin [email protected]
and add the folllowing code:
document.addEventListener('deviceready', function () {
if (cordova.plugins.backgroundMode) {
cordova.plugins.backgroundMode.enable();
}
}, false);
This can be tested using Sylaps on iOS https://apps.apple.com/us/app/sylaps/id954016392
Tested on iPhone and iPAd on, 17.5.1
, notice that video from the device will go black while application in background, but audio input and ouput keep working.
from cordova-plugin-iosrtc.
To make iosrtc works in background you need to add this plugin
[email protected]
and add the folllowing code:document.addEventListener('deviceready', function () { if (cordova.plugins.backgroundMode) { cordova.plugins.backgroundMode.enable(); } }, false);This can be tested using Sylaps on iOS https://apps.apple.com/us/app/sylaps/id954016392
Tested on iPhone and iPAd on,
17.5.1
, notice that video from the device will go black while application in background, but audio input and ouput keep working.
Thank you very much for posting, but I've tried this. When I use [email protected] event "activate" to call isActive(), it reports "true". Just before this, I get the cordova "pause" event. I would think this even wouldn't fire if background mode is active.
No matter what I do the WKWebView won't keep the JsSIP websocket registration alive. My SIP server (Asterisk) just reports the connection closed a few seconds with a "Connection reset by peer" error.
If a call is active, I'll get the websocket closed error in the javascript console. If not, when I resume the app, the javascript console reports the websocket errors.
The only thing the debugger reports is a two "0x109024d40 - ProcessThrottlerTimedActivity::activityTimedOut" just before and after the app is paused and then a series of "Invalidating grant <invalid NS/CF object> failed" which may or may not be related.
Edit: Oddly, and to reiterate, if I don't use ios rtc, the JsSIP websocket does stay active in the background while on a call. Of course, no speaker/earpiece toggle without the plugin.
from cordova-plugin-iosrtc.
I'm sorry but I disagree with your test result, Websocket stay alive using JSSip and freeswitch as server or P2P in my tests via Sylaps app (I'm the owner of it).
If not using iosrtc work for you then I guess you have your solution, iosrtc is becoming less relevant this days with built-in webrtc from WkWebview anyway.
from cordova-plugin-iosrtc.
Note: iosrtc does not modify websocket behavior.
from cordova-plugin-iosrtc.
I'm not suggestion that ios-rtc changes websocket behavior, I'm suggestion WKWebView will keep the sockets open when there is an active call initiated with native WebRTC.
I agree that the plugin is less relevant, however, I can find no way to toggle earpiece/speaker with WKWebView so I've been holding on to the plugin for this purpose only.
Thank you for your help.
from cordova-plugin-iosrtc.
Websocket stay alive using JSSip and freeswitch as server or P2P in my tests via Sylaps app (I'm the owner of it).
While using ios-rtc plugin or just WKWebView's webrtc?
from cordova-plugin-iosrtc.
Related Issues (20)
- Implementing Mediapipe Pose on ionic IOs using iosRTC HOT 1
- Add flashlight control HOT 4
- Add video border radius support HOT 1
- Enable/Disable track from Receiver/Sender is broken in case of use with Janus Videoroom HOT 5
- Getting error in connecting ios device microphone and video in openvidu ionic HOT 5
- RTCRtpSender not have DTMF properties and createDTMFSender deprecate HOT 4
- PrecompileSwiftBridgingHeader fails after first successful build ('WebRTC/RTCAudioSource.h' file not found) HOT 9
- Pretty bad H264 performance after upgrading to iOS 15.4 HOT 24
- blank screen issue HOT 2
- HTML element over video HOT 1
- Own audio shut down during video conference HOT 5
- App failing to build because of the plugin HOT 4
- navigator.mediaDevices is undefined HOT 2
- cordova iosrtc app crash on iphone device - 'NSInternalInconsistencyException', HOT 12
- Twilio VideoJs adaptive simulcast undefined error, because of missing width and height properties from MediaTrackSettings HOT 6
- Call canceled when callee pickup the phone. HOT 3
- Bug: Can't install plugin on latest cordova/xcode HOT 3
- Build Failed HOT 8
- PluginMediaStreamRenderer.mediaStreamChanged() has multithreading race condition
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-iosrtc.