Reputation: 3898
I have added AVPlayerViewController view half of my current viewcontroller view then playing video from URL so far everything okay and it is working as excepted.
Actually i wanted to do landscape mode when user clicks on full screen button and here not able to find out that button action. i have tried many things nothing helps
Detect Video playing full screen in Portrait or landscape
Is there any notification or presentedViewController or something else to find out?
I have already read so many question and did not get any answers so that posting here.
if self.player == nil {
self.playerVwController.view.bounds = self.videoPlayerView.bounds
self.playerVwController.view.frame = CGRect(x: 0, y: 0, width: self.videoPlayerView.frame.size.width, height:self.videoPlayerView.frame.size.height)
self.videoPlayerView.addSubview(self.playerVwController.view)
}
@IBOutlet weak var videoPlayerView: UIView!
var player : AVPlayer!
let playerVwController = AVPlayerViewController()
Upvotes: 0
Views: 4998
Reputation: 3898
Proper way to find a action use KVO to video player contentOverlayView
bounds..
as mentioned Here
Anyway The KVO will not work for iOS 11(i am not sure about this, but we have faced), So you would subclass your
AVPlayerViewController as mentioned Here
Upvotes: 2