title: How to force landscape mode in AVPlayer?
body: <p>I'm looking for a way to force an AVplayer (Video) to only display itself in landscape mode (home button on the left). Is this possible? </p>
  
  <p>EDIT: Attempted to add 
  playerViewController.supportedInterfaceOrientations = .landscapeLeft</p>
  
  <p>Got error message 
  "Cannot assign to property: 'supportedInterfaceOrientations' is a get-only property"</p>
  
  <pre><code>import AVKit
  import AVFoundation
  
  UIViewController {
      var videoPlayer = AVPlayer()
      var playerViewController = AVPlayerViewController()
  
     override func viewDidAppear(_ animated: Bool) {
       super.viewDidAppear(animated)
       play()
     }
  
     func play() {
       playerViewController.supportedInterfaceOrientations = .landscapeLeft
       let moviePath = Bundle.main.path(forResource: "full video", ofType: "mov")
       if let path = moviePath {
          let url = NSURL.fileURL(withPath: path)
          let videoPlayer = AVPlayer(url: url)
          let playerViewController = AVPlayerViewController()
          playerViewController.player = videoPlayer
          self.present(playerViewController, animated: true) {
              if let validPlayer = playerViewController.player {
                  validPlayer.play()
                  playerViewController.showsPlaybackControls = false
  
                 }
              }
          }
      }
  }
  </code></pre>
  
  <p>EDIT: Attempted to add new subclass of AVPlayerViewController</p>
  
  <pre><code>import UIKit
  import AVFoundation
  import AVKit
  
  class LandscapeVideoControllerViewController: AVPlayerViewController {
  
    override func supportedInterfaceOrientations() -&gt; UIInterfaceOrientationMask {
      return .landscapeLeft
    }
  
  }
  </code></pre>
  
  <p>but getting error message "Method does not override any method from its superclass"</p>