{"id":43687777,"url":"https://github.com/bradmartin/nativescript-audio","last_synced_at":"2026-02-16T13:01:49.986Z","repository":{"id":57201102,"uuid":"158783207","full_name":"bradmartin/nativescript-audio","owner":"bradmartin","description":":microphone: NativeScript plugin to record and play audio :musical_note: ","archived":false,"fork":true,"pushed_at":"2020-05-31T04:45:07.000Z","size":20936,"stargazers_count":9,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-23T03:32:37.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nstudio/nativescript-audio","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bradmartin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-23T05:06:29.000Z","updated_at":"2021-11-19T01:44:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bradmartin/nativescript-audio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bradmartin/nativescript-audio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradmartin%2Fnativescript-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradmartin%2Fnativescript-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradmartin%2Fnativescript-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradmartin%2Fnativescript-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradmartin","download_url":"https://codeload.github.com/bradmartin/nativescript-audio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradmartin%2Fnativescript-audio/sbom","scorecard":{"id":250397,"data":{"date":"2025-08-11","repo":{"name":"github.com/bradmartin/nativescript-audio","commit":"5fc58086eedc63b65843245efffa2726a745177a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: npmCommand not pinned by hash: publish/pack.sh:10","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T08:20:16.196Z","repository_id":57201102,"created_at":"2025-08-17T08:20:16.196Z","updated_at":"2025-08-17T08:20:16.196Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29508735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: 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":[],"created_at":"2026-02-05T03:00:21.768Z","updated_at":"2026-02-16T13:01:49.981Z","avatar_url":"https://github.com/bradmartin.png","language":"TypeScript","funding_links":["https://paypal.me/bradwayne88"],"categories":["Awesome {N} [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)"],"sub_categories":["Table of Contents"],"readme":"\u003ca align=\"center\" href=\"https://www.npmjs.com/package/nativescript-audio\"\u003e\n    \u003ch3 align=\"center\"\u003eNativeScript Audio\u003c/h3\u003e\n\u003c/a\u003e\n\u003ch4 align=\"center\"\u003eNativeScript plugin to play and record audio files for Android and iOS.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/nativescript-audio\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/nativescript-audio.svg\" alt=\"npm\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/nativescript-audio\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/dt/nativescript-audio.svg?label=npm%20downloads\" alt=\"npm\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/nstudio/nativescript-audio/stargazers\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/stars/nstudio/nativescript-audio.svg\" alt=\"stars\"\u003e\n    \u003c/a\u003e\n     \u003ca href=\"https://github.com/nstudio/nativescript-audio/network\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/forks/nstudio/nativescript-audio.svg\" alt=\"forks\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/nstudio/nativescript-audio/blob/master/LICENSE.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/nstudio/nativescript-audio.svg\" alt=\"license\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://paypal.me/bradwayne88\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-green.svg\" alt=\"donate\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://nstudio.io\"\u003e\n      \u003cimg src=\"./screens/nstudio-banner.png\" alt=\"nStudio banner\"\u003e\n    \u003c/a\u003e\n    \u003ch5 align=\"center\"\u003eDo you need assistance on your project or plugin? Contact the nStudio team anytime at \u003ca href=\"mailto:team@nstudio.io\"\u003eteam@nstudio.io\u003c/a\u003e to get up to speed with the best practices in mobile and web app development.\n    \u003c/h5\u003e\n\u003c/p\u003e\n\n---\n\n## Installation\n\n`tns plugin add nativescript-audio`\n\n## Recording Permissions\n\n#### iOS\n\n- To record, add the following to your project's `Info.plist` file in the `App_Resources/iOS` directory ([see here for example](./demo/app/App_Resources/iOS/Info.plist)).\n\n```xml\n\u003ckey\u003eNSMicrophoneUsageDescription\u003c/key\u003e\n\u003cstring\u003eThe app needs to access your Microphone to record.\u003c/string\u003e\n```\n\n#### Android\n\n- To record, add the following permission to your `AndroidManifest.xml` file in `App_Resources/Android/` directory ([see here for example](./demo/app/App_Resources/Android/src/main/AndroidManifest.xml)).\n\n```xml\n\u003cuses-permission android:name=\"android.permission.RECORD_AUDIO\" /\u003e\n```\n\n---\n\n### Android Native Classes\n\n- [Player - android.media.MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html)\n- [Recorder - android.media.MediaRecorder](http://developer.android.com/reference/android/media/MediaRecorder.html)\n\n### iOS Native Classes\n\n- [Player - AVAudioPlayer](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/)\n- [Recorder - AVAudioRecorder](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/)\n\n## Usage\n\n### TypeScript Example\n\n```typescript\nimport { TNSPlayer } from 'nativescript-audio';\n\nexport class YourClass {\n  private _player: TNSPlayer;\n\n  constructor() {\n    this._player = new TNSPlayer();\n    this._player.debug = true; // set true to enable TNSPlayer console logs for debugging.\n    this._player\n      .initFromFile({\n        audioFile: '~/audio/song.mp3', // ~ = app directory\n        loop: false,\n        completeCallback: this._trackComplete.bind(this),\n        errorCallback: this._trackError.bind(this)\n      })\n      .then(() =\u003e {\n        this._player.getAudioTrackDuration().then(duration =\u003e {\n          // iOS: duration is in seconds\n          // Android: duration is in milliseconds\n          console.log(`song duration:`, duration);\n        });\n      });\n  }\n\n  public togglePlay() {\n    if (this._player.isAudioPlaying()) {\n      this._player.pause();\n    } else {\n      this._player.play();\n    }\n  }\n\n  private _trackComplete(args: any) {\n    console.log('reference back to player:', args.player);\n    // iOS only: flag indicating if completed succesfully\n    console.log('whether song play completed successfully:', args.flag);\n  }\n\n  private _trackError(args: any) {\n    console.log('reference back to player:', args.player);\n    console.log('the error:', args.error);\n    // Android only: extra detail on error\n    console.log('extra info on the error:', args.extra);\n  }\n}\n```\n\n### Javascript Example:\n\n```javascript\nconst audio = require('nativescript-audio');\n\nconst player = new audio.TNSPlayer();\nconst playerOptions = {\n  audioFile: 'http://some/audio/file.mp3',\n  loop: false,\n  completeCallback: function() {\n    console.log('finished playing');\n  },\n  errorCallback: function(errorObject) {\n    console.log(JSON.stringify(errorObject));\n  },\n  infoCallback: function(args) {\n    console.log(JSON.stringify(args));\n  }\n};\n\nplayer\n  .playFromUrl(playerOptions)\n  .then(function(res) {\n    console.log(res);\n  })\n  .catch(function(err) {\n    console.log('something went wrong...', err);\n  });\n```\n\n## API\n\n### Recorder\n\n#### TNSRecorder Methods\n\n| Method                                                      | Description                                                              |\n| ----------------------------------------------------------- | ------------------------------------------------------------------------ |\n| _TNSRecorder.CAN_RECORD()_: `boolean` - **_static method_** | Determine if ready to record.                                            |\n| _start(options: AudioRecorderOptions)_: `Promise\u003cvoid\u003e`     | Start recording to file.                                                 |\n| _stop()_: `Promise\u003cvoid\u003e`                                   | Stop recording.                                                          |\n| _pause()_: `Promise\u003cvoid\u003e`                                  | Pause recording.                                                         |\n| _resume()_: `Promise\u003cvoid\u003e`                                 | Resume recording.                                                        |\n| _dispose()_: `Promise\u003cvoid\u003e`                                | Free up system resources when done with recorder.                        |\n| _getMeters(channel?: number)_: `number`                     | Returns the amplitude of the input.                                      |\n| _isRecording()_: `boolean` - **_iOS Only_**                 | Returns true if recorder is actively recording.                          |\n| _requestRecordPermission()_: `Promise\u003cvoid\u003e`                | _Android Only_ Resolves the promise is user grants the permission.       |\n| _hasRecordPermission()_: `boolean`                          | _Android Only_ Returns true if RECORD_AUDIO permission has been granted. |\n\n#### TNSRecorder Instance Properties\n\n| Property | Description                                                |\n| -------- | ---------------------------------------------------------- |\n| ios      | Get the native AVAudioRecorder class instance.             |\n| android  | Get the native MediaRecorder class instance.               |\n| debug    | Set true to enable debugging console logs (default false). |\n\n### Player\n\n#### TNSPlayer Methods\n\n| Method                                                                 | Description                                                  |\n| ---------------------------------------------------------------------- | ------------------------------------------------------------ |\n| _initFromFile(options: AudioPlayerOptions)_: `Promise`                 | Initialize player instance with a file without auto-playing. |\n| _playFromFile(options: AudioPlayerOptions)_: `Promise`                 | Auto-play from a file.                                       |\n| _initFromUrl(options: AudioPlayerOptions)_: `Promise`                  | Initialize player instance from a url without auto-playing.  |\n| _playFromUrl(options: AudioPlayerOptions)_: `Promise`                  | Auto-play from a url.                                        |\n| _pause()_: `Promise\u003cboolean\u003e`                                          | Pause playback.                                              |\n| _resume()_: `void`                                                     | Resume playback.                                             |\n| _seekTo(time:number)_: `Promise\u003cboolean\u003e`                              | Seek to position of track (in seconds).                      |\n| _dispose()_: `Promise\u003cboolean\u003e`                                        | Free up resources when done playing audio.                   |\n| _isAudioPlaying()_: `boolean`                                          | Determine if player is playing.                              |\n| _getAudioTrackDuration()_: `Promise\u003cstring\u003e`                           | Duration of media file assigned to the player.               |\n| _playAtTime(time: number)_: void - **_iOS Only_**                      | Play audio track at specific time of duration.               |\n| _changePlayerSpeed(speed: number)_: void - **On Android Only API 23+** | Change the playback speed of the media player.               |\n\n#### TNSPlayer Instance Properties\n\n| Property                | Description                                                |\n| ----------------------- | ---------------------------------------------------------- |\n| _ios_                   | Get the native ios AVAudioPlayer instance.                 |\n| _android_               | Get the native android MediaPlayer instance.               |\n| _debug_: `boolean`      | Set true to enable debugging console logs (default false). |\n| _currentTime_: `number` | Get the current time in the media file's duration.         |\n| _volume_: `number`      | Get/Set the player volume. Value range from 0 to 1.        |\n\n### License\n\n[MIT](/LICENSE)\n\n### Demo App\n\n- fork/clone the repository\n- cd into the `src` directory\n- execute `npm run demo.android` or `npm run demo.ios` (scripts are located in the `scripts` of the package.json in the `src` directory if you are curious)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradmartin%2Fnativescript-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradmartin%2Fnativescript-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradmartin%2Fnativescript-audio/lists"}