update example project and fix build errors

This commit is contained in:
Laurin Quast 2018-07-17 14:36:03 +02:00
parent 6cfea3aacb
commit 5d7b296680
8 changed files with 263 additions and 88 deletions

View File

@ -22,6 +22,10 @@ DerivedData
*.xcuserstate
project.xcworkspace
# CocoaPods
ios/Pods
ios/*.xcworkspace
# Android/IntelliJ
#
build/

View File

@ -0,0 +1,32 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'VideoCaching' do
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'RCTAnimation',
'RCTActionSheet',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'RCTPushNotification',
'RCTCameraRoll',
'RCTSettings',
'RCTBlob',
'RCTGeolocation',
'DevSupport'
]
pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
end

View File

@ -0,0 +1,125 @@
PODS:
- boost-for-react-native (1.63.0)
- DoubleConversion (1.1.5)
- DVAssetLoaderDelegate (0.3.1)
- Folly (2016.10.31.00):
- boost-for-react-native
- DoubleConversion
- glog
- glog (0.3.4)
- React (0.56.0):
- React/Core (= 0.56.0)
- react-native-video (3.1.0):
- DVAssetLoaderDelegate (= 0.3.1)
- React
- SPTPersistentCache (= 1.1.0)
- React/Core (0.56.0):
- yoga (= 0.56.0.React)
- React/CxxBridge (0.56.0):
- Folly (= 2016.10.31.00)
- React/Core
- React/cxxreact
- React/cxxreact (0.56.0):
- boost-for-react-native (= 1.63.0)
- Folly (= 2016.10.31.00)
- React/jschelpers
- React/jsinspector
- React/DevSupport (0.56.0):
- React/Core
- React/RCTWebSocket
- React/fishhook (0.56.0)
- React/jschelpers (0.56.0):
- Folly (= 2016.10.31.00)
- React/PrivateDatabase
- React/jsinspector (0.56.0)
- React/PrivateDatabase (0.56.0)
- React/RCTActionSheet (0.56.0):
- React/Core
- React/RCTAnimation (0.56.0):
- React/Core
- React/RCTBlob (0.56.0):
- React/Core
- React/RCTCameraRoll (0.56.0):
- React/Core
- React/RCTImage
- React/RCTGeolocation (0.56.0):
- React/Core
- React/RCTImage (0.56.0):
- React/Core
- React/RCTNetwork
- React/RCTLinkingIOS (0.56.0):
- React/Core
- React/RCTNetwork (0.56.0):
- React/Core
- React/RCTPushNotification (0.56.0):
- React/Core
- React/RCTSettings (0.56.0):
- React/Core
- React/RCTText (0.56.0):
- React/Core
- React/RCTVibration (0.56.0):
- React/Core
- React/RCTWebSocket (0.56.0):
- React/Core
- React/fishhook
- React/RCTBlob
- SPTPersistentCache (1.1.0)
- yoga (0.56.0.React)
DEPENDENCIES:
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/GLog.podspec`)
- react-native-video (from `../node_modules/react-native-video/react-native-video.podspec`)
- React/Core (from `../node_modules/react-native`)
- React/CxxBridge (from `../node_modules/react-native`)
- React/DevSupport (from `../node_modules/react-native`)
- React/RCTActionSheet (from `../node_modules/react-native`)
- React/RCTAnimation (from `../node_modules/react-native`)
- React/RCTBlob (from `../node_modules/react-native`)
- React/RCTCameraRoll (from `../node_modules/react-native`)
- React/RCTGeolocation (from `../node_modules/react-native`)
- React/RCTImage (from `../node_modules/react-native`)
- React/RCTLinkingIOS (from `../node_modules/react-native`)
- React/RCTNetwork (from `../node_modules/react-native`)
- React/RCTPushNotification (from `../node_modules/react-native`)
- React/RCTSettings (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
- React/RCTVibration (from `../node_modules/react-native`)
- React/RCTWebSocket (from `../node_modules/react-native`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga/yoga.podspec`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- boost-for-react-native
- DVAssetLoaderDelegate
- SPTPersistentCache
EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
glog:
:podspec: "../node_modules/react-native/third-party-podspecs/GLog.podspec"
React:
:path: "../node_modules/react-native"
react-native-video:
:path: "../node_modules/react-native-video/react-native-video.podspec"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga/yoga.podspec"
SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: a9706f16e388b53ff12cca34473428ee29746a26
DVAssetLoaderDelegate: 7d1e43ec1e98660b918a65fc50edf3d73e1f0ea6
Folly: c89ac2d5c6ab169cd7397ef27485c44f35f742c7
glog: b3b0330915eccea41c5cc9731a77cf564a9be5ea
React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11
react-native-video: 87e0a64ccdeca6ff26182a036650cc13e3817e3f
SPTPersistentCache: df36ea46762d7cf026502bbb86a8b79d0080dff4
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85
PODFILE CHECKSUM: a72d15643ecf681eee8bfdb9918eaa0cba0620f7
COCOAPODS: 1.5.3

View File

@ -34,10 +34,10 @@
2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; };
2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
2DCD954D1E0B4F2C00145EB5 /* VideoCachingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* VideoCachingTests.m */; };
499AA48B2048CC3D0004ACC3 /* libRCTVideo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 499AA4642048CC200004ACC3 /* libRCTVideo.a */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
D1FC585BCEC69367C235A632 /* libPods-VideoCaching.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 08B9A2A39DE457E6FCFA0DF3 /* libPods-VideoCaching.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -223,20 +223,6 @@
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
remoteInfo = "jschelpers-tvOS";
};
499AA4632048CC200004ACC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 499AA44C2048CC200004ACC3 /* RCTVideo.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTVideo;
};
499AA4652048CC200004ACC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 499AA44C2048CC200004ACC3 /* RCTVideo.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 641E28441F0EEC8500443AF6;
remoteInfo = "RCTVideo-tvOS";
};
499AA47B2048CC200004ACC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
@ -340,6 +326,8 @@
00E356EE1AD99517003FC87E /* VideoCachingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VideoCachingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* VideoCachingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoCachingTests.m; sourceTree = "<group>"; };
08B9A2A39DE457E6FCFA0DF3 /* libPods-VideoCaching.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-VideoCaching.a"; sourceTree = BUILT_PRODUCTS_DIR; };
09C735C3EBC6DB072F4866AE /* Pods-VideoCaching.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VideoCaching.debug.xcconfig"; path = "Pods/Target Support Files/Pods-VideoCaching/Pods-VideoCaching.debug.xcconfig"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* VideoCaching.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VideoCaching.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -353,11 +341,11 @@
2D02E47B1E0B4A5D006451C7 /* VideoCaching-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "VideoCaching-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* VideoCaching-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "VideoCaching-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
499AA44C2048CC200004ACC3 /* RCTVideo.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVideo.xcodeproj; path = "../node_modules/react-native-video/ios/RCTVideo.xcodeproj"; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
F26E57FA9826531B8B01D2A9 /* Pods-VideoCaching.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VideoCaching.release.xcconfig"; path = "Pods/Target Support Files/Pods-VideoCaching/Pods-VideoCaching.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -373,7 +361,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
499AA48B2048CC3D0004ACC3 /* libRCTVideo.a in Frameworks */,
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */,
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
@ -387,6 +374,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
D1FC585BCEC69367C235A632 /* libPods-VideoCaching.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -535,19 +523,11 @@
isa = PBXGroup;
children = (
2D16E6891FA4F8E400B85C8A /* libReact.a */,
08B9A2A39DE457E6FCFA0DF3 /* libPods-VideoCaching.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
499AA44D2048CC200004ACC3 /* Products */ = {
isa = PBXGroup;
children = (
499AA4642048CC200004ACC3 /* libRCTVideo.a */,
499AA4662048CC200004ACC3 /* libRCTVideo.a */,
);
name = Products;
sourceTree = "<group>";
};
5E91572E1DD0AC6500FF2AA8 /* Products */ = {
isa = PBXGroup;
children = (
@ -569,7 +549,6 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
499AA44C2048CC200004ACC3 /* RCTVideo.xcodeproj */,
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
146833FF1AC3E56700842450 /* React.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
@ -603,6 +582,7 @@
00E356EF1AD99517003FC87E /* VideoCachingTests */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
C56355F3A1157B4497284CC6 /* Pods */,
);
indentWidth = 2;
sourceTree = "<group>";
@ -629,6 +609,15 @@
name = Products;
sourceTree = "<group>";
};
C56355F3A1157B4497284CC6 /* Pods */ = {
isa = PBXGroup;
children = (
09C735C3EBC6DB072F4866AE /* Pods-VideoCaching.debug.xcconfig */,
F26E57FA9826531B8B01D2A9 /* Pods-VideoCaching.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -654,6 +643,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "VideoCaching" */;
buildPhases = (
115319CC17BBCF9B0C5519F6 /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
@ -780,10 +770,6 @@
ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
},
{
ProductGroup = 499AA44D2048CC200004ACC3 /* Products */;
ProjectRef = 499AA44C2048CC200004ACC3 /* RCTVideo.xcodeproj */;
},
{
ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
@ -972,20 +958,6 @@
remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
499AA4642048CC200004ACC3 /* libRCTVideo.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTVideo.a;
remoteRef = 499AA4632048CC200004ACC3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
499AA4662048CC200004ACC3 /* libRCTVideo.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTVideo.a;
remoteRef = 499AA4652048CC200004ACC3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
499AA47C2048CC200004ACC3 /* libjsinspector.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1128,6 +1100,24 @@
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
115319CC17BBCF9B0C5519F6 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-VideoCaching-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -1246,6 +1236,7 @@
};
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 09C735C3EBC6DB072F4866AE /* Pods-VideoCaching.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
@ -1264,6 +1255,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = F26E57FA9826531B8B01D2A9 /* Pods-VideoCaching.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;

View File

@ -7,13 +7,13 @@
"test": "jest"
},
"dependencies": {
"react": "16.2.0",
"react-native-video": "file:../../react-native-video-2.0.0.tgz",
"react-native": "0.53.3"
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-video": "file:../.."
},
"devDependencies": {
"babel-jest": "22.4.1",
"babel-preset-react-native": "4.0.0",
"babel-preset-react-native": "5.0.2",
"express": "^4.16.2",
"jest": "22.4.2",
"react-test-renderer": "16.2.0"

View File

@ -0,0 +1,7 @@
const blacklist = require('metro').createBlacklist;
module.exports = {
getBlacklistRE: function() {
return blacklist([/node_modules\/react-native-video\/examples\/.*/]);
}
};

View File

@ -348,7 +348,8 @@ static NSString *const timedMetadata = @"timedMetadata";
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// perform on next run loop, otherwise other passed react-props may not be set
_playerItem = [self playerItemForSource:source];
[self playerItemForSource:source withCallback:^(AVPlayerItem * playerItem) {
_playerItem = playerItem;
[self addPlayerItemObservers];
[_player pause];
@ -379,7 +380,7 @@ static NSString *const timedMetadata = @"timedMetadata";
@"target": self.reactTag
});
}
}];
});
_videoLoadStarted = YES;
}
@ -401,7 +402,7 @@ static NSString *const timedMetadata = @"timedMetadata";
return nil;
}
- (void)playerItemPrepareText:(AVAsset *)asset withCallback:(void(^)(AVPlayerItem *))handler
- (void)playerItemPrepareText:(AVAsset *)asset assetOptions:(NSMutableDictionary * __nullable)assetOptions withCallback:(void(^)(AVPlayerItem *))handler
{
if (!_textTracks) {
handler([AVPlayerItem playerItemWithAsset:asset]);
@ -455,28 +456,30 @@ static NSString *const timedMetadata = @"timedMetadata";
NSURL *url = (isNetwork || isAsset) ?
[NSURL URLWithString:uri] :
[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]];
NSMutableDictionary *assetOptions = [[NSMutableDictionary alloc] init];
if (isNetwork) {
[_videoCache getItemForUri:uri withCallback:^(AVAsset * _Nullable asset) {
if (asset) {
[self playerItemPrepareText:asset withCallback:handler];
[self playerItemPrepareText:asset assetOptions:assetOptions withCallback:handler];
return;
}
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
DVURLAsset * dvAsset = [[DVURLAsset alloc] initWithURL:url options:@{AVURLAssetHTTPCookiesKey : cookies} networkTimeout: 10000];
[assetOptions setObject:cookies forKey:AVURLAssetHTTPCookiesKey];
DVURLAsset * dvAsset = [[DVURLAsset alloc] initWithURL:url options:assetOptions networkTimeout: 10000];
dvAsset.loaderDelegate = self;
[self playerItemPrepareText:dvAsset withCallback:handler];
[self playerItemPrepareText:dvAsset assetOptions:assetOptions withCallback:handler];
}];
return;
}
else if (isAsset) {
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
[self playerItemPrepareText:asset withCallback:handler];
[self playerItemPrepareText:asset assetOptions:assetOptions withCallback:handler];
return;
}
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:uri ofType:type]] options:nil];
[self playerItemPrepareText:asset withCallback:handler];
[self playerItemPrepareText:asset assetOptions:assetOptions withCallback:handler];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
@ -1069,6 +1072,18 @@ static NSString *const timedMetadata = @"timedMetadata";
_playerLayer = nil;
}
#pragma mark - DVAssetLoaderDelegate
- (void)dvAssetLoaderDelegate:(DVAssetLoaderDelegate *)loaderDelegate
didLoadData:(NSData *)data
forURL:(NSURL *)url {
[_videoCache storeItem:data forUri:[url absoluteString] withCallback:^(BOOL success) {
#ifdef DEBUG
NSLog(@"data stored succesfully 🎉");
#endif
}];
}
#pragma mark - RCTVideoPlayerViewControllerDelegate
- (void)videoPlayerViewControllerWillDismiss:(AVPlayerViewController *)playerViewController

View File

@ -36,7 +36,7 @@
#endif
[self createTemporaryPath];
self.videoCache = [[SPTPersistentCache alloc] initWithOptions:options];
[self.videoCache scheduleGarbageCollection];
[self.videoCache scheduleGarbageCollector];
}
return self;
}