如何在iPhone的自定义相机中静音录像?

时间:2013-03-22 06:26:09

标签: iphone ios objective-c cocos2d-iphone

我正在使用苹果的AVCam创建用于视频录制的自定义相机,但我希望在录制时实现将视频静音的功能,任何机构都可以有任何想法吗?

1 个答案:

答案 0 :(得分:1)

Try With Following code From:

 AVURLAsset *asset = [[avPlayer currentItem] asset];
NSArray *audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio];

// Mute all the audio tracks
NSMutableArray *allAudioParams = [NSMutableArray array];
for (AVAssetTrack *track in audioTracks) {
    AVMutableAudioMixInputParameters *audioInputParams =    [AVMutableAudioMixInputParameters audioMixInputParameters];
    [audioInputParams setVolume:0.0 atTime:kCMTimeZero];
    [audioInputParams setTrackID:[track trackID]];
    [allAudioParams addObject:audioInputParams];
}
AVMutableAudioMix *audioZeroMix = [AVMutableAudioMix audioMix];
[audioZeroMix setInputParameters:allAudioParams];

[[avPlayer currentItem] setAudioMix:audioZeroMix];

其他方式

阅读此问题AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection?