我正在快速制作简单的电影播放器。我在 ViewController 中有这样的播放器。
我想要这样。
这是代码
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
}
}