[Android] Propose stopping unpausable audio on pause

Nicolas Pomepuy git at videolan.org
Tue Apr 13 06:38:04 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Apr  7 09:05:04 2021 +0200| [235c20218211035286f5cc7ecff19bdde43b0b23] | committer: Nicolas Pomepuy

Propose stopping unpausable audio on pause

Fixes #1473

> https://code.videolan.org/videolan/vlc-android/commit/235c20218211035286f5cc7ecff19bdde43b0b23
---

 application/resources/src/main/res/values/strings.xml               | 1 +
 .../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt       | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index e62c0aaca..b1071abc3 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -789,5 +789,6 @@
     <string name="preferred_resolution_summary">Maximum video quality for streams, when applicable, will be: %s</string>
     <string name="pref_resolution_best_available">Best available</string>
     <string name="pref_resolution_very_low">Very low definition (240p)</string>
+    <string name="stop_unpaubale">This media cannot be paused. Stop it instead?</string>
 
 </resources>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 5d5b002b7..d15ed9687 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -364,6 +364,12 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
     }
 
     fun onPlayPauseClick(view: View) {
+        if (playlistModel.service?.isPausable == false) {
+            UiTools.snackerConfirm(requireActivity(), getString(R.string.stop_unpaubale)) {
+                playlistModel.stop()
+            }
+            return
+        }
         playlistModel.togglePlayPause()
     }
 



More information about the Android mailing list