I'm doing simple movie player in swift. I have player in ViewController like this.
and i want it like this.
Here's code
import UIKit
import MediaPlayer
class DetailViewController: UIViewController {
var moviePlayer:MPMoviePlayerController!
override func viewDidLoad() {
super.viewDidLoad()
var url:NSURL = NSURL(string: "http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v")
moviePlayer = MPMoviePlayerController(contentURL: url)
moviePlayer.view.frame = CGRect(x: 16, y: -100, width: 600, height: 400)
moviePlayer.view.sizeToFit()
self.view.addSubview(moviePlayer.view)
moviePlayer.fullscreen = true
moviePlayer.controlStyle = MPMovieControlStyle.Embedded
}
}
in continuation to Dharmesh reply, please update
moviePlayer.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)
it will then be adjusted as per device screen size.
Hope it helps!