1

我正在尝试从文件系统项目中的路径加载视频,我有 URL 流的代码

 NSString *path = [[NSBundle mainBundle] pathForResource:@"US_Very_High_Dive_Boudia_US_44_x264" ofType:@"mp4"];
NSData *data = [[NSData alloc] initWithContentsOfFile:path];


MPMoviePlayerController *player =
[[MPMoviePlayerController alloc] initWithContentURL: myURL];
4

1 回答 1

1

你没有。MPMoviePlayer最清楚何时加载数据。将文件路径转换为 ​​a NSURL,甚至更好,只需使用

NSURL *myURL =`[[NSBundle mainBundle] URLForResource:@"US_Very_High_Dive_Boudia_US_44_x264" withExtension:@"mp4"];`
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: myURL];
于 2013-02-21T03:53:40.083 回答