andreipitis / ASPVideoPlayer

A simple video player that allow animations to be performed on the view during playback.
MIT License
89 stars 43 forks source link

can not seek video when put in sliding panel #44

Closed fukemy closed 5 years ago

fukemy commented 5 years ago

Hello. First thanks you for very nice project. I just starting with it When put ASPVideoVC inside ContainerView, ContainerView inside SlidingPanel, the problem is I can not slide the progress. Can you help?

As the screenshot below, i cant seek the progress only max 1 cm, after that it stop highlight then back to normal size Screen Shot 2019-06-19 at 17 25 19

When debug i saw the func cancelTracking always call when i seek the progressbar

andreipitis commented 5 years ago

Hi @fukemy ,

I'm guessing your SlidingPanel has a GestureRecognizer attached that intercepts the touch events which leads to cancelTracking being called.

There are a couple of ways that I can think of to solve the issue:

  1. Set the cancelsTouchesInView of the GestureRecognizer to false to allow the touch event to be forwarded to the progress bar.

  2. Use the UIGestureRecognizerDelegate methods to prevent the GestureRecognizer from firing if the touch location is inside of the video player:

    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        let point = gestureRecognizer.location(in: gestureRecognizer.view)
        //You might need to do a conversion here depending on the position of your video player. However if it's at the very top this should work.
        return videoPlayer.frame.contains(point) == false
    }
fukemy commented 5 years ago

it work. Thanks