No sound after connecting to WebRTC when app is launched in background using PushKit and CallKit on the lock screenCallKit:No sound when I use WebRTCiOS push notification: how to detect if the user tapped on notification when the app is in background?iOS kills CallKit VoIP app working in background in one minutevoip push notification doesn't work on ios 10 when lock screeniOS Audio not working during call answered when phone is locked. WebRTC used for callingSinch: How to dismiss Apple CallKit UI from the callee's lock screenCallKit can reactivate sound after swapping calliOS Microphone not working or not sending the voice through webrtc when the call is answered from locked screeniOS 8 - show incoming call when app is not active (without CallKit)Open application when click on app icon in CallKitShow custom UI after answer call from lock screen
How do German speakers decide what should be on the left side of the verb?
Putting future professor position on CV
Passport - tiny rip on the edge of my passport page
After a few interviews, What should I do after told to wait?
Compiler optimization of bitwise not operation
What quests do you need to stop at before you make an enemy of a faction for each faction?
Fantasy Military Arms and Armor: the Dwarven Grand Armory
How to interpret or parse this confusing 'NOT' and 'AND' legal clause
First Number to Contain Each Letter
Where on Earth is it easiest to survive in the wilderness?
I multiply the source, you (probably) multiply the output!
How do I make my fill-in-the-blank exercise more obvious?
Do aarakocra have arms as well as wings?
Can taking my 1-week-old on a 6-7 hours journey in the car lead to medical complications?
How to best explain that you are taking pictures in a space for practice reasons?
Draw the ☣ (Biohazard Symbol)
Template default argument loses its reference type
Owner keeps cutting corners and poaching workers for his other company
Did the US Climate Reference Network Show No New Warming Since 2005 in the US?
Did the Byzantines ever attempt to move their capital to Rome?
Is every sentence we write or utter either true or false?
1kV DC Circuit - Insulation on ground wire?
Was Rosie the Riveter sourced from a Michelangelo painting?
Why did Tony's Arc Reactor do this?
No sound after connecting to WebRTC when app is launched in background using PushKit and CallKit on the lock screen
CallKit:No sound when I use WebRTCiOS push notification: how to detect if the user tapped on notification when the app is in background?iOS kills CallKit VoIP app working in background in one minutevoip push notification doesn't work on ios 10 when lock screeniOS Audio not working during call answered when phone is locked. WebRTC used for callingSinch: How to dismiss Apple CallKit UI from the callee's lock screenCallKit can reactivate sound after swapping calliOS Microphone not working or not sending the voice through webrtc when the call is answered from locked screeniOS 8 - show incoming call when app is not active (without CallKit)Open application when click on app icon in CallKitShow custom UI after answer call from lock screen
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Everything works fine if we launch the app in the foreground. But there is an issue when the app is previously killed and is restarted by receiving a PushKit notification on the lock screen.
When the app receives a PushKit notification we display the CallKit UI. This works correctly. The user is able to answer the call and establish a connection via WebRTC. But there is no audio at all.
The strange thing is that if the user opens the app from CallKit screen by tapping on the application icon, the audio starts and works as expected. So it looks like the problem is with the audio session configuration. Maybe for some reason, iOS doesn't allow our audio session to be activated.
We're using Google's WebRTC library:
pod 'GoogleWebRTC', '1.1.26115'
We tried different approaches:
Enabling/disabling audio background mode.
Configuring audio session before and after the
didActivatecallback is received from CallKit delegate.Configuring audio session manually and using
RTCAudioSession.sharedInstancefrom WebRTC library.Enabling and disabling
RTCAudioSession.useManualAudio.
This is the scenario where we encounter the issue:
Kill the app. Lock the phone.
Call this user from another phone.
PushKit launches the app, the app presents CallKit screen, the user answers the call.
The connection establishes correctly. The call is active but there is no sound on both ends.
Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.
Any help is appreciated.
swift webrtc callkit pushkit ios-background-mode
add a comment |
Everything works fine if we launch the app in the foreground. But there is an issue when the app is previously killed and is restarted by receiving a PushKit notification on the lock screen.
When the app receives a PushKit notification we display the CallKit UI. This works correctly. The user is able to answer the call and establish a connection via WebRTC. But there is no audio at all.
The strange thing is that if the user opens the app from CallKit screen by tapping on the application icon, the audio starts and works as expected. So it looks like the problem is with the audio session configuration. Maybe for some reason, iOS doesn't allow our audio session to be activated.
We're using Google's WebRTC library:
pod 'GoogleWebRTC', '1.1.26115'
We tried different approaches:
Enabling/disabling audio background mode.
Configuring audio session before and after the
didActivatecallback is received from CallKit delegate.Configuring audio session manually and using
RTCAudioSession.sharedInstancefrom WebRTC library.Enabling and disabling
RTCAudioSession.useManualAudio.
This is the scenario where we encounter the issue:
Kill the app. Lock the phone.
Call this user from another phone.
PushKit launches the app, the app presents CallKit screen, the user answers the call.
The connection establishes correctly. The call is active but there is no sound on both ends.
Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.
Any help is appreciated.
swift webrtc callkit pushkit ios-background-mode
Have you tried to configure the audio session before callingreportNewIncomingCall(with:update:completion:)?
– Marco
Mar 28 at 14:52
Probably this same issue as below: stackoverflow.com/questions/48070163/… Please check my answer
– Gregios
Apr 21 at 9:05
Did you solve it? Have exectly the same problem and tried a all this ways, but it doesn't help.
– WorieN
Jul 22 at 12:52
add a comment |
Everything works fine if we launch the app in the foreground. But there is an issue when the app is previously killed and is restarted by receiving a PushKit notification on the lock screen.
When the app receives a PushKit notification we display the CallKit UI. This works correctly. The user is able to answer the call and establish a connection via WebRTC. But there is no audio at all.
The strange thing is that if the user opens the app from CallKit screen by tapping on the application icon, the audio starts and works as expected. So it looks like the problem is with the audio session configuration. Maybe for some reason, iOS doesn't allow our audio session to be activated.
We're using Google's WebRTC library:
pod 'GoogleWebRTC', '1.1.26115'
We tried different approaches:
Enabling/disabling audio background mode.
Configuring audio session before and after the
didActivatecallback is received from CallKit delegate.Configuring audio session manually and using
RTCAudioSession.sharedInstancefrom WebRTC library.Enabling and disabling
RTCAudioSession.useManualAudio.
This is the scenario where we encounter the issue:
Kill the app. Lock the phone.
Call this user from another phone.
PushKit launches the app, the app presents CallKit screen, the user answers the call.
The connection establishes correctly. The call is active but there is no sound on both ends.
Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.
Any help is appreciated.
swift webrtc callkit pushkit ios-background-mode
Everything works fine if we launch the app in the foreground. But there is an issue when the app is previously killed and is restarted by receiving a PushKit notification on the lock screen.
When the app receives a PushKit notification we display the CallKit UI. This works correctly. The user is able to answer the call and establish a connection via WebRTC. But there is no audio at all.
The strange thing is that if the user opens the app from CallKit screen by tapping on the application icon, the audio starts and works as expected. So it looks like the problem is with the audio session configuration. Maybe for some reason, iOS doesn't allow our audio session to be activated.
We're using Google's WebRTC library:
pod 'GoogleWebRTC', '1.1.26115'
We tried different approaches:
Enabling/disabling audio background mode.
Configuring audio session before and after the
didActivatecallback is received from CallKit delegate.Configuring audio session manually and using
RTCAudioSession.sharedInstancefrom WebRTC library.Enabling and disabling
RTCAudioSession.useManualAudio.
This is the scenario where we encounter the issue:
Kill the app. Lock the phone.
Call this user from another phone.
PushKit launches the app, the app presents CallKit screen, the user answers the call.
The connection establishes correctly. The call is active but there is no sound on both ends.
Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.
Any help is appreciated.
swift webrtc callkit pushkit ios-background-mode
swift webrtc callkit pushkit ios-background-mode
asked Mar 28 at 5:59
sidslogsidslog
5401 gold badge4 silver badges14 bronze badges
5401 gold badge4 silver badges14 bronze badges
Have you tried to configure the audio session before callingreportNewIncomingCall(with:update:completion:)?
– Marco
Mar 28 at 14:52
Probably this same issue as below: stackoverflow.com/questions/48070163/… Please check my answer
– Gregios
Apr 21 at 9:05
Did you solve it? Have exectly the same problem and tried a all this ways, but it doesn't help.
– WorieN
Jul 22 at 12:52
add a comment |
Have you tried to configure the audio session before callingreportNewIncomingCall(with:update:completion:)?
– Marco
Mar 28 at 14:52
Probably this same issue as below: stackoverflow.com/questions/48070163/… Please check my answer
– Gregios
Apr 21 at 9:05
Did you solve it? Have exectly the same problem and tried a all this ways, but it doesn't help.
– WorieN
Jul 22 at 12:52
Have you tried to configure the audio session before calling
reportNewIncomingCall(with:update:completion:)?– Marco
Mar 28 at 14:52
Have you tried to configure the audio session before calling
reportNewIncomingCall(with:update:completion:)?– Marco
Mar 28 at 14:52
Probably this same issue as below: stackoverflow.com/questions/48070163/… Please check my answer
– Gregios
Apr 21 at 9:05
Probably this same issue as below: stackoverflow.com/questions/48070163/… Please check my answer
– Gregios
Apr 21 at 9:05
Did you solve it? Have exectly the same problem and tried a all this ways, but it doesn't help.
– WorieN
Jul 22 at 12:52
Did you solve it? Have exectly the same problem and tried a all this ways, but it doesn't help.
– WorieN
Jul 22 at 12:52
add a comment |
1 Answer
1
active
oldest
votes
There is a specific issue with the audio I/O and CallKit. When you are about to receive an incoming call, you must configure audio session for VoIP calls then, but do not activate it, just set category, mode and buffer.
Example for configuring Audio Session for CallKit incoming call:
func configureAudioSession()
let sharedSession = AVAudioSession.sharedInstance()
do
try sharedSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try sharedSession.setMode(AVAudioSessionModeVoiceChat)
try sharedSession.setPreferredIOBufferDuration(TimeInterval(0.005))
try sharedSession.setPreferredSampleRate(44100.0)
catch
debugPrint("Failed to configure `AVAudioSession`")
Then, when you answer the incoming Call, CallKit will activate the audio session for you, and you will receive a callback from CXProvider:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession)
// Start call audio I/O here
In that delegate callback, you should start your call audio, not before. If WebRTC call audio I/O was started before, the CallKit will terminate it and there will be no sound.
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
I belive thatfunc provider(_ provider: didActivate:)audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call
– Miki
Jul 23 at 13:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391026%2fno-sound-after-connecting-to-webrtc-when-app-is-launched-in-background-using-pus%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is a specific issue with the audio I/O and CallKit. When you are about to receive an incoming call, you must configure audio session for VoIP calls then, but do not activate it, just set category, mode and buffer.
Example for configuring Audio Session for CallKit incoming call:
func configureAudioSession()
let sharedSession = AVAudioSession.sharedInstance()
do
try sharedSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try sharedSession.setMode(AVAudioSessionModeVoiceChat)
try sharedSession.setPreferredIOBufferDuration(TimeInterval(0.005))
try sharedSession.setPreferredSampleRate(44100.0)
catch
debugPrint("Failed to configure `AVAudioSession`")
Then, when you answer the incoming Call, CallKit will activate the audio session for you, and you will receive a callback from CXProvider:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession)
// Start call audio I/O here
In that delegate callback, you should start your call audio, not before. If WebRTC call audio I/O was started before, the CallKit will terminate it and there will be no sound.
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
I belive thatfunc provider(_ provider: didActivate:)audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call
– Miki
Jul 23 at 13:06
add a comment |
There is a specific issue with the audio I/O and CallKit. When you are about to receive an incoming call, you must configure audio session for VoIP calls then, but do not activate it, just set category, mode and buffer.
Example for configuring Audio Session for CallKit incoming call:
func configureAudioSession()
let sharedSession = AVAudioSession.sharedInstance()
do
try sharedSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try sharedSession.setMode(AVAudioSessionModeVoiceChat)
try sharedSession.setPreferredIOBufferDuration(TimeInterval(0.005))
try sharedSession.setPreferredSampleRate(44100.0)
catch
debugPrint("Failed to configure `AVAudioSession`")
Then, when you answer the incoming Call, CallKit will activate the audio session for you, and you will receive a callback from CXProvider:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession)
// Start call audio I/O here
In that delegate callback, you should start your call audio, not before. If WebRTC call audio I/O was started before, the CallKit will terminate it and there will be no sound.
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
I belive thatfunc provider(_ provider: didActivate:)audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call
– Miki
Jul 23 at 13:06
add a comment |
There is a specific issue with the audio I/O and CallKit. When you are about to receive an incoming call, you must configure audio session for VoIP calls then, but do not activate it, just set category, mode and buffer.
Example for configuring Audio Session for CallKit incoming call:
func configureAudioSession()
let sharedSession = AVAudioSession.sharedInstance()
do
try sharedSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try sharedSession.setMode(AVAudioSessionModeVoiceChat)
try sharedSession.setPreferredIOBufferDuration(TimeInterval(0.005))
try sharedSession.setPreferredSampleRate(44100.0)
catch
debugPrint("Failed to configure `AVAudioSession`")
Then, when you answer the incoming Call, CallKit will activate the audio session for you, and you will receive a callback from CXProvider:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession)
// Start call audio I/O here
In that delegate callback, you should start your call audio, not before. If WebRTC call audio I/O was started before, the CallKit will terminate it and there will be no sound.
There is a specific issue with the audio I/O and CallKit. When you are about to receive an incoming call, you must configure audio session for VoIP calls then, but do not activate it, just set category, mode and buffer.
Example for configuring Audio Session for CallKit incoming call:
func configureAudioSession()
let sharedSession = AVAudioSession.sharedInstance()
do
try sharedSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try sharedSession.setMode(AVAudioSessionModeVoiceChat)
try sharedSession.setPreferredIOBufferDuration(TimeInterval(0.005))
try sharedSession.setPreferredSampleRate(44100.0)
catch
debugPrint("Failed to configure `AVAudioSession`")
Then, when you answer the incoming Call, CallKit will activate the audio session for you, and you will receive a callback from CXProvider:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession)
// Start call audio I/O here
In that delegate callback, you should start your call audio, not before. If WebRTC call audio I/O was started before, the CallKit will terminate it and there will be no sound.
answered Mar 28 at 9:14
MikiMiki
4324 silver badges16 bronze badges
4324 silver badges16 bronze badges
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
I belive thatfunc provider(_ provider: didActivate:)audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call
– Miki
Jul 23 at 13:06
add a comment |
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
I belive thatfunc provider(_ provider: didActivate:)audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call
– Miki
Jul 23 at 13:06
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
How can I give the audioSession focus to webrtc when screen is locked? By default the output audio starts only when I unlock the screen.
– WorieN
Jul 22 at 12:44
I belive that
func provider(_ provider: didActivate:) audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call– Miki
Jul 23 at 13:06
I belive that
func provider(_ provider: didActivate:) audio session delegate method is called when you answer the incoming audio/video call. In that callback, you need to enable audio processor, up until then audio processor should be disabled, otherwise the CallKit will terminate all running audio IOs, resulting in no sound during a call– Miki
Jul 23 at 13:06
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391026%2fno-sound-after-connecting-to-webrtc-when-app-is-launched-in-background-using-pus%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried to configure the audio session before calling
reportNewIncomingCall(with:update:completion:)?– Marco
Mar 28 at 14:52
Probably this same issue as below: stackoverflow.com/questions/48070163/… Please check my answer
– Gregios
Apr 21 at 9:05
Did you solve it? Have exectly the same problem and tried a all this ways, but it doesn't help.
– WorieN
Jul 22 at 12:52