我正在开发一个用swift 2.0编写的音乐应用程序 .
现在,我正在用AVPlayer实现视频播放器部分 .

我想添加一个功能,如果用户 swipes down any place in the modal(in the movie player), the modal gets dismissed downward. (像ios youtube播放器;他们实际上并没有关闭播放器)

我研究了如何实现此功能并找到了以下解决方案

Stackoverflow回答:In iOS, how to drag down to dismiss a modal?
完整教程:http://www.thorntech.com/2016/02/ios-tutorial-close-modal-dragging/

它运作良好,但有一个问题 AVPlayer is freezing when the pan gesture is made (手指在屏幕上) . 音频正常播放 . 只有视频冻结了 .

这是代码处理平移手势 .

@IBAction func handleGesture(sender: UIPanGestureRecognizer) {

        let percentThreshold:CGFloat = 0.2

        // convert y-position to downward pull progress (percentage)
        let translation = sender.translationInView(view)
        let verticalMovement = translation.y / view.bounds.height
        let downwardMovement = fmaxf(Float(verticalMovement), 0.0)
        let downwardMovementPercent = fminf(downwardMovement, 1.0)
        let progress = CGFloat(downwardMovementPercent)

        guard let interactor = interactor else { return }

        switch sender.state {
        case .Began:
            interactor.hasStarted = true
            dismissViewControllerAnimated(true, completion: nil)
        case .Changed:
            interactor.shouldFinish = progress > percentThreshold
            interactor.updateInteractiveTransition(progress)
        case .Cancelled:
            interactor.hasStarted = false
            interactor.cancelInteractiveTransition()
        case .Ended:
            interactor.hasStarted = false
            if interactor.shouldFinish {
                interactor.finishInteractiveTransition()
            } else {
                interactor.cancelInteractiveTransition()
            }
        default:
            break
        }
    }

After "dismissViewControllerAnimated(true, completion: nil)" is called (case .Began:), "currentVideoFrameRate" (avPlayer.currentItem?.tracks.first?.currentVideoFrameRate) is reduced from approx. 29 to 4 .

似乎内部控制了利率 . 我仍然不知道如何防止降低帧速率 .
我想让AVPlayer正常播放视频,即使它正在转换(.Changed status)
有谁知道如何解决这个问题?

谢谢!