ZFPlayer
ZFPlayer copied to clipboard
Swift全屏模式下ZFPlayerControlView无效果
我都是对着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)
}
同学,这个问题有解决吗?
同问,解决了吗