-->

利用振动和AVCaptureSession在同一时间(Using vibrate and AVCap

2019-09-02 03:50发布

我试图振动手机录制视频,但我发现AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 不会发挥很好AVCaptureSession 。 是否有任何其他方式振动手机还是我坚持失去了振动功能的同时录制视频?

Answer 1:

你可能需要设置音频与其他混合,我发现这个有用:

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

从这里



文章来源: Using vibrate and AVCaptureSession at the same time