I am currently developing an app for the Apple Watch. In RTPController.swift, I handle the sending, receiving, and playback of audio, and the specific processes are as follows:
Overview of the current implementation:
Audio processing: Audio processing is performed by setting the AVAudioSession to the playAndRecord category and voiceChat mode within RTPController, and by activating the AVAudioEngine. Audio reception: RTP packets (audio data) are received over the network within the setupConnection() method of RTPController. Audio playback: The received audio data is passed to the playSound(data:) method and played back through the AVAudioEngine and AVAudioPlayerNode.
Xcode Capabilities settings:
Signing & Capabilities Background Modes: Audio, AirPlay, and Picture in Picture Voice over IP Workout processing Privacy descriptions in Info.plist: Privacy - Health Share Usage Description Privacy - Health Update Usage Description Privacy - Health Records Usage Description
Question 1: When the digital crown is pressed during a call, a message appears on the screen stating, "End Call to Continue," and the call cannot be moved to the background. As a result, it is not possible to operate other apps while on a call. Is this behavior due to the specifications of CallKit?
Question 2: Our app stops communication when it goes into the background, but the walkie-talkie app on the Apple Watch can transition to the background by pressing the digital crown during a call, allowing it to continue receiving and playing the other party's audio while in the background. To achieve background transition during a call and audio reception and playback in the background, is the current implementation of RTPController and the enabled background modes insufficient?
Best regards.
Question 1: When the digital crown is pressed during a call, a message appears on the screen stating, "End Call to Continue," and the call cannot be moved to the background. As a result, it is not possible to operate other apps while on a call. Is this behavior due to the specifications of CallKit?
Yes, this is how CallKit works on watchOS.
Question 2: Our app stops communication when it goes into the background, but the walkie-talkie app on the Apple Watch can transition to the background by pressing the digital crown during a call, allowing it to continue receiving and playing the other party's audio while in the background.
watchOS does not currently have a public API that will allow your app to do this.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware