From 0eaf3b2698591e4af18f59ffd6ef43592d9b0c11 Mon Sep 17 00:00:00 2001 From: Josh Habdas Date: Tue, 16 Aug 2016 15:34:14 -0500 Subject: [PATCH] Add instructions for Asset System usage --- README.md | 71 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 35a96916..5e673c7f 100644 --- a/README.md +++ b/README.md @@ -7,16 +7,17 @@ Requires react-native >= 0.19.0 ### Add it to your project -Run `npm install react-native-video --save` +Run `npm i -S react-native-video` #### iOS -Install [rnpm](https://github.com/rnpm/rnpm) and run `rnpm link react-native-video` +Install [rnpm](https://github.com/rnpm/rnpm) and run `rnpm link react-native-video`. If you would like to allow other apps to play music over your video component, add: **AppDelegate.m** -``` + +```objective-c #import // import - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions @@ -34,12 +35,14 @@ Install [rnpm](https://github.com/rnpm/rnpm) and run `rnpm link react-native-vid Or if you have trouble using [rnpm](https://github.com/rnpm/rnpm), make the following additions to the given files manually: **android/settings.gradle** + ``` include ':react-native-video' project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android') ``` **android/app/build.gradle** + ``` dependencies { ... @@ -50,53 +53,56 @@ dependencies { **MainActivity.java** On top, where imports are: + ```java import com.brentvatne.react.ReactVideoPackage; ``` Under `.addPackage(new MainReactPackage())`: + ```java .addPackage(new ReactVideoPackage()) ``` - -### Note:In react-native >= 0.29.0 you have to edit MainApplication.java +### Note: In react-native >= 0.29.0 you have to edit `MainApplication.java` **MainApplication.java** (react-native >= 0.29.0) On top, where imports are: + ```java import com.brentvatne.react.ReactVideoPackage; ``` Under `.addPackage(new MainReactPackage())`: + ```java .addPackage(new ReactVideoPackage()) ``` - - ## Usage ```javascript // Within your render function, assuming you have a file called // "background.mp4" in your project. You can include multiple videos // on a single screen if you like. -