diff --git a/docs/pages/index.md b/docs/pages/index.md index e7ab0d7942..9652d953e2 100644 --- a/docs/pages/index.md +++ b/docs/pages/index.md @@ -3,8 +3,8 @@ ## About `react-native-video` is a React Native library that provides a Video component that renders media content such as videos and streams -## Alpha Information -> ⚠️ **Version 6 Alpha**: The following documentation may refer to features only available through the v6.0.0 alpha releases, [please see version 5.2.x](https://github.com/react-native-video/react-native-video/blob/v5.2.0/README.md) for the current documentation! +## Beta Information +> ⚠️ **Version 6 Beta**: The following documentation may refer to features only available through the v6.0.0 alpha releases, [please see version 5.2.x](https://github.com/react-native-video/react-native-video/blob/v5.2.0/README.md) for the current documentation! Version 6.x recommends react-native >= 0.68.2. @@ -56,15 +56,15 @@ var styles = StyleSheet.create({ Version 6.0.0 is introducing dozens of breaking changes, mostly through updated dependencies and significant refactoring. While the API remains compatible, the significant internal changes require full testing with your app to ensure all functionality remains operational. Please view the [Changelog](CHANGELOG.md) for specific breaking changes. -### Installing Version 6.0.0 Alphas +### Installing Version 6.0.0 Beta -Whilst we finalise version 6.0.0 you can install the latest alpha from npm +Whilst we finalise version 6.0.0 you can install the latest beta from npm Using npm: ```bash -npm install --save react-native-video@alpha +npm install --save react-native-video@beta ``` @@ -72,6 +72,6 @@ using yarn: ```bash -yarn add react-native-video@alpha +yarn add react-native-video@beta ``` \ No newline at end of file diff --git a/docs/pages/installation.md b/docs/pages/installation.md index 4638b33e34..5217e524ef 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -23,36 +23,17 @@ Then follow the instructions for your platform to link react-native-video into y ### Standard Method -**React Native 0.60 and above** - -Run `npx pod-install`. Linking is not required in React Native 0.60 and above. - -**React Native 0.59 and below** - -Run `react-native link react-native-video` to link the react-native-video library. - ### Enable Static Linking for dependencies in your ios project Podfile Add `use_frameworks! :linkage => :static` just under `platform :ios` in your ios project Podfile. -[See the example ios project for reference](examples/basic/ios/Podfile#L5) - -### Using CocoaPods - -Setup your Podfile like it is described in the [react-native documentation](https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies). +[See the example ios project for reference](https://github.com/react-native-video/react-native-video/blob/9c669a2d8a53df36773fd82ff0917280d0659bc7/examples/basic/ios/Podfile#L31C38-L31C38) -Depending on your requirements you have to choose between the two possible subpodspecs: - -Video only: - -```diff - pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' -+ `pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'` - end -``` ### Enable custom feature in podfile file -### Video caching +Samples available in sample app see [sample pod file](https://github.com/react-native-video/react-native-video/blob/9c669a2d8a53df36773fd82ff0917280d0659bc7/examples/basic/ios/Podfile#L34) + +#### Video caching To enable Video caching usage, add following line in your podfile: ([more info here](other/caching.md)) @@ -77,25 +58,6 @@ $RNVideoUseGoogleIMA=true ## Android -### Autolinking - -Linking is not required in React Native 0.60 and above. - -If your project is using React Native < 0.60, run `react-native link react-native-video` to link the react-native-video library. - -If you have trouble, make the following additions to the given files manually: - -`android/settings.gradle` - -Add player source in build configuration - -```gradle -include ':react-native-video' -project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android') -``` - -`android/build.gradle` - From version >= 6.0.0, your application needs to have kotlin version >= 1.7.0 ```: @@ -106,53 +68,6 @@ buildscript { } ``` -`android/app/build.gradle` - -From version >= 5.0.0, you have to apply these changes: - -```diff -dependencies { - ... - compile project(':react-native-video') -+ implementation "androidx.appcompat:appcompat:1.0.0" -- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - -} -``` - -`android/gradle.properties` - -Migrating to AndroidX (needs version >= 5.0.0): - -```gradle.properties -android.useAndroidX=true -android.enableJetifier=true -``` - -`MainApplication.java` - -If using com.facebook.react.PackageList to auto import native dependencies, there are no updates required here. Please see the [android example project](https://github.com/react-native-video/react-native-video/tree/master/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java) for more details. - -### For manual linking - -On top, where imports are: - -```java -import com.brentvatne.react.ReactVideoPackage; -``` - -Add the `ReactVideoPackage` class to your list of exported packages. - -```java -@Override -protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new ReactVideoPackage() - ); -} -``` - ### Enable custom feature in gradle file #### Enable client side ads insertion @@ -168,6 +83,8 @@ buildscript { } ``` +See [sample app](https://github.com/react-native-video/react-native-video/blob/9c669a2d8a53df36773fd82ff0917280d0659bc7/examples/basic/android/build.gradle#L14C5-L14C5) +
Windows diff --git a/docs/pages/updating.md b/docs/pages/updating.md index d0e4fd35d1..2f6e3696af 100644 --- a/docs/pages/updating.md +++ b/docs/pages/updating.md @@ -4,84 +4,33 @@ #### iOS +##### linking In your project Podfile add support for static dependency linking. This is required to support the new Promises subdependency in the iOS swift conversion. Add `use_frameworks! :linkage => :static` just under `platform :ios` in your ios project Podfile. [See the example ios project for reference](examples/basic/ios/Podfile#L5) -### Version 5.0.0 +##### podspec -Probably you want to update your gradle version: -#### gradle-wrapper.properties -```diff -- distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip -+ distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip -``` - -#### **android/app/build.gradle** - -From version >= 5.0.0, you have to apply this changes: +You can remove following lines from your podfile as they are not necessary anymore ```diff -dependencies { - ... - compile project(':react-native-video') -+ implementation "androidx.appcompat:appcompat:1.0.0" -- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" +- `pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'` -} +- `pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'` ``` -#### **android/gradle.properties** - -Migrating to AndroidX (needs version >= 5.0.0): +If you were previously using VideoCaching, you should $RNVideoUseVideoCaching flag in your podspec, see: [installation section](https://react-native-video.github.io/react-native-video/installation#video-caching) -```groovy -android.useAndroidX=true -android.enableJetifier=true -``` - -#### Gradle 3 and target SDK 26 requirement -In order to support ExoPlayer 2.9.0, you must use version 3 or higher of the Gradle plugin. This is included by default in React Native 0.57. +#### Android -#### ExoPlayer 2.9.0 Java 1.8 requirement -ExoPlayer 2.9.0 uses some Java 1.8 features, so you may need to enable support for Java 1.8 in your app/build.gradle file. If you get an error, compiling with ExoPlayer like: -`Default interface methods are only supported starting with Android N (--min-api 24)` +If you are already using Exoplayer on V5, you should remove the patch done from **android/settings.gradle** -Add the following to your app/build.gradle file: -```groovy -android { - ... // Various other settings go here - compileOptions { - targetCompatibility JavaVersion.VERSION_1_8 - } -} -``` - -#### ExoPlayer no longer detaches -When using a router like the react-navigation TabNavigator, switching between tab routes would previously cause ExoPlayer to detach causing the video player to pause. We now don't detach the view, allowing the video to continue playing in a background tab. This matches the behavior for iOS. - -#### useTextureView now defaults to true -The SurfaceView, which ExoPlayer has been using by default has a number of quirks that people are unaware of and often cause issues. This includes not supporting animations or scaling. It also causes strange behavior if you overlay two videos on top of each other, because the SurfaceView will [punch a hole](https://developer.android.com/reference/android/view/SurfaceView) through other views. Since TextureView doesn't have these issues and behaves in the way most developers expect, it makes sense to make it the default. - -TextureView is not as fast as SurfaceView, so you may still want to enable SurfaceView support. To do this, you can set `useTextureView={false}`. - - -### Version 3.0.0 - -#### All platforms now auto-play -Previously, on Android ExoPlayer if the paused prop was not set, the media would not automatically start playing. The only way it would work was if you set `paused={false}`. This has been changed to automatically play if paused is not set so that the behavior is consistent across platforms. - -#### All platforms now keep their paused state when returning from the background -Previously, on Android MediaPlayer if you setup an AppState event when the app went into the background and set a paused prop so that when you returned to the app the video would be paused it would be ignored. - -Note, Windows does not have a concept of an app going into the background, so this doesn't apply there. - -#### Use Android target SDK 27 by default -Version 3.0 updates the Android build tools and SDK to version 27. React Native is in the process of [switching over](https://github.com/facebook/react-native/issues/18095#issuecomment-395596130) to SDK 27 in preparation for Google's requirement that new Android apps [use SDK 26](https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html) by August 2018. - -You will either need to install the version 27 SDK and version 27.0.3 buildtools or modify your build.gradle file to configure react-native-video to use the same build settings as the rest of your app as described below. +```diff +- include ':react-native-video' +- project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer') +`````` ##### Using app build settings You will need to create a `project.ext` section in the top-level build.gradle file (not app/build.gradle). Fill in the values from the example below using the values found in your app/build.gradle file.