         }
         self.player = player
     }
-    private var trigger = EZPlayerSlideTrigger.none
-    private var isHorizontalPan = true
-    private var position : TimeInterval?
-
-    @objc fileprivate func panDirection(_ pan: UIPanGestureRecognizer) {
+
+    
+    // MARK: - private
+    private func commonInit() {
+        
+        self.clipsToBounds = true
+        self.backgroundColor = UIColor.black
+        //        self.translatesAutoresizingMaskIntoConstraints = true
+        
+        self.autoresizingMask = [.flexibleHeight, .flexibleWidth,.flexibleLeftMargin,.flexibleTopMargin,.flexibleRightMargin,.flexibleBottomMargin]
+        
+        self.controlView?.autoresizingMask = [.flexibleLeftMargin,.flexibleTopMargin,.flexibleRightMargin,.flexibleBottomMargin]
+        self.addSubview(self.controlView!)
+        
+        self.configGesture()
+        
+        self.singleTapGesture.require(toFail: self.doubleTapGesture)
+        //                self.autohideControlView()
+    }
+}
+
+// MARK: - UIGestureRecognizerDelegate
+extension EZPlayerView: UIGestureRecognizerDelegate {
+    public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool{
+        guard  let player = self.player else {
+            return false
+        }
+        
+        if self.singleTapGesture == gestureRecognizer || self.doubleTapGesture == gestureRecognizer{
+            if let customAction =  self.controlView as? EZPlayerCustomAction{//点击控制条
+                return  !customAction.autohidedControlViews.contains(touch.view!) && !customAction.autohidedControlViews.contains(touch.view!.superview!)
+            }
+        }else if self.panGesture == gestureRecognizer{
+            if player.displayMode == .float {//float模式不支持划动
+                return false
+            }
+            if player.scrollView != nil && player.indexPath != nil && player.displayMode == .embedded{//嵌入模式且在列表中不支持
+                return false
+            }
+            
+            return touch.view == self.controlView
+        }
+        return true
+    }
+}
+
+
+// MARK: - UIGestureRecognizer
+extension EZPlayerView {
+    private func configGesture(){
+        self.panGesture = UIPanGestureRecognizer(target: self, action: #selector(self.panDirection(_:)))
+        self.addGestureRecognizer(self.panGesture)
+        self.panGesture.delegate = self
+        
+        self.singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(self.singleTapGestureTapped(_:)))
+        self.singleTapGesture.delegate = self
+        self.singleTapGesture.numberOfTapsRequired = 1
+        self.singleTapGesture.numberOfTouchesRequired = 1
+        self.addGestureRecognizer(self.singleTapGesture)
+        
+        self.doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(self.doubleTapGestureTapped(_:)))
+        self.doubleTapGesture.delegate = self
+        self.doubleTapGesture.numberOfTapsRequired = 2
+        self.doubleTapGesture.numberOfTouchesRequired = 1
+        self.addGestureRecognizer(self.doubleTapGesture)
+        
+        self.singleTapGesture.require(toFail: self.doubleTapGesture)
+    }
+    
+    @objc private func panDirection(_ pan: UIPanGestureRecognizer) {
         guard  let player = self.player else {
             return
         }
         let velocityPoint = pan.velocity(in: self)
-
+        
         switch pan.state {
         case UIGestureRecognizerState.began:
-
+            
             let x = fabs(velocityPoint.x)
             let y = fabs(velocityPoint.y)
-
+            
             if x > y {
-
+                
                 if let horizontalPanDelegate =  self.controlView as? EZPlayerHorizontalPan , player.canSlideProgress{
                     self.isHorizontalPan = true
                     self.position = player.currentTime
                     horizontalPanDelegate.player(player, progressWillChange: self.position ?? 0)
                 }
-
+                
             } else {
                 self.isHorizontalPan = false
                 if pan.location(in: self).x > self.bounds.size.width / 2 {

            }
            horizontalPanDelegate.player(player, progressChanging: nextPosition)
        }

    }

    private func commonInit() {

        self.clipsToBounds = true
        self.backgroundColor = UIColor.black
        //        self.translatesAutoresizingMaskIntoConstraints = true

        self.autoresizingMask = [.flexibleHeight, .flexibleWidth,.flexibleLeftMargin,.flexibleTopMargin,.flexibleRightMargin,.flexibleBottomMargin]

        self.controlView?.autoresizingMask = [.flexibleLeftMargin,.flexibleTopMargin,.flexibleRightMargin,.flexibleBottomMargin]
        self.addSubview(self.controlView!)

        self.panGesture = UIPanGestureRecognizer(target: self, action: #selector(self.panDirection(_:)))
        self.addGestureRecognizer(self.panGesture)
        self.panGesture.delegate = self

        self.singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(self.singleTapGestureTapped(_:)))
        self.singleTapGesture.delegate = self
        self.singleTapGesture.numberOfTapsRequired = 1
        self.singleTapGesture.numberOfTouchesRequired = 1
        self.addGestureRecognizer(self.singleTapGesture)

        self.doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(self.doubleTapGestureTapped(_:)))
        self.doubleTapGesture.delegate = self
        self.doubleTapGesture.numberOfTapsRequired = 2
        self.doubleTapGesture.numberOfTouchesRequired = 1
        self.addGestureRecognizer(self.doubleTapGesture)

        self.singleTapGesture.require(toFail: self.doubleTapGesture)
        //                self.autohideControlView()
    }
}

            }
        }
    }
    
    override class var layerClass: AnyClass {
        return AVPlayerLayer.self
    }
    
    //手势属性
    open var panGesture: UIPanGestureRecognizer!
    open var singleTapGesture: UITapGestureRecognizer!
    open var doubleTapGesture: UITapGestureRecognizer!
    private var trigger = EZPlayerSlideTrigger.none
    private var isHorizontalPan = true
    private var position : TimeInterval?
    
    // MARK: - Life cycle
    override init(frame: CGRect) {
        super.init(frame: CGRect.zero)
        self.commonInit()
        
    }
    
    init(controlView: UIView? ) {
        super.init(frame: CGRect.zero)
        self.controlView = controlView
        self.commonInit()
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.controlView?.frame = self.bounds
        
    }
    
    
    // MARK: - public
    func config(player: EZPlayer){
        (self.layer as! AVPlayerLayer).player = player.player
        if let customAction =  self.controlView as? EZPlayerCustomAction{
