0

我正在使用 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

运气好的话?其他解决方案?

4

1 回答 1

0

Apple 有一个完整的 API 用于通过 HTTP 流式传输视频。在https://developer.apple.com/streaming/查看所有详细信息。

于 2013-10-05T15:07:50.177 回答