捕获视频和音频并将其写入iPhone中的服务器

时间:2011-03-02 15:41:53

标签: iphone video

我尝试捕获视频并将其写入以下网址。我收到此错误。

代码:

videoURL = [[NSURL alloc] initWithString:@"http://belterra.webiguide.com/uploadimages/VideoRecord.mpeg4"];

_videoWriter = [[AVAssetWriter alloc] initWithURL:videoURL fileType:AVFileTypeQuickTimeMovie
                                            error:&error];

例外:

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[AVAssetWriter initWithURL:fileType:error:] 
invalid parameter not satisfying: [outputURL isFileURL]'
    *** Call stack at first throw:
    (
        0   CoreFoundation           0x314d0987 __exceptionPreprocess + 114
        1   libobjc.A.dylib          0x319a149d objc_exception_throw + 24
        2   AVFoundation             0x30690421 -[AVAssetWriter initWithURL:fileType:error:] + 188
        3   iChat                    0x00003155 -[AVCaptureVideo setupWriter] + 116
        4   iChat                    0x000030a3 -[AVCaptureVideo startVideoRecording] + 26
        5   iChat                    0x000039ed -[AVCaptureVideo initCapture] + 1112

<snip>

    )

1 个答案:

答案 0 :(得分:2)

invalid parameter not satisfying: [outputURL isFileURL]'

它看起来像是期望本地文件路径,但是采用URL格式,例如file://....

来自文档

Initializes an asset writer for writing to the file identified by a given URL in a format specified by a given UTI.

然后,您必须单独管理上传到您的网络服务器。