I am creating the custom camera for video recording using AVCam
of apple,but i want implement the functionality to mute the video while recording, can any body has any idea ?
Asked
Active
Viewed 1,602 times
-1

iPatel
- 46,010
- 16
- 115
- 137

Parvez Belim
- 1,003
- 13
- 36
1 Answers
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];
Other way is
Read this question AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection?