docs/pages/installation.md
Using npm:
npm install --save react-native-video
or using yarn:
yarn add react-native-video
Then follow the instructions for your platform to link react-native-video into your project.
Run pod install in the ios directory of your project.
⚠️ From version 6.0.0, the minimum iOS version required is 13.0. For more information, see the updating section.
Sample configurations are available in the sample app. See the sample pod file.
To enable video caching, add the following line to your Podfile: (more info here)
# Enable Video Caching
$RNVideoUseVideoCaching=true
Google IMA is the SDK for client-side ads integration. See the Google documentation for more details.
To enable Google IMA, add the following line to your Podfile:
$RNVideoUseGoogleIMA=true
If you are using Expo, you can use the Expo plugin.
</details> <details> <summary>Android</summary>Note: If you are enabling video caching (using
$RNVideoUseVideoCaching), you must add the following to yourGemfile:rubygem "cocoapods-swift-modular-headers"Then, install dependencies using:
shbundle install bundle exec pod installThis enables Swift modular headers for Swift dependencies.
From version >= 6.0.0, your application must use Kotlin version >= 1.8.0.
buildscript {
...
ext.kotlinVersion = '1.8.0'
ext.compileSdkVersion = 34
ext.targetSdkVersion = 34
...
}
If you are using Expo, you can use the Expo plugin.
You can enable or disable the following features by setting the corresponding variables in your android/build.gradle file:
useExoplayerIMA - Enable Google IMA SDK (ads support)useExoplayerRtsp - Enable RTSP supportuseExoplayerSmoothStreaming - Enable SmoothStreaming supportuseExoplayerDash - Enable Dash supportuseExoplayerHls - Enable HLS supportEach enabled feature increases the APK size, so only enable what you need.
By default, the enabled features are:
useExoplayerSmoothStreaminguseExoplayerDashuseExoplayerHlsExample:
buildscript {
ext {
...
useExoplayerIMA = true
useExoplayerRtsp = true
useExoplayerSmoothStreaming = true
useExoplayerDash = true
useExoplayerHls = true
...
}
}
See the sample app.
</details> <details> <summary>Windows</summary>React Native Windows 0.63 and above
Autolinking should automatically add react-native-video to your app.
React Native Windows 0.62
Make the following manual additions:
windows\myapp.slnAdd the ReactNativeVideoCPP project to your solution:
node_modules\react-native-video\windows\ReactNativeVideoCPP\ReactNativeVideoCPP.vcxproj.windows\myapp\myapp.vcxprojAdd a reference to ReactNativeVideoCPP to your main application project:
pch.hAdd:
#include "winrt/ReactNativeVideoCPP.h"
app.cppAdd:
PackageProviders().Append(winrt::ReactNativeVideoCPP::ReactPackageProvider());
before InitializeComponent();.
React Native Windows 0.61 and below
Follow the manual linking steps for React Native Windows 0.62, but use ReactNativeVideoCPP61 instead of ReactNativeVideoCPP.
</details> <details> <summary>tvOS</summary>react-native link react-native-video does not work properly with the tvOS target, so the library must be added manually.
Select your project in Xcode.
Select the tvOS target of your application and open the "General" tab.
Scroll to "Linked Frameworks and Libraries" and click the + button.
Select RCTVideo-tvOS.
Run pod install in the visionos directory of your project.
No additional setup is required. Everything should work out of the box.
However, only basic video support is available. HLS, Dash, ads, and DRM are not currently supported.
</details>