react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
923 stars 445 forks source link

Sending `RNCallKeepDidChangeAudioRoute` with no listeners registered #735

Closed sametcl2 closed 1 year ago

sametcl2 commented 1 year ago

Bug report

Description

In iOS CallKit screen shows up. After answering call I got the error Sending RNCallKeepDidChangeAudioRoute with no listeners registered.

Steps to Reproduce

Versions

- Callkeep: 4.3.12
- React Native: 0.71.1
- iOS: 15.7
- Android:
- Phone model: iPhone 7

Logs

Sending `RNCallKeepDidChangeAudioRoute` with no listeners registered.
stevenbdf commented 1 year ago

@sametcl2 I'm experiencing the same behavior, were you able to figure out why this happens?

sametcl2 commented 1 year ago

@sametcl2 I'm experiencing the same behavior, were you able to figure out why this happens?

I've added listener like this, top of the listeners useEffect, it seems like solved the problem for me.

RNCallKeep.addEventListener('didChangeAudioRoute', ({ output }) => { console.log('didChangeAudioRoute'); });

geoffcfchen commented 1 year ago

when I was using only react-native-webrtc, I did not see this warning. However, right after installing react-native-callkeep, I started seeing this warning message even though I did not modify any of the code yet.

sametcl2 commented 1 year ago

@sametcl2 I'm experiencing the same behavior, were you able to figure out why this happens?

I've added listener like this, top of the listeners useEffect, it seems like solved the problem for me.

RNCallKeep.addEventListener('didChangeAudioRoute', ({ output }) => { console.log('didChangeAudioRoute'); });

I'm sorry to say but this is not working :/ I really don't know why this is happening.

sametcl2 commented 1 year ago

@geoffcfchen is this warning preventing trigger of answerCall event?

stevenbdf commented 1 year ago

This issue happened on my end because I was answering a phone call in AppDelegate files before the RN code started. This was caused by me having setup VoIP in iOS native code, so I instead let the JS part handle the VoIP registration of the device. It added some delay than the previous solution but this warning went away and I was able to answer the call properly

sametcl2 commented 1 year ago

This issue happened on my end because I was answering a phone call in AppDelegate files before the RN code started. This was caused by me having setup VoIP in iOS native code, so I instead let the JS part handle the VoIP registration of the device. It added some delay than the previous solution but this warning went away and I was able to answer the call properly

Hi @stevenbdf thanks for your answer. How did you register in js side. Can you give me example please?

kr-yeon commented 11 months ago

Hello @stevenbdf! Thank you for comment. I understand that iOS needs to run Callkeep as quickly as possible. Otherwise, I understand that the app will be terminated. In this situation, how can I use a method to launch Callkeep after the jsBundle is loaded without the app closing?

stevenbdf commented 11 months ago

Hello @stevenbdf! Thank you for comment. I understand that iOS needs to run Callkeep as quickly as possible. Otherwise, I understand that the app will be terminated. In this situation, how can I use a method to launch Callkeep after the jsBundle is loaded without the app closing?

I think that's the recommendation from iOS yes. But from what I was able to experiment in my app, it is not mandatory. I had to remove the voipRegistration from the delegate file and I simply initially RNCallkeep in my React Native code. It can be done inside a screen, provider or layout that you make sure it's rendered when your app is awaken from background mode. In my case I put and invoke the RNCallKeep.setup(callKeepOptions) in a navigation Provider that's only rendered when the user is logged in.

AppDelegate.mm image

authenticated-navigation.tsx image

kr-yeon commented 11 months ago

안녕하세요@stevenbdf! 의견을 보내주셔서 감사합니다. iOS에서는 Callkeep을 최대한 빨리 실행해야 한다는 점을 이해합니다. 그렇지 않으면 앱이 종료되는 것으로 알고 있습니다. 이 상황에서 jsBundle이 로드된 후 앱을 닫지 않고 Callkeep을 시작하는 메서드를 어떻게 사용할 수 있습니까?

나는 그것이 iOS의 권장 사항이라고 생각합니다. 하지만 내 앱에서 실험해 본 결과 필수는 아닙니다. voipRegistration위임 파일에서 를 제거해야 했고 처음에는 React Native 코드에서 RNCallkeep을 사용했습니다. 앱이 백그라운드 모드에서 깨어날 때 렌더링되는지 확인하는 화면, 공급자 또는 레이아웃 내에서 수행할 수 있습니다. RNCallKeep.setup(callKeepOptions)제 경우에는 사용자가 로그인할 때만 렌더링되는 탐색 제공자에 를 넣고 호출했습니다 .

AppDelegate.mm 영상

authenticated-navigation.tsx 영상

Hmm... thank you. I'm having a lot of worries.

kr-yeon commented 11 months ago

Hello @stevenbdf! Thank you for comment. I understand that iOS needs to run Callkeep as quickly as possible. Otherwise, I understand that the app will be terminated. In this situation, how can I use a method to launch Callkeep after the jsBundle is loaded without the app closing?

I think that's the recommendation from iOS yes. But from what I was able to experiment in my app, it is not mandatory. I had to remove the voipRegistration from the delegate file and I simply initially RNCallkeep in my React Native code. It can be done inside a screen, provider or layout that you make sure it's rendered when your app is awaken from background mode. In my case I put and invoke the RNCallKeep.setup(callKeepOptions) in a navigation Provider that's only rendered when the user is logged in.

AppDelegate.mm image

authenticated-navigation.tsx image

@stevenbdf Your solution works as expected. It's amazing. Thank you. It seems that the call is executed after all event listeners are ready. Is there a possibility that bundling may be delayed?