MPMoviePlayerViewController播放本地视频一直Loading问题

来源:互联网 发布:数据分析的方法有哪些 编辑:程序博客网 时间:2024/06/05 11:28
大致代码如下:
    NSString *path = [[NSBundle mainBundle]pathForResource:@"7491.mp4" ofType:nil];    NSURL *contentURL = [NSURL URLWithPath:path];    NSLog(@"%@",contentURL);    if (contentURL) {        _player = nil;        self.player.moviePlayer.contentURL = contentURL;        [self presentMoviePlayerViewControllerAnimated:self.player];    }

问题出在URL上,这里的URL需要用+ (NSURL *)fileURLWithPath:(NSString *)path;创建,而不能用urlWithString

费了好久才找到原因

0 0