Menu
  • HOME
  • TAGS

Strange orientation behaviour of MovieViewController

ios,swift,orientation,mpmoviewcontroller

You can solve it this way: First of all In your viewDidLoad add this: override func viewDidLoad() { //This observer will call doneButtonClick method when done button is pressed. NSNotificationCenter.defaultCenter().addObserver(self, selector: "doneButtonClick:", name: MPMoviePlayerPlaybackDidFinishNotification, object: nil) var url = NSURL(string: "http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v")! movieViewController = MPMoviePlayerViewController(contentURL: url) } After that add this...

MPMovieController won't dismiss on Done button

ios,xcode,swift,mpmoviewcontroller

You are adding player view as subview. You should remove it (removeFromSuperview) after done button pressed. Use notifications to listen for playback finish: NSNotificationCenter.defaultCenter().addObserver( self, selector: "moviePlayBackDidFinish:", name: MPMoviePlayerPlaybackDidFinishNotification, object: moviePlayer) and moviePlayBackDidFinish: func moviePlayBackDidFinish(notification: NSNotification){ // remove from superview } ...

MPMoviePlayerController ignores MPMovieControlStyle.None in Swift

swift,mpmovieplayercontroller,mpmoviewcontroller

After checking how the view is loaded I'm sure the problem is there. I used a different layout with one Storyboard calling another storyboard and that was the source of the problem.