Problem background
Both react-native-track-player and react-native-video are built on top of the Exoplayer (the application level media player for android).
In the current versions of react-native-track-player and the react-native-video the following exoplayer versions are used:
react-native-track-player (2.1.3):
node_modules\react-native-track-player\android\build.gradle
dependencies {
...
def exoPlayerVersion = safeExtGet("exoPlayerVersion", '2.11.4')
...
}
react-native-video (5.2.0):
node_modules\react-native-video\android-exoplayer\build.gradle
dependencies {
...
implementation('com.google.android.exoplayer:exoplayer:2.13.2') {
exclude group: 'com.android.support'
}
...
implementation('com.google.android.exoplayer:extension-okhttp:2.13.2')
{
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
...
}
As you can see both require different versions of the exoplayer which causes the problem (application crash).
Solution
The available solution is to make sure both packages use the same version of exoplayer. We can achieve this by downgrading one of the packages until it matches the exoplayer version of the other. Since current version react-native-track-player uses the older version of exoplayer (2.11.4) we have no option but to downgrade react-native-video down to the version which use exoplayer 2.11.4 which is the version 5.1.1.
Therefore the problem will be solved if you downgrade the react-native-video down to 5.1.1.
npm i react-native-video@5.1.1
Note: This may cause some minor issues in react-native-video. (ex: textTracks
property of Video
class might not work)