Commit aa439470 authored by Ash Mishra's avatar Ash Mishra
Browse files

Fix issue with embedded Bundle videos in Release configuration

parent fa30fb3e
Loading
Loading
Loading
Loading
+6 −2
Changes for ios/RCTVideo.m: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -347,8 +347,12 @@ static int const RCTVideoUnset = -1;
}

- (NSURL*) urlFilePath:(NSString*) filepath {
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  if ([filepath containsString:@"file://"]) {
    return [NSURL URLWithString:filepath];
  }
  
  // code to support local caching
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString* relativeFilePath = [filepath lastPathComponent];
  // the file may be multiple levels below the documents directory
  NSArray* fileComponents = [filepath componentsSeparatedByString:@"Documents/"];
@@ -384,7 +388,7 @@ static int const RCTVideoUnset = -1;
    NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
    [assetOptions setObject:cookies forKey:AVURLAssetHTTPCookiesKey];
    asset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:uri] options:assetOptions];
  } else if (isAsset) { //  assets on iOS have to be in the Documents folder
  } else if (isAsset) { //  assets on iOS can be in the Bundle or Documents folder
    asset = [AVURLAsset URLAssetWithURL:[self urlFilePath:uri] options:nil];
  } else { // file passed in through JS, or an asset in the Xcode project
    asset = [AVURLAsset URLAssetWithURL:[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]] options:nil];