みんな、私はここでいくつかの助けを借りてそれを理解しました。それはそのためのコードです。
- (void) captureOutput:(AVCaptureFileOutput *)captureOutput
didFinishRecordingToOutputFileAtURL:(NSURL *)anOutputFileURL
fromConnections:(NSArray *)connections
error:(NSError *)error
{
videodata = [NSData dataWithContentsOfURL:outputFileURL];
//NSLog(@"output file url is :%@",anOutputFileURL);
NSLog(@"output video data size is:%d", videodata.length);
if ([[self delegate] respondsToSelector:@selector(recorder:recordingDidFinishToOutputFileURL:error:)]) {
[[self delegate] recorder:self recordingDidFinishToOutputFileURL:anOutputFileURL error:error];
}
//NSLog(@"captureOutput is: %@",captureOutput);
// NSLog(@"anOutputFileURL is: %@",anOutputFileURL);
//videoPath = [NSString stringWithContentsOfURL:anOutputFileURL encoding:NSUTF8StringEncoding error:nil];
//videoPath = [anOutputFileURL absoluteString];
//videoURL = anOutputFileURL;
// videodata = captureOutput;
// NSLog(@"video path is: %@",videodata);
UIAlertView *message = [[UIAlertView alloc] initWithTitle:nil
message:@"Do you want to upload this content to the yes stream network ?"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Yes",@"No",nil];
[message show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Yes"])
{
NSLog(@"Yes was selected.");
self.flUploadEngine = [[fileUploadEngine alloc] initWithHostName:@"manektech.net" customHeaderFields:nil];
NSMutableDictionary *postParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"testApp", @"appID",
nil];
self.flOperation = [self.flUploadEngine postDataToServer:postParams path:@"/dilipvideotest/savefile.php"];
[self.flOperation addData:videodata forKey:@"uploadfile" mimeType:@"video/mov" fileName:@"output.mov" ];
[self.flOperation onCompletion:^(MKNetworkOperation *operation) {
NSLog(@"response string is : %@", [operation responseString]);
/*
This is where you handle a successful 200 response
*/
}
onError:^(NSError *error) {
NSLog(@"error : %@", error);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[alert show];
}];
[self.flUploadEngine enqueueOperation:self.flOperation ];
}
else if([title isEqualToString:@"No"])
{
NSLog(@"No was selected.");
//[self readMovie:outputFileURL];
}
}