[Android] Implement setting to deactivate audio ducking
Geoffrey Métais
git at videolan.org
Tue Jan 9 15:44:42 CET 2018
vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 9 15:36:20 2018 +0100| [097f1d849b0e36502b99ad2227366dae84e39310] | committer: Geoffrey Métais
Implement setting to deactivate audio ducking
(cherry picked from commit 757426ba6f0644cdf06496b89f1d9946bb3c095b)
> https://code.videolan.org/videolan/vlc-android/commit/097f1d849b0e36502b99ad2227366dae84e39310
---
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 85b2e913c..12e64e685 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 e5271fdb0..f1cd5467e 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -418,7 +418,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