title: avplayer not playing audio in video which is captured through device camera in IOS objective-C
body: <p>I am capturing the video from the device camera and than storing that video into the device local memory and than in the next screen I am playing that video using <strong>AVPlayer</strong> but I am not getting sound from video.Here is code of video playback</p>
  
  <pre><code>    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
      [[AVAudioSession sharedInstance] setActive:YES error:nil];
  
      _avPlayer=[[AVPlayer alloc]initWithURL:url]; //URL of my recorded video
      _avPlayerLayer =[AVPlayerLayer playerLayerWithPlayer:_avPlayer];
      [_avPlayerLayer setFrame:CGRectMake(0, 0, self.videoview.frame.size.width, self.videoview.frame.size.height)];
      [_avPlayerLayer setBackgroundColor:[[UIColor blackColor]CGColor]];
      _avPlayerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
      [self.pictureview.layer addSublayer:_avPlayerLayer];
      [_avPlayer seekToTime:kCMTimeZero];
      _avPlayer = [self rotateVideoPlayer:_avPlayer withDegrees:0.0];
      _avPlayer.volume = 1.0;
      [_avPlayer play];
  </code></pre>
  
  <p><strong>Note:-</strong> Video has sound because After preview, I am uploading the video on server and in that I can hear a sound from recorded video.</p>
  
  <p>I am using <strong>AVCaptureSession</strong> to record video and has <strong>added</strong> <strong>AVMediaTypeVideo</strong>  and <strong>AVMediaTypeAudio</strong> <strong>as AVCaptureDevice.</strong> So will it make any problem at a time of playback. Before Playback I am removing AVCaptureDevice devices from the AVCaptureSession and than playing the captured video.</p>