 //
 //  Created by Ari on 2017/6/22.
 //  Copyright © 2017年 com.Ari. All rights reserved.
-//
+//  如有雷同 你我师出同门或者你就是师傅
 
 import UIKit
 import AVFoundation


extension ViewController : AVCaptureVideoDataOutputSampleBufferDelegate,AVCaptureAudioDataOutputSampleBufferDelegate{
    
    //两个代理实际采集代理方法一致  所以要区分
    //丢弃掉的
    func captureOutput(_ captureOutput: AVCaptureOutput!, didDrop sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!) {
        
    }
    //实际输出的
    func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!) {
        
        if videoconnection == connection {
            print("视频采集")
        }else{
            print("音频采集")
        }
        
    }
}

    //切换摄像头
    @IBAction func chageCamera(_ sender: Any) {
        guard let session = session else { return }
        //0.添加动画效果
        let rotaionAnim = CATransition()
        rotaionAnim.type = "oglFlip"
        rotaionAnim.subtype = "fromLeft"
        rotaionAnim.duration = 0.5
        view.layer.add(rotaionAnim, forKey: nil)
        
        //1.取出之前镜头的方向
        guard let videoInput = videoInput else { return}
