{"id":34807638,"url":"https://github.com/mehyaa/nativescript-audioplay","last_synced_at":"2025-12-25T12:05:16.336Z","repository":{"id":57308403,"uuid":"134267895","full_name":"mehyaa/nativescript-audioplay","owner":"mehyaa","description":"NativeScript plugin to play audio files for Android and iOS.","archived":false,"fork":false,"pushed_at":"2021-06-01T06:39:54.000Z","size":17,"stargazers_count":3,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-21T10:44:11.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mehyaa.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-05-21T12:44:16.000Z","updated_at":"2022-05-13T03:18:18.000Z","dependencies_parsed_at":"2022-09-10T01:02:48.292Z","dependency_job_id":null,"html_url":"https://github.com/mehyaa/nativescript-audioplay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mehyaa/nativescript-audioplay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehyaa%2Fnativescript-audioplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehyaa%2Fnativescript-audioplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehyaa%2Fnativescript-audioplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehyaa%2Fnativescript-audioplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mehyaa","download_url":"https://codeload.github.com/mehyaa/nativescript-audioplay/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehyaa%2Fnativescript-audioplay/sbom","scorecard":{"id":635412,"data":{"date":"2025-08-11","repo":{"name":"github.com/mehyaa/nativescript-audioplay","commit":"c566b648d19fe314c70106bef5301c010bb929cb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"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":"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/6 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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"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":"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":"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":"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":"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-21T09:02:20.547Z","repository_id":57308403,"created_at":"2025-08-21T09:02:20.547Z","updated_at":"2025-08-21T09:02:20.547Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28028885,"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","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-12-25T12:04:45.247Z","updated_at":"2025-12-25T12:05:16.315Z","avatar_url":"https://github.com/mehyaa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca align=\"center\" href=\"https://www.npmjs.com/package/nativescript-audioplay\"\u003e\n    \u003ch3 align=\"center\"\u003eNativeScript Audio Play\u003c/h3\u003e\n\u003c/a\u003e\n\n\u003ch4 align=\"center\"\u003eNativeScript plugin to play audio files for Android and iOS.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  Ported from \u003ca href=\"https://github.com/nstudio/nativescript-audio\"\u003enativescript-audio\u003c/a\u003e (v4.3.5) to require lesser permissions for audio playback only. All credits go to \u003ca href=\"https://github.com/nstudio/nativescript-audio/graphs/contributors\"\u003eoriginal project contributors\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/nativescript-audioplay\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/nativescript-audioplay.svg\" alt=\"npm\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/nativescript-audioplay\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/dt/nativescript-audioplay.svg?label=npm%20downloads\" alt=\"npm-downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/mehyaa/nativescript-audioplay/blob/master/LICENSE.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/mehyaa/nativescript-audioplay.svg\" alt=\"license\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\n## Installation\n\n`tns plugin add nativescript-audioplay`\n\n---\n\n### Android Native Classes\n\n* [Player - android.media.MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html)\n\n### iOS Native Classes\n\n* [Player - AVAudioPlayer](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/)\n\n## Usage\n\n### TypeScript Example\n\n```typescript\nimport { TNSPlayer } from 'nativescript-audioplay';\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-audioplay');\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### 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.                                            |\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.md)\n\n### Credits\n\n\u003ca href=\"https://github.com/nstudio/nativescript-audio/graphs/contributors\"\u003enativescript-audio\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehyaa%2Fnativescript-audioplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehyaa%2Fnativescript-audioplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehyaa%2Fnativescript-audioplay/lists"}