Playing a Downloaded Video from the Documents Directory with Cocoa-Touch

家住魔仙堡 提交于 2019-11-30 21:38:24

This looks like some kind of bug, but you have to set your path like that:

 NSString *vidPath = [[NSBundle mainBundle] pathForResource:@"promo" ofType:@"mp4"];
 NSURL *url = [NSURL fileURLWithPath:vidPath isDirectory:NO]; //THIS IS THE KEY TO GET THIS RUN :) 
 [introPlayer setContentURL:url];

Issue will be with this line: NSString *path = [documentsDirectory stringByAppendingPathComponent:@"%@/piggy.m4v"];

Change that to NSString *path = [documentsDirectory stringByAppendingPathComponent:@"piggy.m4v"];

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!