Commit e42cd48d authored by pete谢兆麟's avatar pete谢兆麟

兜底方案

parent 426cd1d4
......@@ -159,6 +159,7 @@ class YHLivePlayerViewController: YHBasePlayerViewController {
}
setupTimer()
setupLifeCycleNotifications()
NotificationCenter.default.addObserver(self, selector: #selector(orientationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil)
}
override func viewWillAppear(_ animated: Bool) {
......@@ -979,6 +980,35 @@ extension YHLivePlayerViewController {
topBarView.isHidden = false
}
func changeLandscape() {
guard let windowScene = view.window?.windowScene else { return }
let orientationMask: UIInterfaceOrientationMask = .landscape
if #available(iOS 16.0, *) {
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: orientationMask))
} else {
}
bottomInputBar.isHidden = true
messageListView.isHidden = true
messageListStateButton.isHidden = true
closeButton.isHidden = true
topBarView.isHidden = true
}
@objc func orientationDidChange() {
let orientation = UIDevice.current.orientation
switch orientation {
case .portrait:
changePortrait()
default:
if isLiveStateOn {
changePortrait()
} else {
changeLandscape()
}
}
}
@objc private func handlePanGesture(_ gesture: UIPanGestureRecognizer) {
let translation = gesture.translation(in: view)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment