
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
@capacitor-community/volume-buttons
Advanced tools
Capacitor Volume Buttons. The plugin enables to listen to hardware volume button presses
@capacitor-community/volume-buttons
Capacitor community plugin to listen to hardware volume button presses
Maintainer | GitHub | Active |
---|---|---|
ryaa | ryaa | yes |
This plugins allows to listen for the events fired when the user presses the hardware volume up or down button of the device. An object that contains only one property is passed to the callback - see VolumeButtonsResult. This plugin contains code derived from or inspired by https://github.com/CipherBitCorp/VolumeButtonHandler and https://github.com/thiagobrez/capacitor-volume-buttons plugins.
Features:
disableSystemVolumeHandler
on iOS platform - see VolumeButtonsOptions)NOTE: The plugin version 7.0.0 is compatible with Capacitor 7
Capacitor version | Plugin version |
---|---|
7.x | 7.x |
6.x | 6.x |
5.x | 1.x |
npm install @capacitor-community/volume-buttons
npx cap sync
isWatching() => Promise<GetIsWatchingResult>
Get the watch status of the volume buttons.
Returns: Promise<GetIsWatchingResult>
Since: 1.0.1
watchVolume(options: VolumeButtonsOptions, callback: VolumeButtonsCallback) => Promise<CallbackID>
Set up a watch for he hardware volume buttons changes
Param | Type |
---|---|
options | VolumeButtonsOptions |
callback | VolumeButtonsCallback |
Returns: Promise<string>
Since: 1.0.0
clearWatch() => Promise<void>
Clear the existing watch
Since: 1.0.0
Prop | Type | Description | Since |
---|---|---|---|
value | boolean | If the volume buttons are being watched. | 1.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
disableSystemVolumeHandler | boolean | This parameter can be used to disable the system volume handler (iOS only). If this is true, when up or down volume button is tapped, the system volume will always be reset to either the initial volume (the volume which was current when the volume buttons are started to be tracked/listened) or to 0.05 if the initial volume is less then 0.05 or to 0.95 if the initial volume is greater then 0.95. | 1.0.0 |
suppressVolumeIndicator | boolean | This parameter can be used to suppress/hide the system volume indicator (Android only, it is never shown on iOS already). If this is true, when up or down volume button is tapped, the system volume indicator will not be shown. The default value is false. | 1.0.2 |
Prop | Type | Description | Since |
---|---|---|---|
direction | 'up' | 'down' | This indicates either the volume up or volume down button was pressed. | 1.0.0 |
(result: VolumeButtonsResult, err?: any): void
string
Please also see example-app for a complete example.
import { VolumeButtons } from '@capacitor-community/volume-buttons';
const options: VolumeButtonsOptions = {};
const callback: VolumeButtonsCallback = (result: VolumeButtonsResult, err?: any) => {
console.log('result', result);
};
if (this.platform.is('ios')) {
options.disableSystemVolumeHandler = true;
} else if (this.platform.is('android')) {
options.suppressVolumeIndicator = true;
}
await VolumeButtons.watchVolume(options, callback);
import { VolumeButtons } from '@capacitor-community/volume-buttons';
await VolumeButtons.clearWatch();
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.