Setting up Dependencies
Since Bitmovin's native SDKs are distributed through custom CocoaPods and Maven repositories, the installation cannot be managed by React Native's Autolink and requires some extra steps. Please refer to the installation instructions for each platform below. For more information on integrating the native SDKs, you can refer to the Getting Started guides.
Adding the NPM package dependency
The library is available as an NPM package, and can be added as a dependency to your project using any node-based package manager, e.g.:
- npm:
npm install bitmovin-player-react-native --save
- yarn:
yarn add bitmovin-player-react-native
Setting up iOS dependencies
If you ran pod install
in the example/ios
folder after installing the node package and received an error similar to the one below, it is because Bitmovin's custom CocoaPods repository has not been added to the Podfile, and the iOS Player SDK could not be resolved.
[!] Unable to find a specification for `BitmovinPlayer (= 3.xx.x)` depended upon by `RNBitmovinPlayer`
You have either:
- out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
- mistyped the name or version.
- not added the source repo that hosts the Podspec to your Podfile.
To fix above error, open your example/ios/Podfile
and set up Bitmovin's pods source url:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# Bitmovin pods source url
source 'https://github.com/bitmovin/cocoapod-specs.git'
# iOS version should be 14 or greater.
platform :ios, '14.0'
install! 'cocoapods', :deterministic_uuids => false
target 'MyApp' do
config = use_native_modules!
# Rest of Podfile...
Now, run pod install
in the example/ios
folder again (try with --repo-update
if the error persists) - the error should now be resolved.
Setting up Android dependencies
The Android setup also needs an extra step in order to correctly resolve the Android Player SDK native dependency. Add Bitmovin's artifacts repository to the allprojects.repositories
section of your android/build.gradle
file:
allprojects {
repositories {
maven { url("$rootDir/../node_modules/react-native/android") }
maven { url("$rootDir/../node_modules/jsc-android/dist") }
mavenCentral {
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
// Add Bitmovin's artifacts repository url
maven { url 'https://artifacts.bitmovin.com/artifactory/public-releases' }
}
}
Updated 4 months ago