我正在尝试从我的文件系统项目中的路径加载视频,我有 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];
最佳答案
你不知道。 MPMoviePlayer
最了解何时加载数据。将文件路径转换为 NSURL
,或者更好,只需使用
NSURL *myURL =`[[NSBundle mainBundle] URLForResource:@"US_Very_High_Dive_Boudia_US_44_x264" withExtension:@"mp4"];`
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: myURL];
关于ios - 从文件路径加载视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14994202/