             }
         }
     }
-
+    
     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: - 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 {
-                return false
-            }
-            if player.scrollView != nil && player.indexPath != nil && player.displayMode == .embedded{
-                return false
-            }
-
-            return touch.view == self.controlView
-        }
-        return true
-    }
-
-
-
-    // MARK: - UIGestureRecognizer
-
-    @objc fileprivate func singleTapGestureTapped(_ sender: UIGestureRecognizer) {
-        guard  let player = self.player else {
-            return
-        }
-        if let gestureRecognizer =  self.controlView as? EZPlayerGestureRecognizer{
-            gestureRecognizer.player(player, singleTapGestureTapped: sender as! UITapGestureRecognizer )
-        }
-        NotificationCenter.default.post(name: .EZPlayerTapGestureRecognizer, object: player, userInfo: [Notification.Key.EZPlayerNumberOfTaps: 1, Notification.Key.EZPlayerTapGestureRecognizer: sender as! UITapGestureRecognizer])
-
-    }
-
-    @objc fileprivate func doubleTapGestureTapped(_ sender: UIGestureRecognizer) {
-        guard  let player = self.player else {
-            return
-        }
-        if let gestureRecognizer =  self.controlView as? EZPlayerGestureRecognizer{
-            gestureRecognizer.player(player, doubleTapGestureTapped: sender as! UITapGestureRecognizer )
-        }
-        NotificationCenter.default.post(name: .EZPlayerTapGestureRecognizer, object: player, userInfo: [Notification.Key.EZPlayerNumberOfTaps: 2,Notification.Key.EZPlayerTapGestureRecognizer: sender  as! UITapGestureRecognizer])
-
-    }
-
+        
+    }
+    
+    
     // MARK: - public
-
     func config(player: EZPlayer){
         (self.layer as! AVPlayerLayer).player = player.player
         if let customAction =  self.controlView as? EZPlayerCustomAction{

            }
            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()
    }
}

import UIKit
import AVFoundation

class EZPlayerView: UIView {
    //播放器属性
    weak private var player: EZPlayer?
    
    weak var controlView: UIView?{
        didSet{
            if oldValue != controlView{
