respecting cookies when opting in for headers (ios)
This commit is contained in:
parent
2d89a3fd54
commit
f340025a09
@ -328,12 +328,14 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]];
|
[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]];
|
||||||
|
|
||||||
if (isNetwork) {
|
if (isNetwork) {
|
||||||
|
NSMutableDictionary *assetOptions = [[NSMutableDictionary alloc]init];
|
||||||
if ([headers count] > 0) {
|
if ([headers count] > 0) {
|
||||||
AVURLAsset* asset = [AVURLAsset URLAssetWithURL:url options:@{@"AVURLAssetHTTPHeaderFieldsKey": headers}];
|
[assetOptions setObject:@headers forKey:@"AVURLAssetHTTPHeaderFieldsKey"]
|
||||||
return [AVPlayerItem playerItemWithAsset:asset];
|
|
||||||
}
|
}
|
||||||
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
|
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
|
||||||
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:@{AVURLAssetHTTPCookiesKey : cookies}];
|
[assetOptions setObject:@cookies forKey:@AVURLAssetHTTPCookiesKey]
|
||||||
|
|
||||||
|
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:assetOptions];
|
||||||
return [AVPlayerItem playerItemWithAsset:asset];
|
return [AVPlayerItem playerItemWithAsset:asset];
|
||||||
}
|
}
|
||||||
else if (isAsset) {
|
else if (isAsset) {
|
||||||
|
Loading…
Reference in New Issue
Block a user