{"id":31342961,"url":"https://github.com/smartcompanion-app/native-audio-player","last_synced_at":"2026-04-07T23:03:48.759Z","repository":{"id":303234042,"uuid":"949057897","full_name":"smartcompanion-app/native-audio-player","owner":"smartcompanion-app","description":"Play native audio from a Capacitor app","archived":false,"fork":false,"pushed_at":"2026-02-07T22:17:48.000Z","size":1319,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-08T05:51:57.860Z","etag":null,"topics":["android","audio","audio-player","background-audio","capacitor","capacitor-android","capacitor-community","capacitor-ios","capacitor-plugin","cross-platform","ios"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartcompanion-app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-15T15:25:02.000Z","updated_at":"2026-02-01T17:00:29.000Z","dependencies_parsed_at":"2025-09-02T23:13:26.734Z","dependency_job_id":"c4fe3080-46f2-4c9f-8941-4f3c26dd805a","html_url":"https://github.com/smartcompanion-app/native-audio-player","commit_stats":null,"previous_names":["smartcompanion-app/native-audio-player"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/smartcompanion-app/native-audio-player","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcompanion-app%2Fnative-audio-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcompanion-app%2Fnative-audio-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcompanion-app%2Fnative-audio-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcompanion-app%2Fnative-audio-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartcompanion-app","download_url":"https://codeload.github.com/smartcompanion-app/native-audio-player/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcompanion-app%2Fnative-audio-player/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31532342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android","audio","audio-player","background-audio","capacitor","capacitor-android","capacitor-community","capacitor-ios","capacitor-plugin","cross-platform","ios"],"created_at":"2025-09-26T07:01:38.809Z","updated_at":"2026-04-07T23:03:48.753Z","avatar_url":"https://github.com/smartcompanion-app.png","language":"Swift","funding_links":[],"categories":["Plugins","Other plugins"],"sub_categories":["Community Plugins","Specialized Hardware"],"readme":"# native-audio-player\n\n\u003e Play native audio from a Capacitor app.\n\n## ✨ Features\n\n - 🔈 Toggle between `Speaker` and `Earpiece` as audio output\n - 🎶 Audio keeps playing in the background, when app is minimized\n - 🔓 Native players in notifications and lock screens\n - 📱 Support for Android, iOS, Web (only Speaker)\n\n## Maintainers\n\n| Maintainer  | GitHub                                      | Social                                                          |\n| ----------- | ------------------------------------------- | --------------------------------------------------------------- |\n| Stefan Huber | [stefanhuber](https://github.com/stefanhuber) | [Linkedin](https://www.linkedin.com/in/stefan-huber/) |\n\n## Install\n\n```bash\nnpm install @smartcompanion/native-audio-player\nnpx cap sync\n```\n\n## Configuration\n\n| Platform | Configuration |\n| --- | --- |\n| iOS | Audio has to be added as Background Mode within Signing \u0026 Capabilities of the app, in order to keep audio playing in the background |\n| Android | The plugin has a `AndroidManifest.xml`, which includes all configurations | \n\n## Usage\n\nIn folder `./example` a full usage example is available. This example is also used for automated and manual testing.\n\n| Demo App | Native Audio Player |\n|---|---|\n| ![Demo App Screen](docs/demo-app-screen.png) | ![Native Audio Player (Android)](docs/native-audio-player.png) |\n\n## Other Audio Player Plugins\n\n - [@capacitor-community/native-audio](https://github.com/capacitor-community/native-audio)\n - [@capawesome-team/capacitor-audio-player](https://capawesome.io/plugins/audio-player/)\n - [@capgo/native-audio](https://github.com/Cap-go/capacitor-native-audio)\n - [@mediagrid/capacitor-native-audio](https://github.com/mediagrid/capacitor-native-audio)\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`setEarpiece()`](#setearpiece)\n* [`setSpeaker()`](#setspeaker)\n* [`start(...)`](#start)\n* [`stop()`](#stop)\n* [`play()`](#play)\n* [`pause()`](#pause)\n* [`select(...)`](#select)\n* [`next()`](#next)\n* [`previous()`](#previous)\n* [`seekTo(...)`](#seekto)\n* [`getDuration()`](#getduration)\n* [`getPosition()`](#getposition)\n* [`addListener('update', ...)`](#addlistenerupdate-)\n* [Interfaces](#interfaces)\n\n\u003c/docgen-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### setEarpiece()\n\n```typescript\nsetEarpiece() =\u003e Promise\u003cvoid\u003e\n```\n\nSet the audio output to the earpiece.\n\n--------------------\n\n\n### setSpeaker()\n\n```typescript\nsetSpeaker() =\u003e Promise\u003cvoid\u003e\n```\n\nSet the audio output to the speaker.\n\n--------------------\n\n\n### start(...)\n\n```typescript\nstart(options: StartOptions) =\u003e Promise\u003c{ id: string; }\u003e\n```\n\nInitialize the audio player with a list of audio items.\n\n| Param         | Type                                                  | Description                                  |\n| ------------- | ----------------------------------------------------- | -------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#startoptions\"\u003eStartOptions\u003c/a\u003e\u003c/code\u003e | - The options for starting the audio player. |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ id: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### stop()\n\n```typescript\nstop() =\u003e Promise\u003cvoid\u003e\n```\n\nStop the currently playing audio item and clear the playlist.\n\n--------------------\n\n\n### play()\n\n```typescript\nplay() =\u003e Promise\u003cvoid\u003e\n```\n\nPlay the currently selected audio item.\n\n--------------------\n\n\n### pause()\n\n```typescript\npause() =\u003e Promise\u003cvoid\u003e\n```\n\nPause the currently playing audio item.\n\n--------------------\n\n\n### select(...)\n\n```typescript\nselect(options: { id: string; }) =\u003e Promise\u003c{ id: string; }\u003e\n```\n\nSelect an audio item from the playlist by its id.\n\n| Param         | Type                         |\n| ------------- | ---------------------------- |\n| **`options`** | \u003ccode\u003e{ id: string; }\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ id: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### next()\n\n```typescript\nnext() =\u003e Promise\u003c{ id: string; }\u003e\n```\n\nSkip to the next audio item in the playlist.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ id: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### previous()\n\n```typescript\nprevious() =\u003e Promise\u003c{ id: string; }\u003e\n```\n\nSkip to the previous audio item in the playlist.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ id: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### seekTo(...)\n\n```typescript\nseekTo(options: { position: number; }) =\u003e Promise\u003cvoid\u003e\n```\n\nSeek to a specific position in the currently playing audio item.\n\n| Param         | Type                               |\n| ------------- | ---------------------------------- |\n| **`options`** | \u003ccode\u003e{ position: number; }\u003c/code\u003e |\n\n--------------------\n\n\n### getDuration()\n\n```typescript\ngetDuration() =\u003e Promise\u003c{ value: number; }\u003e\n```\n\nGet the duration of the current audio item in seconds.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ value: number; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### getPosition()\n\n```typescript\ngetPosition() =\u003e Promise\u003c{ value: number; }\u003e\n```\n\nGet the current position of the audio item in seconds.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ value: number; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### addListener('update', ...)\n\n```typescript\naddListener(eventName: 'update', listener: (result: { state: 'playing' | 'paused' | 'skip' | 'completed'; id: string; }) =\u003e void) =\u003e Promise\u003cPluginListenerHandle\u003e\n```\n\nAdd an event listener for the update event. The listener should accept an event object\ncontaining the current state and id of the audio item.\n\n| Param           | Type                                                                                                     |\n| --------------- | -------------------------------------------------------------------------------------------------------- |\n| **`eventName`** | \u003ccode\u003e'update'\u003c/code\u003e                                                                                    |\n| **`listener`**  | \u003ccode\u003e(result: { state: 'playing' \\| 'paused' \\| 'skip' \\| 'completed'; id: string; }) =\u0026gt; void\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#pluginlistenerhandle\"\u003ePluginListenerHandle\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### Interfaces\n\n\n#### StartOptions\n\nOptions for starting the audio player.\n\n| Prop        | Type                | Description                                                  |\n| ----------- | ------------------- | ------------------------------------------------------------ |\n| **`items`** | \u003ccode\u003eItem[]\u003c/code\u003e | A list of audio items to be initialized in the audio player. |\n\n\n#### Item\n\nRepresents an audio item in the playlist.\n\n| Prop           | Type                | Description                                                                         |\n| -------------- | ------------------- | ----------------------------------------------------------------------------------- |\n| **`id`**       | \u003ccode\u003estring\u003c/code\u003e | The unique identifier for the audio item.                                           |\n| **`title`**    | \u003ccode\u003estring\u003c/code\u003e | The title of the audio item, which is e.g. displayed in the notification player.    |\n| **`subtitle`** | \u003ccode\u003estring\u003c/code\u003e | The subtitle of the audio item, which is e.g. displayed in the notification player. |\n| **`audioUri`** | \u003ccode\u003estring\u003c/code\u003e | The local file URI of the audio file.                                               |\n| **`imageUri`** | \u003ccode\u003estring\u003c/code\u003e | The local file URI of the image associated with the audio item.                     |\n\n\n#### PluginListenerHandle\n\n| Prop         | Type                                      |\n| ------------ | ----------------------------------------- |\n| **`remove`** | \u003ccode\u003e() =\u0026gt; Promise\u0026lt;void\u0026gt;\u003c/code\u003e |\n\n\u003c/docgen-api\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcompanion-app%2Fnative-audio-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcompanion-app%2Fnative-audio-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcompanion-app%2Fnative-audio-player/lists"}