[Android] Implement setting to deactivate audio ducking

Geoffrey Métais git at videolan.org
Tue Jan 16 17:45:43 CET 2018


vlc-android | branch: chromecast | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan  9 15:36:20 2018 +0100| [757426ba6f0644cdf06496b89f1d9946bb3c095b] | committer: Geoffrey Métais

Implement setting to deactivate audio ducking

> https://code.videolan.org/videolan/vlc-android/commit/757426ba6f0644cdf06496b89f1d9946bb3c095b
---

 vlc-android/res/values/strings.xml                    | 2 ++
 vlc-android/res/xml/preferences_audio.xml             | 5 +++++
 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 35404d904..4b1f1c5fd 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -365,6 +365,8 @@
     <string name="aout_summary">Change the method that VLC uses to output audio.</string>
     <string name="aout_audiotrack" translatable="false">AudioTrack</string>
     <string name="aout_opensles" translatable="false">OpenSL ES</string>
+    <string name="audio_ducking_title">Lower VLC volume on notifications</string>
+    <string name="audio_ducking_summary">Helps to hear audio notifications, navigation instructions or assistant talking</string>
 
     <string name="extensions_prefs_category">Extensions</string>
     <string name="extensions_enable_category">Chose extensions to enable</string>
diff --git a/vlc-android/res/xml/preferences_audio.xml b/vlc-android/res/xml/preferences_audio.xml
index a6d704a20..a55af3f18 100644
--- a/vlc-android/res/xml/preferences_audio.xml
+++ b/vlc-android/res/xml/preferences_audio.xml
@@ -45,6 +45,11 @@
     </PreferenceCategory>
 
     <PreferenceCategory android:title="@string/advanced_prefs_category">
+        <CheckBoxPreference
+            android:key="audio_ducking"
+            android:defaultValue="true"
+            android:summary="@string/audio_ducking_summary"
+            android:title="@string/audio_ducking_title" />
         <ListPreference
             android:defaultValue="0"
             android:entries="@array/aouts"
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 5c0727e36..e84d2f010 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -397,7 +397,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
                         if (isPlaying()) {
                             if (AndroidDevices.isAmazon) {
                                 pausePlayback();
-                            } else {
+                            } else if (mSettings.getBoolean("audio_ducking", true)) {
                                 final int volume = AndroidDevices.isAndroidTv ? getVolume()
                                         : mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
                                 if (audioDuckLevel == -1)



More information about the Android mailing list