2

We have noticed that in WhatsApp, when receiving an incoming video call, the ring volume changes when user plays with the iPhone volume. As far as I understood from reading, ringer volume level is not accessible in public API and the only way to achieve a ring that respects the ringer volume setting is by integrating CallKit.

However, the incoming video call interface in WhatsApp doesn't look like CallKit. It has a live camera layer and additional "Minimize" button on the top right corner.

How can I achieve a similar result? we need the ring to be totally native, so it could be silent when volume is set to minimum, and still have a live camera view in the screen.

Thanks in advance

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Arik Segal
  • 2,963
  • 2
  • 17
  • 29

1 Answers1

1

As far as I can tell, WhatsApp doesn't use CallKit for video calls, it uses it only for audio calls. They use push notifications to notify an incoming video call, so I think they simply set the system default ringtone as the push notification sound. In fact, if you try to change the ringtone of your phone you will continue to hear the default ringtone for an incoming video call. For audio calls, however, you'll hear the ringtone you've set, because they use CallKit.

Keep in mind that if you follow the WhatsApp approach, if the phone is locked or the app is not in foreground, you won't see any incoming video call interface because of the lack of CallKit integration.

Marco
  • 1,572
  • 1
  • 10
  • 21
  • Thank you for your answer. This is all correct. However, I am more interested in the behavior when the app is active and an incoming call is received (sorry if it wasn't clear) – Arik Segal Jul 23 '19 at 11:53
  • 1
    Well, even when the app is active, I think that my answer is still valid: you should just try to set the ringtone sound as the push notification sound of your app. The notification volume is the same as the ringtone volume, so you should be able to achieve the behaviour you've described. – Marco Jul 23 '19 at 12:15
  • OK. Once I get back to it (work priorities has changed in the meantime) I will try it. I'm listing some more resources here as a note to myself (they might help me later on), and if it works I will mark your answer as the accepted answer. https://stackoverflow.com/questions/10855874/audioservicesplaysystemsound-volume / https://stackoverflow.com/questions/24884435/ios-play-sound-on-receiving-push-notification-when-app-in-foreground – Arik Segal Jul 24 '19 at 13:35