我正在使用苹果的AVCam
创建用于视频录制的自定义相机,但我希望在录制时实现将视频静音的功能,任何机构都可以有任何想法吗?
答案 0 :(得分:1)
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?