title: iOS 8 - change orientation back to portrait when dismissing full screen AVPlayerViewController
body: <p>my app is a portrait only app, but I have one view controller which is displaying a live stream, using an AVPlayerViewController.</p>
  
  <p>To allow landscape for the full screen view of that player I wrote this method in the <strong>AppDelegate.swift</strong>:</p>
  
  <pre><code>func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -&gt; Int {
      var orientation =  UIInterfaceOrientationMask.Portrait
  
      if let presentedController = window?.rootViewController?.presentedViewController? {
  
          if presentedController.isKindOfClass( NSClassFromString("AVFullScreenViewController").self ) {
              orientation = .AllButUpsideDown
          } else if let navController = presentedController as? UINavigationController {
              if navController.topViewController.isKindOfClass( NSClassFromString("AVFullScreenViewController").self ) {
                 orientation = .AllButUpsideDown
              }
          }
      }
  
      return  Int(orientation.rawValue)
  }
  </code></pre>
  
  <p>This is how I call initialise my AVPlayer:</p>
  
  <pre><code>    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
      if segue.identifier == "showLiveStream" {
  
          SVProgressHUD.show()
          var queue: dispatch_queue_t = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
  
          dispatch_async(queue, {
              let streamURL = NSURL(string: liveStreamURL)
              let playerItem = AVPlayerItem(URL: streamURL)
              let player = AVPlayer(playerItem: playerItem)
  
              dispatch_async(dispatch_get_main_queue(), {
                  SVProgressHUD.dismiss()
                  var playerViewController = segue.destinationViewController as AVPlayerViewController
                  playerViewController.player = player
              })
          })
      }
  }
  </code></pre>
  
  <p>The problem: when I open up the full screen view of the player, then change to landscape and then click "Done" to dismiss the full screen view, my app stays in landscape. But I want it to rotate to portrait again. How can I do that?</p>