[Android] Mute vlc sound instead of device

Geoffrey Métais git at videolan.org
Wed Mar 11 11:47:53 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 11 11:47:23 2015 +0100| [783202b6f840d3e8b1d9af93b32d1666483fec76] | committer: Geoffrey Métais

Mute vlc sound instead of device

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=783202b6f840d3e8b1d9af93b32d1666483fec76
---

 .../videolan/vlc/gui/video/VideoPlayerActivity.java |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 4419475..1f265ae 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -871,13 +871,14 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
         case KeyEvent.KEYCODE_BUTTON_X:
             onAudioSubClick(mTracks);
             return true;
-        case KeyEvent.KEYCODE_M:
+        case KeyEvent.KEYCODE_N:
         case KeyEvent.KEYCODE_MENU:
             showNavMenu();
             return true;
         case KeyEvent.KEYCODE_A:
             resizeVideo();
             return true;
+        case KeyEvent.KEYCODE_M:
         case KeyEvent.KEYCODE_VOLUME_MUTE:
             updateMute();
             return true;
@@ -1767,17 +1768,11 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
     }
 
     private void updateMute () {
-        if (!mMute) {
-            mVolSave = Float.floatToIntBits(mVol);
-            mMute = true;
-            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);
-            showInfo(R.string.sound_off,1000);
-        } else {
-            mVol = mVolSave;
-            mMute = false;
-            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, Float.floatToIntBits(mVol), 0);
-            showInfo(R.string.sound_on,1000);
-        }
+        mMute = !mMute;
+        if (mMute)
+            mVolSave = mLibVLC.getVolume();
+        mLibVLC.setVolume(mMute ? 0 : mVolSave);
+            showInfo(mMute ? R.string.sound_off : R.string.sound_on,1000);
     }
 
     @TargetApi(android.os.Build.VERSION_CODES.FROYO)



More information about the Android mailing list