{"_rev":"12-353515313fc5fa269c291c3f60eec8f3","time":{"created":"2025-09-02T16:59:03.507Z","modified":"2025-09-02T16:59:04.091Z","1.0.0":"2025-08-31T10:12:34.590Z","1.0.1":"2025-08-31T10:25:27.571Z","1.0.2":"2025-08-31T11:13:41.006Z","1.0.3":"2025-08-31T11:26:02.854Z","1.0.4":"2025-08-31T11:34:33.459Z","1.0.5":"2025-08-31T13:03:12.978Z","1.0.6":"2025-08-31T13:28:45.613Z","1.0.7":"2025-09-02T16:59:03.796Z"},"_id":"@4gency/capacitor-volume","name":"@4gency/capacitor-volume","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.7":{"name":"@4gency/capacitor-volume","version":"1.0.7","description":"A Capacitor plugin to control device volume with ratio-based API (0.0 to 1.0). Full support on Android (API 21+), read-only on iOS (11.0+), limited support on Web. Compatible with Capacitor 5+.","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"4gency","email":"contact@4gency.fr","url":"Gauthier JEANJACQUOT"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/4gency-fr/capacitor-volume.git"},"bugs":{"url":"https://github.com/4gency-fr/capacitor-volume/issues"},"homepage":"http://www.4gency.fr","keywords":["capacitor","plugin","volume","android","ios","web","audio","sound","ratio","4gency"],"scripts":{"verify":"npm run verify:web","verify:android":"echo \"Android verification skipped - use Android Studio to build manually\"","verify:web":"npm run build","lint":"npm run eslint && npm run prettier -- --check","fmt":"npm run eslint -- --fix && npm run prettier -- --write","eslint":"eslint . --ext ts","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","docgen":"docgen --api VolumePlugin --output-readme README.md --output-json dist/docs.json","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.js","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"devDependencies":{"@capacitor/android":"^5.0.0","@capacitor/core":"^5.0.0","@capacitor/docgen":"^0.2.2","@capacitor/ios":"^5.0.0","@ionic/eslint-config":"^0.4.0","@ionic/prettier-config":"^4.0.0","@rollup/plugin-node-resolve":"^16.0.1","eslint":"^8.57.0","prettier":"~3.2.5","prettier-plugin-java":"~2.5.0","rimraf":"^5.0.5","rollup":"^4.9.6","typescript":"~5.3.3"},"peerDependencies":{"@capacitor/core":"^5.0.0"},"prettier":"@ionic/prettier-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"publishConfig":{"access":"public"},"_id":"@4gency/capacitor-volume@1.0.7","gitHead":"d6b731b0281b4c14bc2414c8fabbeb09204c246c","_nodeVersion":"22.12.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-ve/shTXkkggrlY8hmTlbQ3/+Se5lqYmuhXMGN408v1LTq6i4JhL1NoJjohpXGgdY2nxG1O1FwY/yjoLsx8XZDw==","shasum":"3450a3d9057ccac9394985fe16aa68de3842da52","tarball":"https://registry.npmjs.org/@4gency/capacitor-volume/-/capacitor-volume-1.0.7.tgz","fileCount":25,"unpackedSize":59332,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD9ximbl3ZhO7lIve4mUOS0D5FcOF/mQypGqgjJZ6b32QIgIEnKYndJj46Vlgtj/96/Fj/CcLismA5U1SH/LIFOeEU="}]},"_npmUser":{"name":"gjjqt","email":"gauthier@jeanja.co"},"directories":{},"maintainers":[{"name":"gjjqt","email":"gauthier@jeanja.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/capacitor-volume_1.0.7_1756832343616_0.7198207612573142"},"_hasShrinkwrap":false}},"maintainers":[{"name":"gjjqt","email":"gauthier@jeanja.co"}],"description":"A Capacitor plugin to control device volume with ratio-based API (0.0 to 1.0). Full support on Android (API 21+), read-only on iOS (11.0+), limited support on Web. Compatible with Capacitor 5+.","homepage":"http://www.4gency.fr","keywords":["capacitor","plugin","volume","android","ios","web","audio","sound","ratio","4gency"],"repository":{"type":"git","url":"git+https://github.com/4gency-fr/capacitor-volume.git"},"author":{"name":"4gency","email":"contact@4gency.fr","url":"Gauthier JEANJACQUOT"},"bugs":{"url":"https://github.com/4gency-fr/capacitor-volume/issues"},"license":"MIT","readme":"# @4gency/capacitor-volume\n\nA Capacitor plugin to control device volume with a ratio-based API (0.0 to 1.0). Cross-platform support with different capabilities per platform.\n\n## Compatibility\n\n- **Capacitor**: 5.0+\n- **Android**: API 21+ (Android 5.0+, 2014)\n- **iOS**: 11.0+ (2017)\n- **Node**: 16+\n\n## Platform Support\n\n| Platform | Get Volume | Set Volume | Notes                                               |\n| -------- | ---------- | ---------- | --------------------------------------------------- |\n| Android  | ✅ Full    | ✅ Full    | Complete system volume control for all stream types |\n| iOS      | ✅ Limited | ❌ No      | Read-only via AVAudioSession (Apple restriction)    |\n| Web      | ✅ Limited | ✅ Limited | HTML5 media elements and Web Audio API only         |\n\n## Installation\n\n```bash\nnpm install @4gency/capacitor-volume\nnpx cap sync\n```\n\n## Usage\n\n```typescript\nimport { Volume, StreamType } from '@4gency/capacitor-volume';\n\n// Check platform support\nconst support = await Volume.isVolumeControlSupported();\nconsole.log(`Platform: ${support.platform}`);\nconsole.log(`Can get volume: ${support.canGetVolume}`);\nconsole.log(`Can set volume: ${support.canSetVolume}`);\n\n// Get current volume (returns 0.0 to 1.0)\nconst result = await Volume.getVolume();\nconsole.log(`Volume: ${Math.round(result.volume * 100)}%`);\n\n// Set volume (0.0 = mute, 1.0 = max)\nawait Volume.setVolume({ volume: 0.75 }); // 75%\nawait Volume.setVolume({ volume: 0.0 }); // Mute\nawait Volume.setVolume({ volume: 1.0 }); // Maximum\n\n// Android only - specific stream types\nawait Volume.setVolume({\n  volume: 0.5,\n  streamType: StreamType.NOTIFICATION,\n});\n\n// Get all volume levels\nconst allVolumes = await Volume.getAllVolumes();\nconsole.log(allVolumes);\n```\n\n## Stream Types (Android)\n\n```typescript\nenum StreamType {\n  MUSIC = 'MUSIC', // Media/Music (default)\n  RING = 'RING', // Ringtone\n  NOTIFICATION = 'NOTIFICATION', // Notifications\n  ALARM = 'ALARM', // Alarms\n  VOICE_CALL = 'VOICE_CALL', // Voice calls\n  SYSTEM = 'SYSTEM', // System sounds\n}\n```\n\n## Platform Limitations\n\n### iOS\n\n- **Read-only**: Can only get current system volume\n- **Apple restriction**: Cannot set volume programmatically\n- **User control**: Volume must be changed via physical buttons or Control Center\n\n### Web\n\n- **Limited scope**: Only affects HTML5 media elements and Web Audio API\n- **No system control**: Cannot change actual system volume\n- **Browser security**: System audio control not permitted\n\n### Android\n\n- **Full control**: Complete system volume control\n- **All stream types**: Music, ring, notifications, alarms, etc.\n- **No permissions**: Uses standard AudioManager APIs\n\n## Error Handling\n\n```typescript\ntry {\n  await Volume.setVolume({ volume: 0.75 });\n} catch (error) {\n  if (error.message.includes('iOS')) {\n    console.log('Use physical volume buttons on iOS');\n  } else if (error.message.includes('Web')) {\n    console.log('Web volume control is limited');\n  } else {\n    console.error('Volume control error:', error);\n  }\n}\n```\n\n## API\n\n<docgen-index>\n\n* [`getVolume(...)`](#getvolume)\n* [`setVolume(...)`](#setvolume)\n* [`getAllVolumes()`](#getallvolumes)\n* [`isVolumeControlSupported()`](#isvolumecontrolsupported)\n* [Enums](#enums)\n\n</docgen-index>\n\n<docgen-api>\n<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->\n\n### getVolume(...)\n\n```typescript\ngetVolume(options?: { streamType?: StreamType | undefined; } | undefined) => Promise<{ volume: number; }>\n```\n\nGet the current volume level as a ratio (0.0 to 1.0)\n\n| Param         | Type                                                                | Description                                           |\n| ------------- | ------------------------------------------------------------------- | ----------------------------------------------------- |\n| **`options`** | <code>{ streamType?: <a href=\"#streamtype\">StreamType</a>; }</code> | - Optional stream type (defaults to MUSIC on Android) |\n\n**Returns:** <code>Promise&lt;{ volume: number; }&gt;</code>\n\n--------------------\n\n\n### setVolume(...)\n\n```typescript\nsetVolume(options: { volume: number; streamType?: StreamType; }) => Promise<void>\n```\n\nSet the volume level using a ratio (0.0 to 1.0)\nNote: This only works on Android. On iOS and Web, this will throw an error.\n\n| Param         | Type                                                                                | Description                                                     |\n| ------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------- |\n| **`options`** | <code>{ volume: number; streamType?: <a href=\"#streamtype\">StreamType</a>; }</code> | - Volume ratio (0.0 = mute, 1.0 = max) and optional stream type |\n\n--------------------\n\n\n### getAllVolumes()\n\n```typescript\ngetAllVolumes() => Promise<{ [key: string]: { volume: number; }; }>\n```\n\nGet volume ratios for all stream types\nNote: On iOS and Web, this returns limited information.\n\n**Returns:** <code>Promise&lt;{ [key: string]: { volume: number; }; }&gt;</code>\n\n--------------------\n\n\n### isVolumeControlSupported()\n\n```typescript\nisVolumeControlSupported() => Promise<{ canGetVolume: boolean; canSetVolume: boolean; platform: string; }>\n```\n\nCheck if volume control is supported on current platform\n\n**Returns:** <code>Promise&lt;{ canGetVolume: boolean; canSetVolume: boolean; platform: string; }&gt;</code>\n\n--------------------\n\n\n### Enums\n\n\n#### StreamType\n\n| Members            | Value                       |\n| ------------------ | --------------------------- |\n| **`MUSIC`**        | <code>'MUSIC'</code>        |\n| **`RING`**         | <code>'RING'</code>         |\n| **`NOTIFICATION`** | <code>'NOTIFICATION'</code> |\n| **`ALARM`**        | <code>'ALARM'</code>        |\n| **`VOICE_CALL`**   | <code>'VOICE_CALL'</code>   |\n| **`SYSTEM`**       | <code>'SYSTEM'</code>       |\n\n</docgen-api>\n\n## License\n\nMIT License\n\n---\n\nMade with ❤️ by [4gency](https://4gency.fr)\n","readmeFilename":"README.md"}