2 Replies
      Latest reply: Sep 15, 2017 4:14 AM by Troikaa RSS
      Troikaa Level 1 Level 1 (0 points)

        Hello Apple,

          We have an event soon and need to show our medical app so please help and resolve my query as soon as possible .

         

         

        We are developing Medical Application for Medical representative (User) . They will install our app in iOS devices and demonstrate medicine product to doctor. Our app has Audio recording functionality as we need to analyze doctor's review for the product during the presentation.

        So the recording works fine  in background as well as foreground mode.  But in some cases it is not working. Below i have briefed one scenario which could be a frequent case for us.

        In the app we are using .key file which is containing text, video and animation so user click on key file then we open that file in Apple Keynote App. As soon as it will be copied to keynote app, Our LBM app is starting audio recording in background. Now when user will start keynote presentation by clicking on play button, It is working fine until any slide is not containing video. As soon as slice which contains video will start to run, The audio recording that we have started in our LBM app is stoped recording.

        Note: When Recording starts at that time our LBM app is in background mode. And Apple's Keynote will be in foreground mode.

        We have done below thing in our code.

        1) In Info.plist file set Audio Flag  : Privacy - Microphone Usage Description

        2) In Capabilities -> Background Mode -> Audio,Airplay and Picture in Picture

        3)  Use below function in didFinishLaunchingWithOptions Methods

        func audioSessionSettings() {

                do {

                    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryRecord, with: AVAudioSessionCategoryOptions.mixWithOthers)

               

          try AVAudioSession.sharedInstance().setActive(true)

                 

                    var error: Error?

                    try? AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)

                    if error != nil {

                    }

                 

                } catch let error {

                }

            }

         

        Thanks in advance

        • Re: Background audio recording is not working while running video slide in Keynote app
          Claude31 Level 5 Level 5 (1,755 points)

          Invoking Apple here is not a safe bet ; that not the usual channel to get technical support from Apple.

          Use instead a TS ticket from your member account.

           

          If this can help, however: check if you comply with requirements defined here:

          h ttps://developer.apple.com/documentation/avfoundation/avaudiosessioncategoryoptions/1616611-mixwithothers

          Look here to configure

          h ttps://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionBasics/AudioSessionBasics.html

           

          looking at this, I would try to change your call to pass a set as argument:

          try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryRecord, with: [AVAudioSessionCategoryOptions.mixWithOthers])