MPMoviePlayer setFullscreen function not working - swift

56 Views Asked by At

I have a video stream in my app which i want to work like youtube player. It mean when the video player is in fullscreen and device is in landscape mode, on rotation to portrate, i want to set video player's fullscreen off. to do that i coded below:

override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
    if toInterfaceOrientation == .Portrait
    {
       self.moviePlayer.setFullscreen(false, animated: true)
    }
}

but when i rotate the device, it's still on fullscreen mode. how can i force movie player to exit fullscreen on orientation?

1

There are 1 best solutions below

0
Andrey Oshev On
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}