有没有办法在相机控制器中实现拍摄静止图像时自定义快门声音?我猜默认的声音是自动播放的,不能被关闭,但是在它上面播放另一个声音可以吗?
发布于 2017-07-18 22:30:28
是,
使用以下命令:
AudioServicesPlaySystemSound(1108);你可以在这里检查所有完整的声音:
Sounds
对于自定义声音:
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];确保导入
<AVFoundation/AVFoundation.h>
https://stackoverflow.com/questions/45169665
复制相似问题