Open gavinorland opened 1 month ago
Do you know of any example apps that have this feature to look at?
@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.
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.
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:
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.
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:
Ah okay, that makes sense
Yep... only the one action for shake allowed there, then, instead of the conditionals I had suggested - probably simpler and better.
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