capacitor-community / volume-buttons

Capacitor Volume Buttons. The plugin enables to listen to hardware volume button presses. This plugin is based on https://github.com/thiagobrez/capacitor-volume-buttons
MIT License
7 stars 1 forks source link

Long press / press and hold function #7

Open stnbndr opened 2 months ago

stnbndr commented 2 months ago

Is your feature request related to a problem? Please describe. At the moment it is not possible to hold a button. The callback function is called immediately until the release.

Describe the solution you'd like Would it be possible to enable a function to differer between a one time press and a long press / press and hold and the release?

Additional context As an example, I press and hold the volume down button to start some speech recording and when the button is released a speech-to-text function gets startet. A bit like an old school walkie-talkie 😅

ryaa commented 2 months ago

@stnbndr I think that this feature https://github.com/capacitor-community/volume-buttons/issues/6 should satisfy your needs. It should allow to subscribe to receive the appropriate events on key down, key up or both, and therefore you can track when a volume button was pressed and released. Please let me know your thoughts.

stnbndr commented 2 months ago

@ryaa thanks for your feedback. I have read through the feature #6 request. That sounds good to me. I think that could also solve my problem. I'm looking forward for the next release of the plugin with that feature included 😁 Thank you for your work!

Litte side note: I have already testet the plugin with Capacitor 6.0 and it was working out-of-the-box 👍