-1

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 ?

iPatel
  • 43,583
  • 14
  • 113
  • 135
Parvez Belim
  • 983
  • 13
  • 35

1 Answers1

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];

Other way is

Read this question AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection?

Community
  • 1
  • 1
iPatel
  • 43,583
  • 14
  • 113
  • 135