How to change the shutter sound in iOS.

procedure

  1. Initialize the audio player with the audio you want to play.
// path to your mp3 file.
guard let path = Bundle.main.path(forResource: "customSound", ofType: "mp3") else { print("Could not find sound file.") ; return }

// initialize the player.
do {
try audioPlayer = AVAudioPlayer(contentsOf: URL(fileURLWithPath: path))
} catch {
print("playerError")
}
func photoOutput(_ output: AVCapturePhotoOutput, willCapturePhotoFor resolvedSettings: AVCaptureResolvedPhotoSettings) {
AudioServicesDisposeSystemSoundID(1108) // If you implement only this line, it will be silent shutter.
audioPlayer?.play()
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store