我正在使用 ASIHttpRequest 下载视频文件,下载完成后,我可以在目标路径中获取下载的文件。但根据我的要求,我想使用播放当前下载的视频MPMoviePlayerController
,如何获取当前下载的NSData
格式字节来播放它MPMoviePlayerController
?
即,如果视频为 200mb,并且我已经下载了 50mb,那么在下载剩余视频时,我还可以播放 50mb 视频。
这是我下载文件的代码。
NSURL *url = [NSURL URLWithString:urlString];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request setTag:tag];
[request setTimeOutSeconds:60.f];
[request setShowAccurateProgress:YES];
[request setDownloadProgressDelegate:progressView];
[request setDidFinishSelector:@selector(requestFinished:)];
[request setDidFailSelector:@selector(requestFailed:)];
// These delgates won't working
// [request setDidReceiveResponseHeadersSelector:<#(SEL)#>]
// [request setDidStartSelector:<#(SEL)#>]
[request setDownloadDestinationPath:downloadPath];
[request setAllowResumeForFileDownloads:YES];
[request setShouldContinueWhenAppEntersBackground:YES];
[request startAsynchronous];
//this will not call because I set UIProgressView to show downloading progress, to call it I need to set `self`
-(void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes
运气好的话?其他解决方案?