diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c6b23f..d0fd1d94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ### Version 4.4.3 +* Fix Android videos being able to play with background music/audio from other apps. * Fixed memory leak on iOS when using `controls` [#1647](https://github.com/react-native-community/react-native-video/pull/1647) * (Android) Update gradle and target SDK [#1629](https://github.com/react-native-community/react-native-video/pull/1629) * Fix iOS stressed mount/unmount crash [#1646](https://github.com/react-native-community/react-native-video/pull/1646) diff --git a/README.md b/README.md index 00b73bee..6b26cb40 100644 --- a/README.md +++ b/README.md @@ -372,6 +372,13 @@ For Android MediaPlayer, you will need to build your own controls or use a packa Platforms: Android ExoPlayer, iOS, react-native-dom +#### disableFocus +Determines whether video audio should override background music/audio in Android devices. +* ** false (default)** - Override background audio/music +* **true** - Let background audio/music from other apps play + +Platforms: Android Exoplayer + #### filter Add video filter * **FilterType.NONE (default)** - No Filter diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 175ef84f..bea3e20e 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -449,7 +449,7 @@ class ReactExoplayerView extends FrameLayout implements } private boolean requestAudioFocus() { - if (disableFocus) { + if (disableFocus || srcUri == null) { return true; } int result = audioManager.requestAudioFocus(this,