[Android] Headset control : Add HEADSETHOOK event support

Alexandre Perraud git at videolan.org
Tue Nov 29 16:29:45 CET 2016


vlc-android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Tue Nov 29 16:27:38 2016 +0100| [6dc68bccda46fb2f817c4f7b6b29a46844fb4946] | committer: Alexandre Perraud

Headset control : Add HEADSETHOOK event support

> https://code.videolan.org/videolan/vlc-android/commit/6dc68bccda46fb2f817c4f7b6b29a46844fb4946
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 9f6aabd..c410405 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1047,7 +1047,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
             KeyEvent event = mediaButtonEvent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
             if (event != null) {
                 int keyCode = event.getKeyCode();
-                if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
+                if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE || keyCode == KeyEvent.KEYCODE_HEADSETHOOK) {
                     long time = SystemClock.uptimeMillis();
                     switch (event.getAction()) {
                         case KeyEvent.ACTION_DOWN:



More information about the Android mailing list