{"id":25173744,"url":"https://github.com/cap-go/capacitor-native-audio","last_synced_at":"2026-03-17T01:05:00.476Z","repository":{"id":62402622,"uuid":"560317422","full_name":"Cap-go/capacitor-native-audio","owner":"Cap-go","description":"Capacitor plugin for native audio engine. ","archived":false,"fork":false,"pushed_at":"2025-02-17T19:15:24.000Z","size":7260,"stargazers_count":42,"open_issues_count":7,"forks_count":17,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T19:42:37.433Z","etag":null,"topics":["audio","capacitor","capacitor-plugin","typescript"],"latest_commit_sha":null,"homepage":"https://capgo.app","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cap-go.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Cap-go","patreon":null,"open_collective":"capgo","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-11-01T08:05:22.000Z","updated_at":"2025-02-17T19:15:06.000Z","dependencies_parsed_at":"2023-10-11T04:49:05.625Z","dependency_job_id":"27bd95cf-d886-4a50-8f79-ad058ccc69ba","html_url":"https://github.com/Cap-go/capacitor-native-audio","commit_stats":{"total_commits":408,"total_committers":20,"mean_commits":20.4,"dds":0.6519607843137255,"last_synced_commit":"b8a24ed164fadc836032ea6907813eff51ec9697"},"previous_names":["cap-go/capacitor-native-audio","cap-go/native-audio"],"tags_count":153,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap-go","download_url":"https://codeload.github.com/Cap-go/capacitor-native-audio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239418573,"owners_count":19635208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","capacitor","capacitor-plugin","typescript"],"created_at":"2025-02-09T11:09:56.650Z","updated_at":"2026-03-17T01:05:00.464Z","avatar_url":"https://github.com/Cap-go.png","language":"Java","funding_links":["https://github.com/sponsors/Cap-go","https://opencollective.com/capgo"],"categories":[],"sub_categories":[],"readme":"# Native audio\n\n \u003ca href=\"https://capgo.app/\"\u003e\u003cimg src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/?ref=plugin_native_audio\"\u003e ➡️ Get Instant updates for your App with Capgo\u003c/a\u003e\u003c/h2\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/consulting/?ref=plugin_native_audio\"\u003e Missing a feature? We’ll build the plugin for you 💪\u003c/a\u003e\u003c/h2\u003e\n\u003c/div\u003e\n\n\u003ch3 align=\"center\"\u003eNative Audio\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e\n    \u003ccode\u003e@capgo/native-audio\u003c/code\u003e\n  \u003c/strong\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eCapacitor plugin for playing sounds.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/maintenance/yes/2023?style=flat-square\" /\u003e\n  \u003ca href=\"https://github.com/capgo/native-audio/actions?query=workflow%3A%22Test+and+Build+Plugin%22\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/@capgo/native-audio/Test%20and%20Build%20Plugin?style=flat-square\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/capgo/native-audio\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@capgo/native-audio?style=flat-square\" /\u003e\u003c/a\u003e\n\u003cbr\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@capgo/native-audio\"\u003e\u003cimg src=\"https://img.shields.io/npm/dw/@capgo/native-audio?style=flat-square\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@capgo/native-audio\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@capgo/native-audio?style=flat-square\" /\u003e\u003c/a\u003e\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n\u003ca href=\"#contributors-\"\u003e\u003cimg src=\"https://img.shields.io/badge/all%20contributors-6-orange?style=flat-square\" /\u003e\u003c/a\u003e\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\u003c/p\u003e\n\n# Capacitor Native Audio Plugin\n\nCapacitor plugin for native audio engine.\nCapacitor V7 - ✅ Support!\n\nSupport local file, remote URL, and m3u8 stream\n\nClick on video to see example 💥\n\n[![YouTube Example](https://img.youtube.com/vi/XpUGlWWtwHs/0.jpg)](https://www.youtube.com/watch?v=XpUGlWWtwHs)\n\n## Why Native Audio?\n\nThe only **free**, **full-featured** audio playback plugin for Capacitor:\n\n- **HLS/M3U8 streaming** - Play live audio streams and adaptive bitrate content\n- **Remote URLs** - Stream from HTTP/HTTPS sources with built-in caching\n- **Low-latency playback** - Optimized native audio engine for sound effects and music\n- **Full control** - Play, pause, resume, loop, seek, volume, playback rate\n- **Multiple channels** - Play multiple audio files simultaneously\n- **Background playback** - Continue playing when app is backgrounded\n- **Notification center display** - Show audio metadata in iOS Control Center and Android notifications\n- **Position tracking** - Real-time currentTime events (100ms intervals)\n- **Modern package management** - Supports both Swift Package Manager (SPM) and CocoaPods (SPM-ready for Capacitor 8)\n- **Same JavaScript API** - Compatible interface with paid alternatives\n- **Support player notification center** - Play, pause, show cover for your user when long playing audio.\n\nPerfect for music players, podcast apps, games, meditation apps, and any audio-heavy application.\n\n## Maintainers\n\n| Maintainer      | GitHub                              | Social                                  |\n| --------------- | ----------------------------------- | --------------------------------------- |\n| Martin Donadieu | [riderx](https://github.com/riderx) | [Telegram](https://t.me/martindonadieu) |\n\nMainteinance Status: Actively Maintained\n\n## Preparation\n\nAll audio files must be with the rest of your source files.\n\nFirst make your sound file end up in your built code folder, example in folder `BUILDFOLDER/assets/sounds/FILENAME.mp3`\nThen use it in preload like that `assets/sounds/FILENAME.mp3`\n\n## Documentation\n\nThe most complete doc is available here: https://capgo.app/docs/plugins/native-audio/\n\n## Compatibility\n\n| Plugin version | Capacitor compatibility | Maintained |\n| -------------- | ----------------------- | ---------- |\n| v8.\\*.\\*       | v8.\\*.\\*                | ✅          |\n| v7.\\*.\\*       | v7.\\*.\\*                | On demand   |\n| v6.\\*.\\*       | v6.\\*.\\*                | ❌          |\n| v5.\\*.\\*       | v5.\\*.\\*                | ❌          |\n\n\u003e **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.\n\n## Installation\n\nTo use npm\n\n```bash\nnpm install @capgo/native-audio\n```\n\nTo use yarn\n\n```bash\nyarn add @capgo/native-audio\n```\n\nSync native files\n\n```bash\nnpx cap sync\n```\n\nOn iOS, Android and Web, no further steps are needed.\n\n### Swift Package Manager\n\nYou can also consume the iOS implementation via Swift Package Manager. In Xcode open **File → Add Package…**, point it at `https://github.com/Cap-go/capacitor-native-audio.git`, and select the `CapgoNativeAudio` library product. The package supports iOS 14 and newer alongside Capacitor 7.\n\n## Configuration\n\n### Optional HLS/m3u8 Streaming (Android)\n\nBy default, HLS streaming support is **enabled** for backward compatibility. However, it adds approximately **4MB** to your Android APK size due to the `media3-exoplayer-hls` dependency.\n\nIf you don't need HLS/m3u8 streaming support, you can disable it to reduce your APK size:\n\n```typescript\n// capacitor.config.ts\nimport type { CapacitorConfig } from '@capacitor/cli';\n\nconst config: CapacitorConfig = {\n  appId: 'com.example.app',\n  appName: 'My App',\n  plugins: {\n    NativeAudio: {\n      hls: false  // Disable HLS to reduce APK size by ~4MB\n    }\n  }\n};\n\nexport default config;\n```\n\nAfter changing the configuration, run:\n\n```bash\nnpx cap sync\n```\n\n**Notes:**\n- iOS uses native AVPlayer for HLS, so this setting only affects Android\n- If HLS is disabled and you try to play an `.m3u8` file, you'll get a clear error message explaining how to enable it\n- The default is `hls: true` to maintain backward compatibility\n\n\u003cdocgen-config\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n\n\n\u003c/docgen-config\u003e\n\n## Supported methods\n\n| Name           | Android | iOS | Web |\n|:---------------| :------ | :-- | :-- |\n| configure      | ✅      | ✅  | ❌  |\n| preload        | ✅      | ✅  | ✅  |\n| play           | ✅      | ✅  | ✅  |\n| pause          | ✅      | ✅  | ✅  |\n| resume         | ✅      | ✅  | ✅  |\n| loop           | ✅      | ✅  | ✅  |\n| stop           | ✅      | ✅  | ✅  |\n| unload         | ✅      | ✅  | ✅  |\n| setVolume      | ✅      | ✅  | ✅  |\n| getDuration    | ✅      | ✅  | ✅  |\n| setCurrentTime | ✅      | ✅  | ✅  |\n| getCurrentTime | ✅      | ✅  | ✅  |\n| isPlaying      | ✅      | ✅  | ✅  |\n\n## Usage\n\n[Example repository](https://github.com/bazuka5801/native-audio-example)\n\n### Notification Center Display (iOS \u0026 Android)\n\nYou can display audio playback information in the system notification center. This is perfect for music players, podcast apps, and any app that plays audio in the background.\n\n\u003e **⚠️ Important iOS Behavior**\n\u003e \n\u003e Enabling `showNotification: true` changes how your app's audio interacts with other apps on iOS:\n\u003e \n\u003e - **With notifications enabled** (showNotification: true): Your audio will **interrupt** other apps' audio (like Spotify, Apple Music, etc.). This is required for Now Playing controls to appear in Control Center and on the lock screen.\n\u003e - **With notifications disabled** (showNotification: false): Your audio will **mix** with other apps' audio, allowing background music to continue playing.\n\u003e \n\u003e **When to use each:**\n\u003e - ✅ Use `showNotification: true` for: Music players, podcast apps, audiobook players (primary audio source)\n\u003e - ❌ Use `showNotification: false` for: Sound effects, notification sounds, secondary audio where mixing is preferred\n\u003e \n\u003e See [Issue #202](https://github.com/Cap-go/capacitor-native-audio/issues/202) for technical details.\n\n**Step 1: Configure the plugin with notification support**\n\n```typescript\nimport { NativeAudio } from '@capgo/native-audio'\n\n// Enable notification center display\nawait NativeAudio.configure({\n  showNotification: true,\n  background: true  // Also enable background playback\n});\n```\n\n**Step 2: Preload audio with metadata**\n\n```typescript\nawait NativeAudio.preload({\n  assetId: 'song1',\n  assetPath: 'https://example.com/song.mp3',\n  isUrl: true,\n  notificationMetadata: {\n    title: 'My Song Title',\n    artist: 'Artist Name',\n    album: 'Album Name',\n    artworkUrl: 'https://example.com/artwork.jpg'  // Can be local or remote URL\n  }\n});\n```\n\n**Step 3: Play the audio**\n\n```typescript\n// When you play the audio, it will automatically appear in the notification center\nawait NativeAudio.play({ assetId: 'song1' });\n```\n\nThe notification will:\n- Show the title, artist, and album information\n- Display the artwork/album art (if provided)\n- Include media controls (play/pause/stop buttons)\n- Automatically update when audio is paused/resumed\n- Automatically clear when audio is stopped\n- Work on both iOS and Android\n\n**Media Controls:**\nUsers can control playback directly from:\n- iOS: Control Center, Lock Screen, CarPlay\n- Android: Notification tray, Lock Screen, Android Auto\n\nThe media control buttons automatically handle:\n- **Play** - Resumes paused audio\n- **Pause** - Pauses playing audio\n- **Stop** - Stops audio and clears the notification\n- **Rewind 15s** (Android only) - Skips backward 15 seconds\n- **Forward 15s** (Android only) - Skips forward 15 seconds\n\n**Android Notification Controls:**\nOn Android, the notification displays three action buttons in this order:\n1. ⏪ **Rewind 15s** - Skip backward 15 seconds\n2. ▶️/⏸️ **Play/Pause** - Toggle playback (icon updates automatically)\n3. ⏩ **Forward 15s** - Skip forward 15 seconds\n\nThe skip forward/backward buttons are automatically available when `showNotification: true` is configured. No additional setup is required.\n\n**Notes:**\n- All metadata fields are optional\n- Artwork can be a local file path or remote URL\n- The notification only appears when `showNotification: true` is set in configure()\n- ⚠️ **iOS:** Enabling notifications will interrupt other apps' audio (see warning above)\n- iOS: Uses MPNowPlayingInfoCenter with MPRemoteCommandCenter\n- Android: Uses MediaSession with NotificationCompat.MediaStyle\n\n### Android Background Playback @since 8.2.0\n\nBy default, Android apps pause audio when the app is backgrounded or the screen is locked. To enable continuous audio playback in the background (for meditation apps, music players, podcast players, etc.), use the `backgroundPlayback` flag.\n\n\u003e **⚠️ Important Android Requirements**\n\u003e \n\u003e To use background playback on Android, your app must meet these requirements:\n\u003e 1. Declare the required permissions in `AndroidManifest.xml`\n\u003e 2. Start an Android Foreground Service with a media notification\n\u003e 3. Configure the plugin with `backgroundPlayback: true`\n\n**Step 1: Add required permissions to `AndroidManifest.xml`**\n\n```xml\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n    \u003c!-- Required for background audio playback --\u003e\n    \u003cuses-permission android:name=\"android.permission.FOREGROUND_SERVICE\" /\u003e\n    \u003cuses-permission android:name=\"android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK\" /\u003e\n    \u003cuses-permission android:name=\"android.permission.WAKE_LOCK\" /\u003e\n    \n    \u003capplication\u003e\n        \u003c!-- Your app configuration --\u003e\n    \u003c/application\u003e\n\u003c/manifest\u003e\n```\n\n**Step 2: Configure the plugin with background playback enabled**\n\n```typescript\nimport { NativeAudio } from '@capgo/native-audio';\n\n// Enable background playback and notification center\nawait NativeAudio.configure({\n  backgroundPlayback: true,  // Prevent automatic pause when backgrounded\n  showNotification: true,    // Show playback controls in notification\n  focus: true                // Request audio focus (optional but recommended)\n});\n```\n\n**Step 3: Start a Foreground Service (your responsibility)**\n\nThe plugin does NOT automatically create or manage the Android Foreground Service. You must create and start your own foreground service using a Capacitor plugin like [`@capacitor/local-notifications`](https://capacitorjs.com/docs/apis/local-notifications) or a custom Android service.\n\nHere's a conceptual example:\n\n```typescript\n// 1. Configure the audio plugin\nawait NativeAudio.configure({\n  backgroundPlayback: true,\n  showNotification: true\n});\n\n// 2. Start your foreground service (implementation depends on your app)\n// This is typically done with a native Android service or a plugin\n// that provides foreground service capabilities\nawait startForegroundService();\n\n// 3. Preload and play audio as normal\nawait NativeAudio.preload({\n  assetId: 'meditation',\n  assetPath: 'audio/meditation.mp3',\n  notificationMetadata: {\n    title: 'Meditation Session',\n    artist: 'Your App Name'\n  }\n});\n\nawait NativeAudio.play({ assetId: 'meditation' });\n\n// Audio will continue playing when app is backgrounded\n// The foreground service ensures Android allows background playback\n```\n\n**Important timing notes:**\n- The foreground service should be started **before** the app enters the background\n- Start the service immediately after configuring the audio plugin and before playing audio\n- If the foreground service is not running, Android may still kill your audio playback\n\n**How it works:**\n- Without `backgroundPlayback: true`: The plugin automatically pauses all audio when the app enters the background\n- With `backgroundPlayback: true`: The plugin skips automatic pause/resume, allowing continuous playback\n\n**Important notes:**\n- This flag is **Android-only** (iOS already supports background playback via AVAudioSession)\n- You **must** start an Android Foreground Service separately (plugin does not handle this)\n- Combine with `showNotification: true` to display playback controls\n- Starting Android 14+, foreground services require the `FOREGROUND_SERVICE_MEDIA_PLAYBACK` permission type\n\n**Alternative approach:**\nIf you need a complete solution including foreground service management, consider using a dedicated media playback plugin or implementing a custom Android service in your app's native code.\n\n## Play Once (Fire-and-Forget) @since 7.11.0\n\nFor simple one-shot audio playback (sound effects, notifications, etc.), use `playOnce()` which handles the entire asset lifecycle automatically:\n\n```typescript\n// Basic usage - automatic cleanup after playback\nawait NativeAudio.playOnce({\n  assetPath: 'audio/notification.mp3',\n});\n\n// With volume control\nawait NativeAudio.playOnce({\n  assetPath: 'audio/beep.wav',\n  volume: 0.8,\n});\n\n// Remote audio with notification metadata\nawait NativeAudio.playOnce({\n  assetPath: 'https://example.com/audio.mp3',\n  isUrl: true,\n  autoPlay: true,\n  notificationMetadata: {\n    title: 'Song Name',\n    artist: 'Artist Name',\n  }\n});\n\n// Temporary file with automatic deletion\nawait NativeAudio.playOnce({\n  assetPath: 'file:///path/to/temp-audio.wav',\n  deleteAfterPlay: true, // File deleted after playback completes\n  volume: 0.5,\n});\n```\n\n#### Advanced: Manual Control\n\nIf you need to control playback timing, set `autoPlay: false` and use the returned `assetId`:\n\n```typescript\nconst { assetId } = await NativeAudio.playOnce({\n  assetPath: 'audio/sound.wav',\n  autoPlay: false,\n});\n\n// Play later when needed\nawait NativeAudio.play({ assetId });\n\n// Stop if needed (will auto-cleanup)\nawait NativeAudio.stop({ assetId });\n```\n\n**Key Features:**\n- ✅ Automatic asset loading and unloading\n- ✅ Cleanup on completion or error\n- ✅ Optional file deletion after playback\n- ✅ Notification metadata support\n- ✅ Works with local files and remote URLs\n\n**Notes:**\n- Assets are automatically cleaned up after playback completes or on error\n- `deleteAfterPlay` only works for local `file://` URLs, not remote URLs\n- The returned `assetId` can be used with `play()`, `stop()`, `unload()` methods\n- Manual cleanup via `stop()` or `unload()` is optional but supported\n\n## Example app\n\nThis repository now ships with an interactive Capacitor project under `example/` that exercises the main APIs on web, iOS, and Android shells.\n\n```bash\ncd example\nnpm install\nnpm run dev      # start the web playground\nnpm run sync     # optional: generate iOS/Android platforms\nnpm run ios      # open the iOS shell app\nnpm run android  # open the Android shell app\n```\n\nThe UI demonstrates local asset preloading, remote streaming, playback controls, looping, live position updates, and cache clearing for remote audio.\n\n```typescript\nimport {NativeAudio} from '@capgo/native-audio'\n\n\n/**\n * This method will load more optimized audio files for background into memory.\n * @param assetPath - relative path of the file, absolute url (file://) or remote url (https://)\n *        assetId - unique identifier of the file\n *        audioChannelNum - number of audio channels\n *        isUrl - pass true if assetPath is a `file://` url\n * @returns void\n */\nNativeAudio.preload({\n    assetId: \"fire\",\n    assetPath: \"assets/sounds/fire.mp3\",\n    audioChannelNum: 1,\n    isUrl: false\n});\n\n/**\n * This method will play the loaded audio file if present in the memory.\n * @param assetId - identifier of the asset\n * @param time - (optional) play with seek. example: 6.0 - start playing track from 6 sec\n * @param delay - (optional) delay the audio. default is 0s\n * @param fadeIn - (optional) whether fade in the audio. default is false\n * @param fadeOut - (optional) whether fade out the audio. default is false\n * @param fadeInDuration - (optional) fade in duration in seconds. only used if fadeIn is true. default is 1s\n * @param fadeOutDuration - (optional) fade out duration in seconds. only used if fadeOut is true. default is 1s\n * @param fadeOutStartTime - (optional) time in seconds from the start of the audio to start fading out. only used if fadeOut is true. default is fadeOutDuration before end of audio.\n * @returns void\n */\nNativeAudio.play({\n    assetId: 'fire',\n    // time: 6.0 - seek time\n    // volume: 0.4,\n    // delay: 1.0,\n    // fadeIn: true,\n    // fadeOut: true,\n    // fadeInDuration: 2,\n    // fadeOutDuration: 2\n    // fadeOutStartTime: 2\n});\n\n/**\n * This method will loop the audio file for playback.\n * @param assetId - identifier of the asset\n * @returns void\n */\nNativeAudio.loop({\n  assetId: 'fire',\n});\n\n\n/**\n * This method will stop the audio file if it's currently playing.\n * @param assetId - identifier of the asset\n * @param fadeOut - (optional) whether fade out the audio before stopping. default is false\n * @param fadeOutDuration - (optional) fade out duration in seconds. default is 1s\n * @returns void\n */\nNativeAudio.stop({\n  assetId: 'fire',\n  // fadeOut: true,\n  // fadeOutDuration: 2\n});\n\n/**\n * This method will unload the audio file from the memory.\n * @param assetId - identifier of the asset\n * @returns void\n */\nNativeAudio.unload({\n  assetId: 'fire',\n});\n\n/**\n * This method will set the new volume for a audio file.\n * @param assetId - identifier of the asset\n *        volume - numerical value of the volume between 0.1 - 1.0 default 1.0\n *        duration - time over which to fade to the target volume, in seconds. default is 0s (immediate)\n * @returns void\n */\nNativeAudio.setVolume({\n  assetId: 'fire',\n  volume: 0.4,\n  // duration: 2\n});\n\n/**\n * this method will get the duration of an audio file.\n * only works if channels == 1\n */\nNativeAudio.getDuration({\n  assetId: 'fire'\n})\n.then(result =\u003e {\n  console.log(result.duration);\n})\n\n/**\n * this method will get the current time of a playing audio file.\n * only works if channels == 1\n */\nNativeAudio.getCurrentTime({\n  assetId: 'fire'\n})\n.then(result =\u003e {\n  console.log(result.currentTime);\n})\n\n/**\n * this method will set the current time of a playing audio file.\n * @param assetId - identifier of the asset\n*  time - time to set the audio, in seconds\n */\nNativeAudio.setCurrentTime({\n  assetId: 'fire',\n  time: 6.0\n})\n\n/**\n * This method will return false if audio is paused or not loaded.\n * @param assetId - identifier of the asset\n * @returns {isPlaying: boolean}\n */\nNativeAudio.isPlaying({\n  assetId: 'fire'\n})\n.then(result =\u003e {\n  console.log(result.isPlaying);\n})\n```\n\n## API\n\n\u003cdocgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n### configure(...)\n\n```typescript\nconfigure(options: ConfigureOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nConfigure the audio player\n\n| Param         | Type                                                          |\n| ------------- | ------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#configureoptions\"\u003eConfigureOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### preload(...)\n\n```typescript\npreload(options: PreloadOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nLoad an audio file\n\n| Param         | Type                                                      |\n| ------------- | --------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#preloadoptions\"\u003ePreloadOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### playOnce(...)\n\n```typescript\nplayOnce(options: PlayOnceOptions) =\u003e Promise\u003cPlayOnceResult\u003e\n```\n\nPlay an audio file once with automatic cleanup\n\nMethod designed for simple, single-shot audio playback,\nsuch as notification sounds, UI feedback, or other short audio clips\nthat don't require manual state management.\n\n**Key Features:**\n- **Fire-and-forget**: No need to manually preload, play, stop, or unload\n- **Auto-cleanup**: Asset is automatically unloaded after playback completes\n- **Optional file deletion**: Can delete local files after playback (useful for temp files)\n- **Returns assetId**: Can still control playback if needed (pause, stop, etc.)\n\n**Use Cases:**\n- Notification sounds\n- UI sound effects (button clicks, alerts)\n- Short audio clips that play once\n- Temporary audio files that should be cleaned up\n\n**Comparison with regular play():**\n- `play()`: Requires manual preload, play, and unload steps\n- `playOnce()`: Handles everything automatically with a single call\n\n| Param         | Type                                                        |\n| ------------- | ----------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#playonceoptions\"\u003ePlayOnceOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#playonceresult\"\u003ePlayOnceResult\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 7.11.0\n\n--------------------\n\n\n### isPreloaded(...)\n\n```typescript\nisPreloaded(options: PreloadOptions) =\u003e Promise\u003c{ found: boolean; }\u003e\n```\n\nCheck if an audio file is preloaded\n\n| Param         | Type                                                      |\n| ------------- | --------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#preloadoptions\"\u003ePreloadOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ found: boolean; }\u0026gt;\u003c/code\u003e\n\n**Since:** 6.1.0\n\n--------------------\n\n\n### play(...)\n\n```typescript\nplay(options: AssetPlayOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nPlay an audio file\n\n| Param         | Type                                                          |\n| ------------- | ------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetplayoptions\"\u003eAssetPlayOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### pause(...)\n\n```typescript\npause(options: AssetPauseOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nPause an audio file\n\n| Param         | Type                                                            |\n| ------------- | --------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetpauseoptions\"\u003eAssetPauseOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### resume(...)\n\n```typescript\nresume(options: AssetResumeOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nResume an audio file\n\n| Param         | Type                                                              |\n| ------------- | ----------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetresumeoptions\"\u003eAssetResumeOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### loop(...)\n\n```typescript\nloop(options: Assets) =\u003e Promise\u003cvoid\u003e\n```\n\nStop an audio file\n\n| Param         | Type                                      |\n| ------------- | ----------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assets\"\u003eAssets\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### stop(...)\n\n```typescript\nstop(options: AssetStopOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nStop an audio file\n\n| Param         | Type                                                          |\n| ------------- | ------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetstopoptions\"\u003eAssetStopOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### unload(...)\n\n```typescript\nunload(options: Assets) =\u003e Promise\u003cvoid\u003e\n```\n\nUnload an audio file\n\n| Param         | Type                                      |\n| ------------- | ----------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assets\"\u003eAssets\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### setVolume(...)\n\n```typescript\nsetVolume(options: AssetVolume) =\u003e Promise\u003cvoid\u003e\n```\n\nSet the volume of an audio file\n\n| Param         | Type                                                |\n| ------------- | --------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetvolume\"\u003eAssetVolume\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### setRate(...)\n\n```typescript\nsetRate(options: AssetRate) =\u003e Promise\u003cvoid\u003e\n```\n\nSet the rate of an audio file\n\n| Param         | Type                                            |\n| ------------- | ----------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetrate\"\u003eAssetRate\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### setCurrentTime(...)\n\n```typescript\nsetCurrentTime(options: AssetSetTime) =\u003e Promise\u003cvoid\u003e\n```\n\nSet the current time of an audio file\n\n| Param         | Type                                                  |\n| ------------- | ----------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assetsettime\"\u003eAssetSetTime\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 6.5.0\n\n--------------------\n\n\n### getCurrentTime(...)\n\n```typescript\ngetCurrentTime(options: Assets) =\u003e Promise\u003c{ currentTime: number; }\u003e\n```\n\nGet the current time of an audio file\n\n| Param         | Type                                      |\n| ------------- | ----------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assets\"\u003eAssets\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ currentTime: number; }\u0026gt;\u003c/code\u003e\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### getDuration(...)\n\n```typescript\ngetDuration(options: Assets) =\u003e Promise\u003c{ duration: number; }\u003e\n```\n\nGet the duration of an audio file in seconds\n\n| Param         | Type                                      |\n| ------------- | ----------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assets\"\u003eAssets\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ duration: number; }\u0026gt;\u003c/code\u003e\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### isPlaying(...)\n\n```typescript\nisPlaying(options: Assets) =\u003e Promise\u003c{ isPlaying: boolean; }\u003e\n```\n\nCheck if an audio file is playing\n\n| Param         | Type                                      |\n| ------------- | ----------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#assets\"\u003eAssets\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ isPlaying: boolean; }\u0026gt;\u003c/code\u003e\n\n**Since:** 5.0.0\n\n--------------------\n\n\n### addListener('complete', ...)\n\n```typescript\naddListener(eventName: 'complete', listenerFunc: CompletedListener) =\u003e Promise\u003cPluginListenerHandle\u003e\n```\n\nListen for complete event\n\n| Param              | Type                                                            |\n| ------------------ | --------------------------------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'complete'\u003c/code\u003e                                         |\n| **`listenerFunc`** | \u003ccode\u003e\u003ca href=\"#completedlistener\"\u003eCompletedListener\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#pluginlistenerhandle\"\u003ePluginListenerHandle\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 5.0.0\nreturn {@link CompletedEvent}\n\n--------------------\n\n\n### addListener('currentTime', ...)\n\n```typescript\naddListener(eventName: 'currentTime', listenerFunc: CurrentTimeListener) =\u003e Promise\u003cPluginListenerHandle\u003e\n```\n\nListen for current time updates\nEmits every 100ms while audio is playing\n\n| Param              | Type                                                                |\n| ------------------ | ------------------------------------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'currentTime'\u003c/code\u003e                                          |\n| **`listenerFunc`** | \u003ccode\u003e\u003ca href=\"#currenttimelistener\"\u003eCurrentTimeListener\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#pluginlistenerhandle\"\u003ePluginListenerHandle\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 6.5.0\nreturn {@link CurrentTimeEvent}\n\n--------------------\n\n\n### clearCache()\n\n```typescript\nclearCache() =\u003e Promise\u003cvoid\u003e\n```\n\nClear the audio cache for remote audio files\n\n**Since:** 6.5.0\n\n--------------------\n\n\n### setDebugMode(...)\n\n```typescript\nsetDebugMode(options: { enabled: boolean; }) =\u003e Promise\u003cvoid\u003e\n```\n\nSet debug mode logging\n\n| Param         | Type                               | Description                               |\n| ------------- | ---------------------------------- | ----------------------------------------- |\n| **`options`** | \u003ccode\u003e{ enabled: boolean; }\u003c/code\u003e | - Options to enable or disable debug mode |\n\n**Since:** 6.5.0\n\n--------------------\n\n\n### getPluginVersion()\n\n```typescript\ngetPluginVersion() =\u003e Promise\u003c{ version: string; }\u003e\n```\n\nGet the native Capacitor plugin version\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ version: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### deinitPlugin()\n\n```typescript\ndeinitPlugin() =\u003e Promise\u003cvoid\u003e\n```\n\nDeinitialize the plugin and restore original audio session settings\nThis method stops all playing audio and reverts any audio session changes made by the plugin\nUse this when you need to ensure compatibility with other audio plugins\n\n**Since:** 7.7.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### ConfigureOptions\n\n| Prop                     | Type                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Default            | Since |\n| ------------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |\n| **`focus`**              | \u003ccode\u003eboolean\u003c/code\u003e | focus the audio with Audio Focus                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |                    |       |\n| **`background`**         | \u003ccode\u003eboolean\u003c/code\u003e | Play the audio in the background                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |                    |       |\n| **`ignoreSilent`**       | \u003ccode\u003eboolean\u003c/code\u003e | Ignore silent mode, works only on iOS setting this will nuke other audio apps                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                    |       |\n| **`showNotification`**   | \u003ccode\u003eboolean\u003c/code\u003e | Show audio playback in the notification center (iOS and Android) When enabled, displays audio metadata (title, artist, album, artwork) in the system notification and Control Center (iOS) or lock screen. **Important iOS Behavior:** Enabling this option changes the audio session category to `.playback` with `.default` mode, which means your app's audio will **interrupt** other apps' audio (like background music from Spotify, Apple Music, etc.) instead of mixing with it. This is required for the Now Playing info to appear in Control Center and on the lock screen. **Trade-offs:** - `showNotification: true` → Shows Now Playing controls, but interrupts other audio - `showNotification: false` → Audio mixes with other apps, but no Now Playing controls Use this when your app is the primary audio source (music players, podcast apps, etc.). Disable this for secondary audio like sound effects or notification sounds where mixing with background music is preferred.                                                                                                                                                                     |                    |       |\n| **`backgroundPlayback`** | \u003ccode\u003eboolean\u003c/code\u003e | Enable background audio playback (Android only) When enabled, audio will continue playing when the app is backgrounded or the screen is locked. The plugin will skip the automatic pause/resume logic that normally occurs when the app enters the background or returns to the foreground. **Important Android Requirements:** To use background playback on Android, your app must: 1. Declare the required permissions in `AndroidManifest.xml`: - `\u0026lt;uses-permission android:name=\"android.permission.FOREGROUND_SERVICE\" /\u0026gt;` - `\u0026lt;uses-permission android:name=\"android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK\" /\u0026gt;` - `\u0026lt;uses-permission android:name=\"android.permission.WAKE_LOCK\" /\u0026gt;` 2. Start a Foreground Service with a media-style notification before backgrounding (the plugin does not automatically create or manage the foreground service) 3. Use `showNotification: true` to display playback controls in the notification **Usage Example:** ```typescript await NativeAudio.configure({ backgroundPlayback: true, showNotification: true }); // Start your foreground service here // Then preload and play audio as normal ``` | \u003ccode\u003efalse\u003c/code\u003e | 8.2.0 |\n\n\n#### PreloadOptions\n\n| Prop                       | Type                                                                  | Description                                                                                                                                                                                                                                                                                     | Since  |\n| -------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |\n| **`assetPath`**            | \u003ccode\u003estring\u003c/code\u003e                                                   | Path to the audio file, relative path of the file, absolute url (file://) or remote url (https://) Supported formats: - MP3, WAV (all platforms) - M3U8/HLS streams (iOS and Android)                                                                                                           |        |\n| **`assetId`**              | \u003ccode\u003estring\u003c/code\u003e                                                   | Asset Id, unique identifier of the file                                                                                                                                                                                                                                                         |        |\n| **`volume`**               | \u003ccode\u003enumber\u003c/code\u003e                                                   | Volume of the audio, between 0.1 and 1.0                                                                                                                                                                                                                                                        |        |\n| **`audioChannelNum`**      | \u003ccode\u003enumber\u003c/code\u003e                                                   | Audio channel number, default is 1                                                                                                                                                                                                                                                              |        |\n| **`isUrl`**                | \u003ccode\u003eboolean\u003c/code\u003e                                                  | Is the audio file a URL, pass true if assetPath is a `file://` url or a streaming URL (m3u8)                                                                                                                                                                                                    |        |\n| **`notificationMetadata`** | \u003ccode\u003e\u003ca href=\"#notificationmetadata\"\u003eNotificationMetadata\u003c/a\u003e\u003c/code\u003e | Metadata to display in the notification center when audio is playing. Only used when `showNotification: true` is set in `configure()`. See {@link \u003ca href=\"#configureoptions\"\u003eConfigureOptions.showNotification\u003c/a\u003e} for important details about how this affects audio mixing behavior on iOS. |        |\n| **`headers`**              | \u003ccode\u003e\u003ca href=\"#record\"\u003eRecord\u003c/a\u003e\u0026lt;string, string\u0026gt;\u003c/code\u003e       | Custom HTTP headers to include when fetching remote audio files. Only used when isUrl is true and assetPath is a remote URL (http/https). Example: { 'x-api-key': 'abc123', 'Authorization': 'Bearer token' }                                                                                   | 7.10.0 |\n\n\n#### NotificationMetadata\n\nMetadata to display in the notification center, Control Center (iOS), and lock screen\nwhen `showNotification` is enabled in `configure()`.\n\nNote: This metadata will only be displayed if `showNotification: true` is set in the\n`configure()` method. See {@link \u003ca href=\"#configureoptions\"\u003eConfigureOptions.showNotification\u003c/a\u003e} for important\nbehavior details about audio mixing on iOS.\n\n| Prop             | Type                | Description                                           |\n| ---------------- | ------------------- | ----------------------------------------------------- |\n| **`title`**      | \u003ccode\u003estring\u003c/code\u003e | The title to display in the notification center       |\n| **`artist`**     | \u003ccode\u003estring\u003c/code\u003e | The artist name to display in the notification center |\n| **`album`**      | \u003ccode\u003estring\u003c/code\u003e | The album name to display in the notification center  |\n| **`artworkUrl`** | \u003ccode\u003estring\u003c/code\u003e | URL or local path to the artwork/album art image      |\n\n\n#### PlayOnceResult\n\n| Prop          | Type                | Description                                                                                                               |\n| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| **`assetId`** | \u003ccode\u003estring\u003c/code\u003e | The internally generated asset ID for this playback Can be used to control playback (pause, stop, etc.) before completion |\n\n\n#### PlayOnceOptions\n\n| Prop                       | Type                                                                  | Description                                                                                                                                                                                                                                                                                     | Default            | Since  |\n| -------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------ |\n| **`assetPath`**            | \u003ccode\u003estring\u003c/code\u003e                                                   | Path to the audio file, relative path of the file, absolute url (file://) or remote url (https://) Supported formats: - MP3, WAV (all platforms) - M3U8/HLS streams (iOS and Android)                                                                                                           |                    |        |\n| **`volume`**               | \u003ccode\u003enumber\u003c/code\u003e                                                   | Volume of the audio, between 0.1 and 1.0                                                                                                                                                                                                                                                        | \u003ccode\u003e1.0\u003c/code\u003e   |        |\n| **`isUrl`**                | \u003ccode\u003eboolean\u003c/code\u003e                                                  | Is the audio file a URL, pass true if assetPath is a `file://` url or a streaming URL (m3u8)                                                                                                                                                                                                    | \u003ccode\u003efalse\u003c/code\u003e |        |\n| **`autoPlay`**             | \u003ccode\u003eboolean\u003c/code\u003e                                                  | Automatically start playback after loading                                                                                                                                                                                                                                                      | \u003ccode\u003etrue\u003c/code\u003e  |        |\n| **`deleteAfterPlay`**      | \u003ccode\u003eboolean\u003c/code\u003e                                                  | Delete the audio file from disk after playback completes Only works for local files (file:// URLs), ignored for remote URLs                                                                                                                                                                     | \u003ccode\u003efalse\u003c/code\u003e | 7.11.0 |\n| **`notificationMetadata`** | \u003ccode\u003e\u003ca href=\"#notificationmetadata\"\u003eNotificationMetadata\u003c/a\u003e\u003c/code\u003e | Metadata to display in the notification center when audio is playing. Only used when `showNotification: true` is set in `configure()`. See {@link \u003ca href=\"#configureoptions\"\u003eConfigureOptions.showNotification\u003c/a\u003e} for important details about how this affects audio mixing behavior on iOS. |                    | 7.10.0 |\n| **`headers`**              | \u003ccode\u003e\u003ca href=\"#record\"\u003eRecord\u003c/a\u003e\u0026lt;string, string\u0026gt;\u003c/code\u003e       | Custom HTTP headers to include when fetching remote audio files. Only used when isUrl is true and assetPath is a remote URL (http/https). Example: { 'x-api-key': 'abc123', 'Authorization': 'Bearer token' }                                                                                   |                    | 7.10.0 |\n\n\n#### AssetPlayOptions\n\n| Prop                   | Type                 | Description                                                                                                                                    |\n| ---------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| **`assetId`**          | \u003ccode\u003estring\u003c/code\u003e  | Asset Id, unique identifier of the file                                                                                                        |\n| **`time`**             | \u003ccode\u003enumber\u003c/code\u003e  | Time to start playing the audio, in seconds                                                                                                    |\n| **`delay`**            | \u003ccode\u003enumber\u003c/code\u003e  | Delay to start playing the audio, in seconds                                                                                                   |\n| **`volume`**           | \u003ccode\u003enumber\u003c/code\u003e  | Volume of the audio, between 0.1 and 1.0                                                                                                       |\n| **`fadeIn`**           | \u003ccode\u003eboolean\u003c/code\u003e | Whether to fade in the audio                                                                                                                   |\n| **`fadeOut`**          | \u003ccode\u003eboolean\u003c/code\u003e | Whether to fade out the audio                                                                                                                  |\n| **`fadeInDuration`**   | \u003ccode\u003enumber\u003c/code\u003e  | Fade in duration in seconds. Only used if fadeIn is true. Default is 1s.                                                                       |\n| **`fadeOutDuration`**  | \u003ccode\u003enumber\u003c/code\u003e  | Fade out duration in seconds. Only used if fadeOut is true. Default is 1s.                                                                     |\n| **`fadeOutStartTime`** | \u003ccode\u003enumber\u003c/code\u003e  | Time in seconds from the start of the audio to start fading out. Only used if fadeOut is true. Default is fadeOutDuration before end of audio. |\n\n\n#### AssetPauseOptions\n\n| Prop                  | Type                 | Description                                  |\n| --------------------- | -------------------- | -------------------------------------------- |\n| **`assetId`**         | \u003ccode\u003estring\u003c/code\u003e  | Asset Id, unique identifier of the file      |\n| **`fadeOut`**         | \u003ccode\u003eboolean\u003c/code\u003e | Whether to fade out the audio before pausing |\n| **`fadeOutDuration`** | \u003ccode\u003enumber\u003c/code\u003e  | Fade out duration in seconds. Default is 1s. |\n\n\n#### AssetResumeOptions\n\n| Prop                 | Type                 | Description                                 |\n| -------------------- | -------------------- | ------------------------------------------- |\n| **`assetId`**        | \u003ccode\u003estring\u003c/code\u003e  | Asset Id, unique identifier of the file     |\n| **`fadeIn`**         | \u003ccode\u003eboolean\u003c/code\u003e | Whether to fade in the audio during resume  |\n| **`fadeInDuration`** | \u003ccode\u003enumber\u003c/code\u003e  | Fade in duration in seconds. Default is 1s. |\n\n\n#### Assets\n\n| Prop          | Type                | Description                             |\n| ------------- | ------------------- | --------------------------------------- |\n| **`assetId`** | \u003ccode\u003estring\u003c/code\u003e | Asset Id, unique identifier of the file |\n\n\n#### AssetStopOptions\n\n| Prop                  | Type                 | Description                                   |\n| --------------------- | -------------------- | --------------------------------------------- |\n| **`assetId`**         | \u003ccode\u003estring\u003c/code\u003e  | Asset Id, unique identifier of the file       |\n| **`fadeOut`**         | \u003ccode\u003eboolean\u003c/code\u003e | Whether to fade out the audio before stopping |\n| **`fadeOutDuration`** | \u003ccode\u003enumber\u003c/code\u003e  | Fade out duration in seconds. Default is 1s.  |\n\n\n#### AssetVolume\n\n| Prop           | Type                | Description                                                                          |\n| -------------- | ------------------- | ------------------------------------------------------------------------------------ |\n| **`assetId`**  | \u003ccode\u003estring\u003c/code\u003e | Asset Id, unique identifier of the file                                              |\n| **`volume`**   | \u003ccode\u003enumber\u003c/code\u003e | Volume of the audio, between 0.1 and 1.0                                             |\n| **`duration`** | \u003ccode\u003enumber\u003c/code\u003e | Time over which to fade to the target volume, in seconds. Default is 0s (immediate). |\n\n\n#### AssetRate\n\n| Prop          | Type                | Description                             |\n| ------------- | ------------------- | --------------------------------------- |\n| **`assetId`** | \u003ccode\u003estring\u003c/code\u003e | Asset Id, unique identifier of the file |\n| **`rate`**    | \u003ccode\u003enumber\u003c/code\u003e | Rate of the audio, between 0.1 and 1.0  |\n\n\n#### AssetSetTime\n\n| Prop          | Type                | Description                             |\n| ------------- | ------------------- | --------------------------------------- |\n| **`assetId`** | \u003ccode\u003estring\u003c/code\u003e | Asset Id, unique identifier of the file |\n| **`time`**    | \u003ccode\u003enumber\u003c/code\u003e | Time to set the audio, in seconds       |\n\n\n#### PluginListenerHandle\n\n| Prop         | Type                                      |\n| ------------ | ----------------------------------------- |\n| **`remove`** | \u003ccode\u003e() =\u0026gt; Promise\u0026lt;void\u0026gt;\u003c/code\u003e |\n\n\n#### CompletedEvent\n\n| Prop          | Type                | Description                | Since |\n| ------------- | ------------------- | -------------------------- | ----- |\n| **`assetId`** | \u003ccode\u003estring\u003c/code\u003e | Emit when a play completes | 5.0.0 |\n\n\n#### CurrentTimeEvent\n\n| Prop              | Type                | Description                          | Since |\n| ----------------- | ------------------- | ------------------------------------ | ----- |\n| **`currentTime`** | \u003ccode\u003enumber\u003c/code\u003e | Current time of the audio in seconds | 6.5.0 |\n| **`assetId`**     | \u003ccode\u003estring\u003c/code\u003e | Asset Id of the audio                | 6.5.0 |\n\n\n### Type Aliases\n\n\n#### Record\n\nConstruct a type with a set of properties K of type T\n\n\u003ccode\u003e{\r [P in K]: T;\r }\u003c/code\u003e\n\n\n#### CompletedListener\n\n\u003ccode\u003e(state: \u003ca href=\"#completedevent\"\u003eCompletedEvent\u003c/a\u003e): void\u003c/code\u003e\n\n\n#### CurrentTimeListener\n\n\u003ccode\u003e(state: \u003ca href=\"#currenttimeevent\"\u003eCurrentTimeEvent\u003c/a\u003e): void\u003c/code\u003e\n\n\u003c/docgen-api\u003e\n\n## Development and Testing\n\n### Building\n\n```bash\nnpm run build\n```\n\n### Testing\n\nThis plugin includes a comprehensive test suite for iOS:\n\n1. Open the iOS project in Xcode: `npx cap open ios`\n2. Navigate to the `PluginTests` directory\n3. Run tests using Product \u003e Test (⌘+U)\n\nThe tests cover core functionality including audio asset initialization, playback, volume control, fade effects, and more. See the [test documentation](ios/PluginTests/README.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcapacitor-native-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcap-go%2Fcapacitor-native-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcapacitor-native-audio/lists"}