使用HTTP NSURL创建AVAsset [英] Creating a AVAsset with a HTTP NSURL

查看:61
本文介绍了使用HTTP NSURL创建AVAsset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试合并两个包含视频参考的NSURLs.这些网址之一指向AWS上的视频,其他网址指向本地存储的视频.我的导出代码有效,因为我已经尝试了两个本地视频,但是每当我尝试合并HTTP URL和本地URL时,都会出现此错误:Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x155d2f20 {NSUnderlyingError=0x155b4f60 "The operation couldn’t be completed. No such file or directory", NSLocalizedDescription=The requested URL was not found on this server.} 这是创建AVAsets的代码:

I'm trying to merge two NSURLs that contain video references. One of the urls point to a video on AWS and the other points to a video that is stored locally. My exporting code works because I've tried it with two local videos, but whenever I try merge the HTTP url and the local url I get this error: Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x155d2f20 {NSUnderlyingError=0x155b4f60 "The operation couldn’t be completed. No such file or directory", NSLocalizedDescription=The requested URL was not found on this server.} This is the code to create the AVAssets:

AVAsset *firstAsset = [AVAsset assetWithURL:awsURL];

AVAssetExportSession是否需要使用本地URL?

Does AVAssetExportSession require local urls to be used?

推荐答案

我将在线网址保存到一个临时目录中,并使用该临时网址合并了视频并使其正常工作.

I saved the online url to a temporary directory and used the temporary url to merge the video and it worked.

    NSData *urlData = [NSData dataWithContentsOfURL:initalURL];
    [urlData writeToFile:path options:NSAtomicWrite error:nil]

这篇关于使用HTTP NSURL创建AVAsset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆