1

I'm working on a reading book app, which will automatically take a picture every 5 seconds then play audio from that picture.

I use this code from this answer https://stackoverflow.com/a/55235949/2172546 dispose the shutter sound.

extension PhotoCaptureService: AVCapturePhotoCaptureDelegate {
    func photoOutput(_ output: AVCapturePhotoOutput, willCapturePhotoFor resolvedSettings: AVCaptureResolvedPhotoSettings) {
        // dispose system shutter sound
        AudioServicesDisposeSystemSoundID(1108)
    }
}

The problem is that, when the app is playing the audio for the book page using AVPlayer, this "dispose" action also makes the audio silent for 2 or 3 seconds. But it just happens on iOS 12 only and works perfectly on iOS 13. So my question is, how can I make it works on iOS 12 as well? Thank you in advance for the answers.

t4nhpt
  • 5,264
  • 4
  • 34
  • 43
  • 1
    Could you do a screen capture instead of taking a photo forgoing the need to dispose the shutter sound? – Gabriel Pires Jun 22 '20 at 06:37
  • @GabrielPires It's a good idea, thank you. If I could not find any other solution, I will consider capturing the screen then read the text from it. Of course, if we capture the screen, we have to clean the text for other controls and in the status bar – t4nhpt Jun 24 '20 at 03:48
  • 1
    In the new [AVPlayer](https://developer.apple.com/documentation/avfoundation/avcapturephotocapturedelegate/1778625-photooutput) - Live Photo capture disables the shutter sound. So I’d try without the dispose system sound line to see if it still works. – Pranav Kasetti Jun 24 '20 at 10:16

0 Answers0