Ok so on my app when the user clicks a button a video is streamed from a server and it opens in the MPMoviePlayerViewController.
This is the code for when the user clicks the button:
@IBAction func WatchPressed(sender: AnyObject)
{self.presentMoviePlayerViewControllerAnimated(movieViewController)}
Basically I want to know whether or not I could lock the orientation of the main view controller that the button is placed on, and then support all orientations for when the MPMoviePlayerViewController is presented? If so could I use the standard supported device orientations code?
EDIT:
When using this code:
    var movieplayer : MPMoviePlayerController!
    @IBAction func WatchPressed(sender: AnyObject)
    {self.presentMoviePlayerViewControllerAnimated(movieViewController)
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "Rotated", name: UIDeviceOrientationDidChangeNotification, object: nil)
    }
}
func Rotated()
{
    if UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation)
    {
        if UIDevice.currentDevice().orientation.rawValue == 4 ||  UIDevice.currentDevice().orientation.rawValue == 3
        {
            movieplayer.view.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height)
        }
    }
    else if UIDeviceOrientationIsPortrait(UIDevice.currentDevice().orientation)
    {
        if UIDevice.currentDevice().orientation.rawValue == 1 || UIDevice.currentDevice().orientation.rawValue == 2
        {
            movieplayer.view.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height)
            let value = UIInterfaceOrientation.Portrait.rawValue
            UIDevice.currentDevice().setValue(value, forKey: "orientation")
        }
    }
I get this error:

                        
You can solve it this way:
First of all In your viewDidLoad add this:
After that add this method:
Which will forcibly change your orientation to portrait.
It is working fine.
Credit to @Dharmesh_Kheni