capacitor-volume-control
v0.0.1
Published
Adjust system-level volume in your Capacitor Apps.
Readme
capacitor-volume-control
Adjust system-level volume in your Capacitor Apps.
The value are normalized to 0-100 range
Supported platforms
| Platform | Supported | | -------- | --------- | | Android | ✅ | | iOS | ✅⚠️ (untested) | | Web | ❌ |
Install
pnpm install capacitor-volume-control
pnpm exec cap syncUsage
import { VolumeControl } from 'capacitor-volume-control';
// Set the volume:
const volume = 50;
await VolumeControl.setvolume({ volume });
// Get the current volume:
const {volume: currentvolume} = await VolumeControl.getvolume();API
getVolume(...)
getVolume(options?: { streamType?: StreamType | undefined; } | undefined) => Promise<{ volume: number }>| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| options | { streamType?: StreamType; } |
Returns: Promise<{ volume: number }>
setVolume(...)
setVolume(options: { volume: number; showUI?: boolean; streamType?: StreamType; }) => Promise<void>| Param | Type |
| ------------- | ----------------------------------------------------------------------------------------------------- |
| options | { volume: number; showUI?: boolean; streamType?: StreamType; } |
Returns: Promise<void>
Type Aliases
StreamType
'STREAM_VOICE_CALL' | 'STREAM_SYSTEM' | 'STREAM_RING' | 'STREAM_MUSIC' | 'STREAM_ALARM' | 'STREAM_NOTIFICATION' | 'STREAM_DTMF'
