2012-12-13 70 views
0

使用ASIFormDataRequest將HDvideo上傳到服務器。 但它需要長時間來上傳。如何壓縮並上傳高質量視頻到服務器

我的代碼是

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; 

if (movieUrl != Nil) { 
NSData *videoData = [NSData dataWithContentsOfURL:movieUrl]; 
[request addData:videoData withFileName:[movieUrl lastPathComponent] andContentType:@"audio/mp4" forKey:@"video"]; 
[request setRequestMethod:@"POST"]; 
// 
[request setTimeOutSeconds:600]; 

[request setDelegate:self]; 
// 
[request setUploadProgressDelegate:progressView]; 

[request startSynchronous]; 

其中movieurl是imagepickerdidfinish網址回報

movieUrl = (NSURL*)[info objectForKey:UIImagePickerControllerMediaURL]; 

回答

0

那麼你正在做的這一切同步,這意味着你的端口阻塞,顯得反應遲鈍。我會建議使用,這將是方式更加適應異步連接,運行在單獨的線程,而不是阻止主線程。使用方法:

[request startAsynchronous] 
+0

如何壓縮視頻。 –

相關問題