Hi I'm using react native, so I needed exoplayer to show subtitle on it in android.... I added exoplayer inside my app, after that should I do something to use exoplayer as default or it will link to react-native-video ? thanks
According to the react native video ExoPlayer documentation, there are some ExoPlayer only props. Use one of them in your app and check if they're being called or not.
You can change the path of the project like this.
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
// Add below this line ↑
include ':react-native-video' // -> you must add this line on new version
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':app'
look here for more details
It will start to use android-exoplayer
I'v also added
android:usesCleartextTraffic="true"
in AndroidManifest.xml
to make it work in release builds as well.
If it doesn't help, please add
import com.brentvatne.react.ReactVideoPackage;
...
@Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new ReactVideoPackage()); // <<< This line
return packages;
}
to MainApplication.java
As of now ExoPlayer is not autolinked with react-native-video
. To link it with your project and use it, create a file named react-native.config.js in your project root. Then add the following code in the file:
module.exports = {
dependencies: {
'react-native-video': {
platforms: {
android: {
sourceDir: '../node_modules/react-native-video/android-exoplayer'
}
}
}
}
}
Hope this will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With