0

Is there a way to implement custom shutter sound when capturing still image in camera controller? I guess default sound plays automatically and can't be turned off but is it ok to play another sound over it?

ZassX
  • 1,369
  • 2
  • 14
  • 35

1 Answers1

0

Yes,

use this:

AudioServicesPlaySystemSound(1108);

You can check all full sounds here:

Sounds

For a custom sound:

AVAudioPlayer *audioPlayer;
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"Name of your audio file" 
                                                      ofType:@"type of your audio file example: mp3"];
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
audioPlayer.numberOfLoops = -1;
[audioPlayer play];

Make sure you import

<AVFoundation/AVFoundation.h>

Pedro Pinho
  • 652
  • 3
  • 6