From c1c971a37ea7062bcf28897218c63279bc488ce3 Mon Sep 17 00:00:00 2001 From: "Warren R. Bank" Date: Sat, 30 Nov 2024 22:00:09 -0800 Subject: [PATCH] add support for a selected subset of VLC hotkeys new hotkeys: "N" = next track "P" = previous track "S" = stop "M" = toggle on/off mute "V" = toggle on/off subtitles "F" = reset subtitle offset to 0 "G" = decrease subtitle offset by 1 second (-1000000) "H" = increase subtitle offset by 1 second (+1000000) reference: https://wiki.videolan.org/QtHotkeys/ --- README.md | 31 +++++++++++++++ .../exoplayer2/PlayerManager.java | 39 +++++++++++++++---- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 94844ca..991b8c1 100644 --- a/README.md +++ b/README.md @@ -877,6 +877,37 @@ __extended APIs:__ - - - - +#### Keyboard hotkeys + +* `space` = toggle _pause/play_ +* `N` = next track +* `P` = previous track +* `S` = stop +* `M` = toggle _on/off_ volume mute +* `V` = toggle _on/off_ text captions +* `F` = reset subtitle offset to 0 +* `G` = decrease subtitle offset by 1 second (-1000000) +* `H` = increase subtitle offset by 1 second (+1000000) + +note: not case sensitive, unless `SHIFT` is explicitly specified. + +#### Keyboard media keys / Hardware buttons + +* play +* pause +* play/pause +* stop +* previous +* next +* rewind = 5 seconds +* fast forward = 15 seconds +* captions = toggle _on/off_ +* volume mute = toggle _on/off_ +* volume up +* volume down + +- - - - + #### Credits: * [AirPlay-Receiver-on-Android](https://github.com/gpfduoduo/AirPlay-Receiver-on-Android) diff --git a/android-studio-project/ExoPlayer-AirPlay-Receiver/src/main/java/com/github/warren_bank/exoplayer_airplay_receiver/exoplayer2/PlayerManager.java b/android-studio-project/ExoPlayer-AirPlay-Receiver/src/main/java/com/github/warren_bank/exoplayer_airplay_receiver/exoplayer2/PlayerManager.java index 179f608..524f19d 100644 --- a/android-studio-project/ExoPlayer-AirPlay-Receiver/src/main/java/com/github/warren_bank/exoplayer_airplay_receiver/exoplayer2/PlayerManager.java +++ b/android-studio-project/ExoPlayer-AirPlay-Receiver/src/main/java/com/github/warren_bank/exoplayer_airplay_receiver/exoplayer2/PlayerManager.java @@ -1176,18 +1176,21 @@ public boolean dispatchKeyEvent(KeyEvent event) { break; } + case KeyEvent.KEYCODE_S : case KeyEvent.KEYCODE_MEDIA_STOP : { AirPlay_stop(); isHandled = true; break; } + case KeyEvent.KEYCODE_P : case KeyEvent.KEYCODE_MEDIA_PREVIOUS : { AirPlay_previous(); isHandled = true; break; } + case KeyEvent.KEYCODE_N : case KeyEvent.KEYCODE_MEDIA_NEXT : { AirPlay_next(); isHandled = true; @@ -1208,14 +1211,40 @@ public boolean dispatchKeyEvent(KeyEvent event) { break; } + case KeyEvent.KEYCODE_TV_ZOOM_MODE : { + AirPlay_toggle_resize_mode(); + isHandled = true; + break; + } + + case KeyEvent.KEYCODE_V : case KeyEvent.KEYCODE_CAPTIONS : { AirPlay_toggle_captions(); isHandled = true; break; } - case KeyEvent.KEYCODE_TV_ZOOM_MODE : { - AirPlay_toggle_resize_mode(); + case KeyEvent.KEYCODE_F : { + AirPlay_set_captions_offset(0l); + isHandled = true; + break; + } + + case KeyEvent.KEYCODE_G : { + AirPlay_add_captions_offset(-1000000l); + isHandled = true; + break; + } + + case KeyEvent.KEYCODE_H : { + AirPlay_add_captions_offset(1000000l); + isHandled = true; + break; + } + + case KeyEvent.KEYCODE_M : + case KeyEvent.KEYCODE_VOLUME_MUTE : { + AirPlay_toggle_volume(); isHandled = true; break; } @@ -1258,12 +1287,6 @@ public boolean dispatchKeyEvent(KeyEvent event) { } break; } - - case KeyEvent.KEYCODE_VOLUME_MUTE : { - AirPlay_toggle_volume(); - isHandled = true; - break; - } } }