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;








2















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:



  1. Enabling/disabling audio background mode.


  2. Configuring audio session before and after the didActivate callback is received from CallKit delegate.


  3. Configuring audio session manually and using RTCAudioSession.sharedInstance from WebRTC library.


  4. Enabling and disabling RTCAudioSession.useManualAudio.


This is the scenario where we encounter the issue:



  1. Kill the app. Lock the phone.


  2. Call this user from another phone.


  3. PushKit launches the app, the app presents CallKit screen, the user answers the call.


  4. The connection establishes correctly. The call is active but there is no sound on both ends.


  5. Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.


Any help is appreciated.










share|improve this question
























  • 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

















2















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:



  1. Enabling/disabling audio background mode.


  2. Configuring audio session before and after the didActivate callback is received from CallKit delegate.


  3. Configuring audio session manually and using RTCAudioSession.sharedInstance from WebRTC library.


  4. Enabling and disabling RTCAudioSession.useManualAudio.


This is the scenario where we encounter the issue:



  1. Kill the app. Lock the phone.


  2. Call this user from another phone.


  3. PushKit launches the app, the app presents CallKit screen, the user answers the call.


  4. The connection establishes correctly. The call is active but there is no sound on both ends.


  5. Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.


Any help is appreciated.










share|improve this question
























  • 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













2












2








2








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:



  1. Enabling/disabling audio background mode.


  2. Configuring audio session before and after the didActivate callback is received from CallKit delegate.


  3. Configuring audio session manually and using RTCAudioSession.sharedInstance from WebRTC library.


  4. Enabling and disabling RTCAudioSession.useManualAudio.


This is the scenario where we encounter the issue:



  1. Kill the app. Lock the phone.


  2. Call this user from another phone.


  3. PushKit launches the app, the app presents CallKit screen, the user answers the call.


  4. The connection establishes correctly. The call is active but there is no sound on both ends.


  5. Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.


Any help is appreciated.










share|improve this question














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:



  1. Enabling/disabling audio background mode.


  2. Configuring audio session before and after the didActivate callback is received from CallKit delegate.


  3. Configuring audio session manually and using RTCAudioSession.sharedInstance from WebRTC library.


  4. Enabling and disabling RTCAudioSession.useManualAudio.


This is the scenario where we encounter the issue:



  1. Kill the app. Lock the phone.


  2. Call this user from another phone.


  3. PushKit launches the app, the app presents CallKit screen, the user answers the call.


  4. The connection establishes correctly. The call is active but there is no sound on both ends.


  5. 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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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

















  • 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
















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












1 Answer
1






active

oldest

votes


















0
















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.






share|improve this answer

























  • 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










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
);



);














draft saved

draft discarded
















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









0
















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.






share|improve this answer

























  • 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















0
















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.






share|improve this answer

























  • 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













0














0










0









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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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 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

















  • 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
















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








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.




















draft saved

draft discarded















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해