store video orientation & revert on closing player.
This commit is contained in:
parent
e392a03d05
commit
2919b25a5d
|
@ -56,6 +56,7 @@ struct ItemView: View {
|
||||||
.navigationBarHidden(false)
|
.navigationBarHidden(false)
|
||||||
.navigationBarBackButtonHidden(false)
|
.navigationBarBackButtonHidden(false)
|
||||||
.environmentObject(videoPlayerItem)
|
.environmentObject(videoPlayerItem)
|
||||||
|
.supportedOrientations(.all)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
||||||
var playbackItem = PlaybackItem()
|
var playbackItem = PlaybackItem()
|
||||||
var remoteTimeUpdateTimer: Timer?
|
var remoteTimeUpdateTimer: Timer?
|
||||||
var upNextViewModel: UpNextViewModel = UpNextViewModel()
|
var upNextViewModel: UpNextViewModel = UpNextViewModel()
|
||||||
|
var lastOri: UIDeviceOrientation!
|
||||||
|
|
||||||
// MARK: IBActions
|
// MARK: IBActions
|
||||||
@IBAction func seekSliderStart(_ sender: Any) {
|
@IBAction func seekSliderStart(_ sender: Any) {
|
||||||
|
@ -390,6 +391,8 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
||||||
setupNextUpView()
|
setupNextUpView()
|
||||||
upNextViewModel.delegate = self
|
upNextViewModel.delegate = self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastOri = UIDevice.current.orientation
|
||||||
|
|
||||||
if !UIDevice.current.orientation.isLandscape || UIDevice.current.orientation.isFlat {
|
if !UIDevice.current.orientation.isLandscape || UIDevice.current.orientation.isFlat {
|
||||||
let value = UIInterfaceOrientation.landscapeRight.rawValue
|
let value = UIInterfaceOrientation.landscapeRight.rawValue
|
||||||
|
@ -434,6 +437,8 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
||||||
self.tabBarController?.tabBar.isHidden = false
|
self.tabBarController?.tabBar.isHidden = false
|
||||||
self.navigationController?.isNavigationBarHidden = false
|
self.navigationController?.isNavigationBarHidden = false
|
||||||
overrideUserInterfaceStyle = .unspecified
|
overrideUserInterfaceStyle = .unspecified
|
||||||
|
UIDevice.current.setValue(lastOri.rawValue, forKey: "orientation")
|
||||||
|
UIViewController.attemptRotationToDeviceOrientation()
|
||||||
super.viewWillDisappear(animated)
|
super.viewWillDisappear(animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue