ZFPlayer icon indicating copy to clipboard operation
ZFPlayer copied to clipboard

Swift全屏模式下ZFPlayerControlView无效果

Open bruceFighting opened this issue 3 years ago • 2 comments

我都是对着demo抄的,能横屏,但没任何手势,但是竖屏点击全屏就有手势,作者帮忙看看哪的问题

((UIApplication.shared.delegate) as! AppDelegate).allowOrentitaionRotation = true

    self.containerView = UIView()
    self.view.addSubview(containerView!)
    
    self.controlView = ZFPlayerControlView()
    self.controlView?.fastViewAnimated = true
    self.controlView?.effectViewShow = false
    self.controlView?.prepareShowLoading = true

// self.controlView.controlViewAppearedCallback = ^(BOOL appeared) { // @strongify(self) // [self.controlView.superview bringSubviewToFront:self.controlView]; // }; self.controlView?.controlViewAppearedCallback = { appeared in self.controlView?.superview?.bringSubviewToFront(self.controlView!) }

    self.controlView?.backBtnClickCallback = {
        self.player?.rotate(to: UIInterfaceOrientation.portrait, animated: false, completion: nil)
        self.player?.stop()
        self.dismiss(animated: false, completion: nil)
    }
    
    let playerManager : ZFAVPlayerManager = ZFAVPlayerManager()
    self.player = ZFPlayerController.init(playerManager: playerManager, containerView: self.containerView!)
    self.player?.controlView = self.controlView!
    self.player?.orientationObserver.supportInterfaceOrientation = ZFInterfaceOrientationMask.landscape
    self.player?.rotate(to: UIInterfaceOrientation.landscapeRight, animated: false, completion: nil)
    
    // 当即将全屏时候会调用
    self.player?.orientationWillChange = { (player : ZFPlayerController, isFullScreen : Bool) in
        ((UIApplication.shared.delegate) as! AppDelegate).allowOrentitaionRotation = isFullScreen
    }
    
    playerManager.assetURL = URL(string: "https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1280x720h.mp4")!

override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) ((UIApplication.shared.delegate) as! AppDelegate).allowOrentitaionRotation = false }

/** 是否让页面支持自动旋转屏幕 */
override var shouldAutorotate: Bool {
    return false
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.landscape
}

override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
    return UIInterfaceOrientation.landscapeRight
}

override var preferredStatusBarStyle: UIStatusBarStyle {
    return UIStatusBarStyle.lightContent
}

override var prefersStatusBarHidden: Bool {
    return ((self.player?.isStatusBarHidden) != nil)
}

bruceFighting avatar Nov 03 '21 02:11 bruceFighting

同学,这个问题有解决吗?

hewang1016729378 avatar Mar 18 '22 07:03 hewang1016729378

同问,解决了吗

ZTXBEST avatar Aug 05 '22 07:08 ZTXBEST