Reputation: 3
I'm using VLC Media Player (MobileVLCKit.framwork) for playing .mpd format file. In the case of AVCaching Player, we have option for caching but in this case I'm not able to add caching feature. I tried but not getting any info about solving this problem. It would be great if any body can give few ideas to solve this problem. I'm working on iOS development.
This is the code for AVcaching player catch and want the same for VLC Media Player caching.
-(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];
}
}
Upvotes: 0
Views: 3762
Reputation: 1831
MobileVLCKit does not allow you to do caching this way.
You basically have 2 options:
Future versions of MobileVLCKit will add a third option, namely a memory input module to VLC, so you can provide your data in memory without storing them to a local first, but this won't be ready for production before fall this year.
Upvotes: 3