0
我正在使用VLC媒體播放器(MobileVLCKit.framwork)播放.mpd格式文件。在AVCaching播放器的情況下,我們可以選擇緩存,但在這種情況下,我無法添加緩存功能。我試過但沒有得到任何有關解決這個問題的信息。如果任何機構都不能提出解決這個問題的想法,那將是非常好的。我正在開發iOS。緩存在VLC媒體播放器
這是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];
}
}
網絡緩存是否會增加內存消耗,對不對?我嘗試了不同的選擇,但內存消耗沒有改變。我也在初始化和VLCMedia options.VLCKit 3.0.1兩種方式嘗試此選項 –