MPMoviePlayerViewController不能播放本地mp4的解决办法.

之前一直用MPMoviePlayerViewController进行网络播放,最近下载文件然后本地播放,发现怎么播放都是黑屏.后来发现MPMoviePlayerViewController的本地URL不能使用[NSURL urlStringFrom]这个方法.下面贴下正确代码

 NSString *path1=[[NSBundle mainBundle] pathForResource:@"fuck" ofType:@"mp4"];

        NSURL *url = [NSURL fileURLWithPath:path1];

        YYMoviePlayerViewController *vcPlayVC = [[YYMoviePlayerViewController  alloc]initWithContentURL:url];

        vcPlayVC.moviePlayer.movieSourceType = MPMovieSourceTypeFile;

        [self presentMoviePlayerViewControllerAnimated:vcPlayVC];

 

你可能感兴趣的:(controller)