{"id":22505160,"url":"https://github.com/azer/play-audio","last_synced_at":"2025-08-03T11:32:44.515Z","repository":{"id":9636032,"uuid":"11567457","full_name":"azer/play-audio","owner":"azer","description":"Lightweight Wrapper For HTML5 Audio API","archived":false,"fork":false,"pushed_at":"2017-01-10T16:22:47.000Z","size":15,"stargazers_count":69,"open_issues_count":1,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-23T13:19:51.867Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-21T20:42:17.000Z","updated_at":"2025-01-29T05:53:38.000Z","dependencies_parsed_at":"2022-08-31T00:01:14.941Z","dependency_job_id":null,"html_url":"https://github.com/azer/play-audio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azer/play-audio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fplay-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fplay-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fplay-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fplay-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/play-audio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fplay-audio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267542540,"owners_count":24104521,"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-07-28T02:00:09.689Z","response_time":68,"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":"2024-12-07T00:15:30.950Z","updated_at":"2025-08-03T11:32:44.209Z","avatar_url":"https://github.com/azer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## play-audio\n\nLightweight Wrapper For HTML5 Audio API\n\n```js\nplay = require('play-audio')\n\nplay('song.mp3').autoplay()\n```\n\n* Example 1: [Playing An Alert Sound](http://requirebin.com/?gist=6050020)\n* Example 2: [Music player](http://requirebin.com/?gist=6049983)\n* Example 3: [alert library](http://github.com/azer/alert)\n\n## Install\n\n```bash\n$ npm install play-audio\n```\n\n## Browser Compatibility\n\n```js\nplay(['song.mp3', 'song.ogg']).play()\n```\n\n## Displaying Controls\n\n```js\nparent = document.querySelector('.my-player')\nplay(['song.mp3', 'song.ogg'], parent).autoplay.controls()\n```\n\n## How to use without NPM?\n\nIf your application isn't structured as a CommonJS package, you can download the distribution file;\n\n```bash\n$ wget https://raw.github.com/azer/play-audio/master/dist/play-audio.js\n```\n\nAnd include it on your page:\n\n```html\n\u003cscript src=\"play-audio.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  playAudio(['song.mp3', 'song.ogg'])\n\u003c/script\u003e\n```\n\n## Changing Source After Initialization\n\n```js\np = play(['song.mp3', 'song.ogg']).autoplay()\np.src()\n// =\u003e ['song.mp3', 'song.ogg']\n\np.src(['new.mp3', 'new.ogg']).play()\np.src()\n// =\u003e ['new.mp3', 'new.ogg']\n```\n\n## API\n\nExample:\n\n```js\nplay('foo.mp3').volume(0.3).controls().loop().on('ended', function(){\n  console.log('End of the song reached')\n})\n```\n\nReference:\n\n* play(uri, parentElement)\n* .controls\n* .currentTime\n* .element\n* .loop\n* .muted\n* .on(event, function)\n* .pause\n* .play\n* .preload\n* .src(url)\n* .volume(number)\n\n## Events\n\n* abort\n* durationchange\n* ended\n* error\n* pause\n* play\n* progress\n* timeupdate\n\n[See complete reference](http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#mediaevents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fplay-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Fplay-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fplay-audio/lists"}