同时使用vibrate和AVCaptureSession [英] Using vibrate and AVCaptureSession at the same time

查看:172
本文介绍了同时使用vibrate和AVCaptureSession的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试在录制视频时振动手机,但我发现 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 不能很好地播放 AVCaptureSession

I'm trying to vibrate the phone while recording video, but I'm finding that AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); doesn't play nicely with AVCaptureSession. Is there any other way to vibrate the phone or am I stuck with losing the vibrate function while recording video?

推荐答案

您可能需要使用这种方法设置音频与其他混音,我发现这很有用:

You probably need to set the audio to mix with other, I found this useful:

- (void)setupAudio {
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
    UInt32 doSetProperty = 1;
    AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(doSetProperty), &doSetProperty);
    [[AVAudioSession sharedInstance] setActive: YES error: nil];
}

这里

这篇关于同时使用vibrate和AVCaptureSession的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆