使用自定义相机快门声音

时间:2017-07-18 14:27:56

标签: ios swift avcapturesession avcapturedevice

在相机控制器中拍摄静止图像时,有没有办法实现自定义快门声音?我猜默认声音会自动播放,无法关闭但是可以播放另一种声音吗?

1 个答案:

答案 0 :(得分:0)

是的,

使用它:

    <script type="text/javascript">
      dojo.ready(function(){
var value = dojo.byId("comments").get('value')
        dojo.byId("comments").set('value', value.replace(/<[^>]*>/g, ''))

      });
    </script>

    <div id="comments" name="comments" dojoType="dijit.form.SimpleTextarea" maxLength="900" style="width: 98%; padding-right: 4px; font-size: 1.2em;" aria-required="true" title="<fmt:message key="widget.content2" />"></div>

您可以在此处查看所有完整的声音:

Sounds

对于自定义声音:

AudioServicesPlaySystemSound(1108);

确保导入

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];