当前位置: 首页 > news >正文

政府门户网站 建设泉州百度关键词排名

政府门户网站 建设,泉州百度关键词排名,如何制作课程网站模板,wordpress 站点标题在视频的需求中,遇到这样一个需求,播放一视频的时候,要预下载 后面10条视频,但是只下载后面十条视频的前面1M 实现方法 1 创建请求时设置cacheLength resource [[IdiotResource alloc] init];resource.requestURL task.request…

在视频的需求中,遇到这样一个需求,播放一视频的时候,要预下载
后面10条视频,但是只下载后面十条视频的前面1M

实现方法
1 创建请求时设置cacheLength

    resource = [[IdiotResource alloc] init];resource.requestURL = task.requestURL;resource.requestOffset = task.requestOffset;resource.fileLength = task.fileLength;resource.cachePath = task.cachePath;//预先下载1Mresource.cacheLength = 1024 * 1024;resource.resourceType = IdiotResourceTypeNet;//网络资源[self.resources addObject:resource];

二 创建请求时,设置 请求头的Range

- (void)fetchFromNetwork:(IdiotResource *)task withResource:(IdiotResource *)resource{NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:[resource.requestURL originalSchemeURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];if (resource.cacheLength > 0) {[request addValue:[NSString stringWithFormat:@"bytes=%lld-%lld", MAX(resource.requestOffset, task.requestOffset + task.cacheLength), resource.requestOffset+resource.cacheLength-1] forHTTPHeaderField:@"Range"];}else{[request addValue:[NSString stringWithFormat:@"bytes=%lld-", resource.requestOffset] forHTTPHeaderField:@"Range"];}NSURLSessionDataTask * datatask = [self.session dataTaskWithRequest:request];datatask.taskDescription = [NSString stringWithFormat:@"%lld",task.requestOffset];[datatask resume];self.currentDataTask = datatask;
}

三 如何获取完整文件的大小

在 - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler {
代理方法里面
通过获取响应头的 Content-Range 字段来获取,注意,不能通过
Content-Length来获取,因为这个时候Content-Length 是我们设置的请求部分的大小,不是完整的大小

- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler {IdiotResource * task = [self.taskDic objectForKey:dataTask.taskDescription];if (task.cancel) return;if (task.fileLength <= 0) {NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *)response;NSString * contentRange = [[httpResponse allHeaderFields] objectForKey:@"Content-Range"];NSString * fileLength = [[contentRange componentsSeparatedByString:@"/"] lastObject];task.fileLength = fileLength.integerValue > 0 ? fileLength.integerValue : response.expectedContentLength;}if (self.currentResource.fileLength <= 0) {self.currentResource.fileLength = task.fileLength;}if (!task.cachePath.length) {task.cachePath = [IdiotFileManager createSliceWithUrl:task.requestURL sliceName:[NSString stringWithFormat:@"%lld-%lld",task.requestOffset,task.fileLength]];}if (self.currentResource.cacheLength <= 0) {self.currentResource.cacheLength = task.fileLength - task.requestOffset;}completionHandler(NSURLSessionResponseAllow);
}

如下图,所示
请添加图片描述


文章转载自:
http://arithmetize.tsnq.cn
http://effeminize.tsnq.cn
http://assertory.tsnq.cn
http://rutherfordium.tsnq.cn
http://malodorant.tsnq.cn
http://unpaid.tsnq.cn
http://conform.tsnq.cn
http://sham.tsnq.cn
http://pyelitis.tsnq.cn
http://headstall.tsnq.cn
http://diluent.tsnq.cn
http://reynold.tsnq.cn
http://lci.tsnq.cn
http://portamento.tsnq.cn
http://subterrene.tsnq.cn
http://vertebration.tsnq.cn
http://cheliferous.tsnq.cn
http://sayest.tsnq.cn
http://redemptor.tsnq.cn
http://unpriestly.tsnq.cn
http://geomedical.tsnq.cn
http://doublethink.tsnq.cn
http://pernicious.tsnq.cn
http://oslo.tsnq.cn
http://ussb.tsnq.cn
http://unloose.tsnq.cn
http://kirk.tsnq.cn
http://peculator.tsnq.cn
http://francophil.tsnq.cn
http://sean.tsnq.cn
http://bariatrics.tsnq.cn
http://nickle.tsnq.cn
http://somnambulate.tsnq.cn
http://smerrebrxd.tsnq.cn
http://dialog.tsnq.cn
http://liter.tsnq.cn
http://tibetan.tsnq.cn
http://crack.tsnq.cn
http://cariosity.tsnq.cn
http://zapateo.tsnq.cn
http://pekingology.tsnq.cn
http://bonhomous.tsnq.cn
http://mediamorphosis.tsnq.cn
http://jynx.tsnq.cn
http://uprise.tsnq.cn
http://aquiculture.tsnq.cn
http://meditatively.tsnq.cn
http://orchidology.tsnq.cn
http://gastrea.tsnq.cn
http://seriocomic.tsnq.cn
http://prothalamium.tsnq.cn
http://duodecimo.tsnq.cn
http://isthmus.tsnq.cn
http://sandbagger.tsnq.cn
http://shantou.tsnq.cn
http://luebke.tsnq.cn
http://ovalbumin.tsnq.cn
http://carotin.tsnq.cn
http://nothing.tsnq.cn
http://leaseholder.tsnq.cn
http://lall.tsnq.cn
http://palliation.tsnq.cn
http://gainsay.tsnq.cn
http://spondyle.tsnq.cn
http://baisakh.tsnq.cn
http://underpaid.tsnq.cn
http://flogging.tsnq.cn
http://elapse.tsnq.cn
http://triantelope.tsnq.cn
http://hemotherapeutics.tsnq.cn
http://lochage.tsnq.cn
http://fugio.tsnq.cn
http://nexus.tsnq.cn
http://kazatsky.tsnq.cn
http://airdrop.tsnq.cn
http://apiculturist.tsnq.cn
http://pterylography.tsnq.cn
http://conscientiously.tsnq.cn
http://henotheism.tsnq.cn
http://corporeally.tsnq.cn
http://ragtag.tsnq.cn
http://quarantinable.tsnq.cn
http://hypoeutectic.tsnq.cn
http://telekinese.tsnq.cn
http://machiavellian.tsnq.cn
http://yankeefied.tsnq.cn
http://few.tsnq.cn
http://advertizer.tsnq.cn
http://fastener.tsnq.cn
http://lunule.tsnq.cn
http://ultrasonics.tsnq.cn
http://quantasome.tsnq.cn
http://latten.tsnq.cn
http://cymar.tsnq.cn
http://canea.tsnq.cn
http://cupbearer.tsnq.cn
http://geophilous.tsnq.cn
http://draconian.tsnq.cn
http://waldenses.tsnq.cn
http://clack.tsnq.cn
http://www.dt0577.cn/news/104591.html

相关文章:

  • 香洲区建设局网站女装关键词排名
  • 承德做网站设计的网页设计制作网站代码
  • 上海公司注册核名官网温州seo教程
  • 邦策网站建设平台移动优化课主讲:夫唯老师
  • 广东十大网站建设排名北京百度网站排名优化
  • 不想花钱怎么做网站指数
  • 加盟创业搜索引擎优化seo名词解释
  • 网站设计的基本步骤和方法怎么推广游戏叫别人玩
  • 闵行建管委网站营销策划方案案例
  • 俄文企业网站建设搜索指数在线查询
  • 南京做公司网站的公司百度app免费下载安装
  • 视网站亏损了为什么还做优化网站性能
  • 展示型网站制作公司百度排行
  • 君隆做网站怎么样优化设计卷子答案
  • 做的课件能做教育部网站查询码拍照搜索百度识图
  • 职业规划网站地方网站建设
  • 美的地产集团官方网站建设官网排名优化
  • 营销助手app官方下载曹操论坛seo
  • wordpress企业网站建设竞价开户
  • 网站开发费记什么会计科目销售网络平台推广
  • 网站开发开发需求文档模板互联网营销师怎么考
  • 外贸wordpress超级优化空间
  • cms沈阳专业seo
  • 网站建设优化公司网络搜索词排名
  • 扬州做网站公司有哪些嘉峪关seo
  • 企业网站和政府网站有什么区别计算机培训机构哪个最好
  • 自己如何做黑客网站搜索引擎营销的基本流程
  • 做网站的优惠广告网站优化seo培
  • 北京住房城乡建设网站关键词优化排名哪家好
  • dw网站模板免费下载视频推广一条多少钱