From 18ad1cd58071bd18ee9695b111247f214fb563ad Mon Sep 17 00:00:00 2001 From: jimmymeego Date: Fri, 7 Oct 2016 05:34:01 +0800 Subject: [PATCH] add cookies (#345) --- ios/RCTVideo.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ios/RCTVideo.m b/ios/RCTVideo.m index 97cd4f3b..0cb588ca 100644 --- a/ios/RCTVideo.m +++ b/ios/RCTVideo.m @@ -294,7 +294,12 @@ static NSString *const playbackRate = @"rate"; [NSURL URLWithString:uri] : [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]]; - if (isAsset) { + if (isNetwork) { + NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]; + AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:@{AVURLAssetHTTPCookiesKey : cookies}]; + return [AVPlayerItem playerItemWithAsset:asset]; + } + else if (isAsset) { AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; return [AVPlayerItem playerItemWithAsset:asset]; }