simplemusic: add listener for button presses
parent
44a988f7df
commit
ffc08f0d4c
|
|
@ -20,6 +20,12 @@ Note: On startup, Simple Music will ping Gadgetbridge for track data by quickly
|
|||
|
||||
## Controls
|
||||
|
||||
### Button controls
|
||||
|
||||
Press the side button to toggle playing or pausing the current track.
|
||||
|
||||
### Touch controls
|
||||
|
||||
Use the on-screen buttons to go back to the previous track, play/pause the current track, or skip to the next track.
|
||||
|
||||
Swipe up/down to increase/decrease the volume, or swip left/right to navigate to the previous/next song.
|
||||
|
|
|
|||
|
|
@ -179,8 +179,7 @@ function updateState(state) {
|
|||
/**
|
||||
* Listen for Gadgetbridge events
|
||||
*/
|
||||
setTimeout(
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
globalThis.GB = (_GB => e => {
|
||||
switch (e.t) {
|
||||
case "musicinfo":
|
||||
|
|
@ -194,6 +193,10 @@ setTimeout(
|
|||
})(globalThis.GB);
|
||||
}, 1);
|
||||
|
||||
// Toggle play/pause if the button is pressed
|
||||
setWatch(function() {
|
||||
sendCommand(appState.state === PlaybackState.paused ? Command.play : Command.pause, true);
|
||||
}, BTN, {edge:"rising", debounce:50, repeat:true});
|
||||
|
||||
// Start the app
|
||||
initialize();
|
||||
|
|
|
|||
Loading…
Reference in New Issue