gpt4 book ai didi

ios - 带有本地视频文件的 AVPlayer

转载 作者:可可西里 更新时间:2023-11-01 05:02:00 48 4
gpt4 key购买 nike

我的应用程序中有一个小视频部分。

所以我找到了这个示例,它播放来自 url 的 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:

关于ios - 带有本地视频文件的 AVPlayer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15965813/

48 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com