我正在使用VLC媒体播放器(MobileVLCKit.framwork)播放.mpd格式文件。在AVCaching Player的情况下,我们有缓存选项,但在这种情况下我无法添加缓存功能。我试过但没有得到任何有关解决这个问题的信息。如果任何一个机构能够提供很少的想法来解决这个问题,那就太好了。我正在开发iOS开发。
这是AVcaching player catch的代码,并希望VLC Media Player缓存相同。
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
Log(@"response received");
if(self.videoCacheObject.response == nil){
self.videoCacheObject.response = (NSHTTPURLResponse *)response;
}
if([self.delegate respondsToSelector:@selector(requestDidReceiveResponse)]){
[self.delegate requestDidReceiveResponse];
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
[self.videoCacheObject.videoData appendData:data];
Log(@"video data length = %lu", (unsigned long)self.videoCacheObject.videoData.length);
if(self.videoCacheObject.videoData.length > PARTIAL_LOAD_LENGTH * self.videoCacheObject.response.expectedContentLength && shouldLoadPartial){
[[TMCache sharedCache] setObject:self.videoCacheObject forKey:self.videoName];
[self.connection cancel];
if([self.delegate respondsToSelector:@selector(requestPrefetchingCompleted)]){
Log(@"prefetching completed");
[self.delegate requestPrefetchingCompleted];
}
}
else if(self.videoCacheObject.videoData.length > 0.15*self.videoCacheObject.response.expectedContentLength){
[[TMCache sharedCache] setObject:self.videoCacheObject forKey:self.videoName];
}
if([self.delegate respondsToSelector:@selector(requestDidReceiveData)]){
[self.delegate requestDidReceiveData];
}
}
答案 0 :(得分:3)
MobileVLCKit不允许您以这种方式进行缓存。
你基本上有两个选择:
MobileVLCKit的未来版本将添加第三个选项,即VLC的内存输入模块,因此您可以在内存中提供数据而无需先将它们存储到本地,但是在秋天之前它还没有准备好生产今年。