Thanks for support. I want to know exactly this that we can not use respondWithData for .ts file . Now I will try to use AVAssetDownloadTask.
Post
Replies
Boosts
Views
Activity
Okay. I will try with AVAssetDownloadTask.
I have a question can we do like this using AVAssetResourceLoadingRequest for .ts
NSString * fileExists = [[DownloadManager sharedManager] fileFullPathOfURL:contentURL];
if ([[NSFileManager defaultManager]fileExistsAtPath:fileExists] && loadingRequest.dataRequest) {
NSData *tsData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:fileExists]];
[loadingRequest.dataRequest respondWithData:tsData];
[loadingRequest finishLoading];
return TRUE;
}
If I am returning the cached .ts file data then I am getting the error: Error Domain=CoreMediaErrorDomain Code=-12881 "custom url not redirect"
Thanks for your quick reply. I am creating manifest file by myself and also downloading all the .ts files in advance . When user clicks on a video for play then I will pass manifest file data to player using Assetdelegate and ts data if file has downloaded otherwise with
valid url so that play can play that ts file from server not from cache .
I am using custom schemes so that I am getting call-backs in asset delegates .
I have already manifest files data & dummy m3u8 url with custom scheme.
I want to pre-cache some portion of video .
Thanks for your quick reply. Suppose I have multiple .ts files for a video, some of .ts are pre cached & some .ts needs to fetch from the server . I want to play like this.
I need help..
Thanks for your reply. I am creating a custom playlists (m3u8) & passing it to player and it is working fine with the custom scheme.
In this method "shouldWaitForLoadingOfRequestedResource" when there is a call for ts segment with the custom scheme .
I am replacing the custom scheme with the https.
NSURLRequest *redirect = nil;
NSString *url = loadingRequest.request.URL.absoluteString;
NSRange tldr = [url rangeOfString:@"//"];
if (![url hasPrefix:@"http"] && tldr.location != NSNotFound) {
url = [url stringByReplacingCharactersInRange:NSMakeRange(0, tldr.location) withString:@"https:"];
}
redirect = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[loadingRequest setRedirect:redirect];
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:[redirect URL] statusCode:302 HTTPVersion:nil headerFields:nil];
[loadingRequest setResponse:response];
[loadingRequest finishLoading];
and it is working fine ..
My question is how I can pass downloaded ts file. if there is a downloaded ts then return that otherwise do above step
I am also facing the same issue .. I also want to play the cached .ts segment if available otherwise from the server . But getting the same error mention above.
Any solution will helpful