[Enhancement]: Shake to rewind #1002

Open
opened 2026-04-24 23:45:23 +02:00 by adam · 7 comments
Owner

Originally created by @gavinorland on GitHub (Jul 26, 2024).

Describe the Feature/Enhancement

Option to shake the phone (whether screen is on or not) to rewind 10s if this app is in the foreground (maybe if it is in the background, too).

Why would this be helpful?

I'll often set a book playing (on Bluetooth earphone) but then turn off the screen and drop my phone in my pocket. The most common requirement for a control thereafter is to rewind 10s (because of a passing car, perhaps). This means taking the phone out, turning the screen on, pressing the rewind button and turning the screen off again.

I'm logging this here partly as a note to self, as I hope to contribute to the codebase at some point.

Audiobookshelf App Version

Android App - 0.9.74

Originally created by @gavinorland on GitHub (Jul 26, 2024). ### Describe the Feature/Enhancement Option to shake the phone (whether screen is on or not) to rewind 10s if this app is in the foreground (maybe if it is in the background, too). ### Why would this be helpful? I'll often set a book playing (on Bluetooth earphone) but then turn off the screen and drop my phone in my pocket. The most common requirement for a control thereafter is to rewind 10s (because of a passing car, perhaps). This means taking the phone out, turning the screen on, pressing the rewind button and turning the screen off again. _I'm logging this here partly as a note to self, as I hope to contribute to the codebase at some point._ ### Audiobookshelf App Version Android App - 0.9.74
adam added the enhancement label 2026-04-24 23:45:23 +02:00
Author
Owner

@advplyr commented on GitHub (Jul 26, 2024):

Do you know of any example apps that have this feature to look at?

@advplyr commented on GitHub (Jul 26, 2024): Do you know of any example apps that have this feature to look at?
Author
Owner

@gavinorland commented on GitHub (Jul 26, 2024):

@advplyr No, I'm afraid not, but I'll keep a lookout..! I've never used Capacitor, but perhaps this sort of area might be the way to go. If we could add an event listener and measure the degree of motion and trigger the rewind from there.

@gavinorland commented on GitHub (Jul 26, 2024): @advplyr No, I'm afraid not, but I'll keep a lookout..! I've never used Capacitor, but perhaps [this](https://capacitorjs.com/docs/apis/motion) sort of area might be the way to go. If we could add an event listener and measure the degree of motion and trigger the rewind from there.
Author
Owner

@advplyr commented on GitHub (Jul 26, 2024):

Only the frontend UI is Capacitor. Things like detecting shaking is done with native Kotlin. Shake detection is already setup for resetting the sleep timer. I was asking for an example because I've not seen this before and wonder how they would implement it. Particularly if the app also had a sleep timer feature since that often has the shake to reset.

@advplyr commented on GitHub (Jul 26, 2024): Only the frontend UI is Capacitor. Things like detecting shaking is done with native Kotlin. Shake detection is already setup for resetting the sleep timer. I was asking for an example because I've not seen this before and wonder how they would implement it. Particularly if the app also had a sleep timer feature since that often has the shake to reset.
Author
Owner

@gavinorland commented on GitHub (Jul 27, 2024):

Right - I see. I'm yet to familiarise myself with the codebase really - I see the shake/timer setting now though.

Possibly, there could be a new settings section called "Shake action", with options widened as follows:

  1. Reset sleep timer (if set)
  2. Rewind 10s
  3. Pause/resume playback
  4. Shake sensitivity

Now to make the scenarios explicit:

If 1 is on and the sleep timer has been set, and the phone is shaken, 2 and 3 would be ignored and the sleep timer would be reset.

If 1 is off or the sleep timer is not set, then if either 2 or 3 are on, then their action would be performed. (2 would only be performed if the book is playing.)

2 and 3 would be mutually exclusive (enabling one would disable the other, if set).

4 would remain as-is.

Just thoughts, from using the app, as I don't use the sleep timer setting and would probably use shake to rewind or stop playback, but happy to go with popular opinion.

@gavinorland commented on GitHub (Jul 27, 2024): Right - I see. I'm yet to familiarise myself with the codebase really - I see the shake/timer setting now though. Possibly, there could be a new settings section called "Shake action", with options widened as follows: 1. Reset sleep timer (if set) 2. Rewind 10s 3. Pause/resume playback 4. Shake sensitivity Now to make the scenarios explicit: If 1 is on and the sleep timer has been set, and the phone is shaken, 2 and 3 would be ignored and the sleep timer would be reset. If 1 is off or the sleep timer is not set, then if either 2 or 3 are on, then their action would be performed. (2 would only be performed if the book is playing.) 2 and 3 would be mutually exclusive (enabling one would disable the other, if set). 4 would remain as-is. Just thoughts, from using the app, as I don't use the sleep timer setting and would probably use shake to rewind or stop playback, but happy to go with popular opinion.
Author
Owner

@gavinorland commented on GitHub (Jul 27, 2024):

After writing the above, btw, I had a look at the settings of the app Podcast Republic and found it handles shake options like this:

Podcast Republic Podcast Republic
@gavinorland commented on GitHub (Jul 27, 2024): After writing the above, btw, I had a look at the settings of the app [Podcast Republic](https://play.google.com/store/apps/details?id=com.itunestoppodcastplayer.app) and found it handles shake options like this: <img alt="Podcast Republic" src="https://github.com/user-attachments/assets/2c4d82fa-d04f-4ed8-b2d6-7db72f8fa9ab" width="250"> <img alt="Podcast Republic" src="https://github.com/user-attachments/assets/30757f41-4d13-43db-9a68-169a5af86922" width="250">
Author
Owner

@advplyr commented on GitHub (Jul 27, 2024):

Ah okay, that makes sense

@advplyr commented on GitHub (Jul 27, 2024): Ah okay, that makes sense
Author
Owner

@gavinorland commented on GitHub (Jul 27, 2024):

Yep... only the one action for shake allowed there, then, instead of the conditionals I had suggested - probably simpler and better.

@gavinorland commented on GitHub (Jul 27, 2024): Yep... only the one action for shake allowed there, then, instead of the conditionals I had suggested - probably simpler and better.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1002