[英]AVPlayer with local video file
我的應用程序中有一個小視頻部分。
所以我找到了這個樣本,它從網址播放mp4視頻: http ://www.sdkboy.com/?p = 66
您可以在此處下載示例: http : //www.sdkboy.com/tutorials/AVFoundation_Test3.zip
但是當我替換NSURL代碼時
NSURL *url = [NSURL URLWithString:@"http://www.samkeeneinteractivedesign.com/videos/littleVid3.mp4"];
有了這個,播放本地視頻,播放器無法正常工作。
NSURL *url = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"malina36" ofType:@"mp4"]];
這個文件存在,我檢查一下
if ([[NSFileManager defaultManager] fileExistsAtPath:url.absoluteString]) {
NSLog(@"yes");
} else {
NSLog(@"no");
}
你能幫助我嗎?
嘗試使用fileURLWithPath:方法而不是URLWithString:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.