Skip to content

Commit

Permalink
add support for a selected subset of VLC hotkeys
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
warren-bank committed Dec 1, 2024
1 parent 46c659c commit c1c971a
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 8 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -1258,12 +1287,6 @@ public boolean dispatchKeyEvent(KeyEvent event) {
}
break;
}

case KeyEvent.KEYCODE_VOLUME_MUTE : {
AirPlay_toggle_volume();
isHandled = true;
break;
}
}
}

Expand Down

0 comments on commit c1c971a

Please sign in to comment.