1.首先导入 MediaPlayer
import MediaPlayer
2.播放事件
class ViewController:UIViewController{
var pc:MPMoviePlayerViewController!
@IBAction func playVideoBtnClicked(sender:AnyObject){
//播放资源
pc=MPMoviePlayerViewController(contentURL:NSBundle.mainBundle().URLForResource("video",
withExtension:"mp4"))
//播放
presentViewController(pc,animated:true,completion:nil)
}
}