From 739a6362bfad44fd4caebf00a782acef3a7169e8 Mon Sep 17 00:00:00 2001 From: Kurt Johnson Date: Thu, 7 Feb 2019 11:02:10 -0500 Subject: [PATCH 1/2] Fix so background audio from other apps can play when disableFocus is true. requestAudioFocus was being run regardless of there being a src, so I made it so that only gets requested when a src exists. --- .../main/java/com/brentvatne/exoplayer/ReactExoplayerView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 64c8a404..87113dbe 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -366,7 +366,7 @@ class ReactExoplayerView extends FrameLayout implements } private boolean requestAudioFocus() { - if (disableFocus) { + if (disableFocus || srcUri == null) { return true; } int result = audioManager.requestAudioFocus(this, From a55b7e5a24371b30c382cf0d5d24498ad2928c30 Mon Sep 17 00:00:00 2001 From: Kurt Johnson Date: Thu, 7 Feb 2019 11:14:27 -0500 Subject: [PATCH 2/2] Added details to readme and changelog --- CHANGELOG.md | 2 +- README.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 280ada24..723c186a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## Changelog ### next - +* Fix Android videos being able to play with background music/audio from other apps. * Fix loading package resolved videos when using video-caching [#1438](https://github.com/react-native-community/react-native-video/pull/1438) ### Version 4.3.0 diff --git a/README.md b/README.md index 8af2d371..20ea61c9 100644 --- a/README.md +++ b/README.md @@ -363,6 +363,13 @@ Controls are not available Android because the system does not provide a stock s Platforms: 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