{"id":14990167,"url":"https://github.com/daviddarnes/is-playing","last_synced_at":"2025-07-10T22:04:54.104Z","repository":{"id":213387945,"uuid":"729863312","full_name":"daviddarnes/is-playing","owner":"daviddarnes","description":"A Web Component to indicate when an audio, or video, element is playing","archived":false,"fork":false,"pushed_at":"2024-09-18T08:37:33.000Z","size":23,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-14T08:07:50.779Z","etag":null,"topics":["component","components","customelement","customelements","webcomponent","webcomponents"],"latest_commit_sha":null,"homepage":"https://daviddarnes.github.io/is-playing/demo.html","language":"HTML","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/daviddarnes.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null},"funding":{"buy_me_a_coffee":"daviddarnes"}},"created_at":"2023-12-10T15:36:30.000Z","updated_at":"2025-03-03T19:24:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7389adc-3393-4801-90e5-c3709d0a3823","html_url":"https://github.com/daviddarnes/is-playing","commit_stats":null,"previous_names":["daviddarnes/is-playing"],"tags_count":2,"template":false,"template_full_name":"daviddarnes/component-template","purl":"pkg:github/daviddarnes/is-playing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Fis-playing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Fis-playing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Fis-playing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Fis-playing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daviddarnes","download_url":"https://codeload.github.com/daviddarnes/is-playing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Fis-playing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264673462,"owners_count":23647620,"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":["component","components","customelement","customelements","webcomponent","webcomponents"],"created_at":"2024-09-24T14:19:38.856Z","updated_at":"2025-07-10T22:04:54.082Z","avatar_url":"https://github.com/daviddarnes.png","language":"HTML","funding_links":["https://buymeacoffee.com/daviddarnes"],"categories":[],"sub_categories":[],"readme":"# `is-playing`\n\nA Web Component to indicate when an audio, or video, element is playing.\n\n**[Demo](https://daviddarnes.github.io/is-playing/demo.html)** | **[Futher reading](https://darn.es/is-playing-web-component/)**\n\n## Examples\n\n```html\n\u003cscript type=\"module\" src=\"is-playing.js\"\u003e\u003c/script\u003e\n\n\u003cis-playing\u003e\n  \u003caudio controls src=\"https://darn.es/sounds/daviddarnes.m4a\"\u003e\u003c/audio\u003e\n\u003c/is-playing\u003e\n```\n\n## Features\n\nThis Web Component allows you to:\n\n- Select and style elements depending if an `audio` or `video` element is playing, using `:state(playing)` state selector\n- Polyfill for the [`:playing` CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/:playing)\n- Surface and utilise the ID of the `audio` or `video` element playing with a `playing` attribute value on the `is-playing` element\n\n## Installation\n\nYou have a few options (choose one of these):\n\n1. Install via [npm](https://www.npmjs.com/package/@daviddarnes/is-playing): `npm install @daviddarnes/is-playing`\n1. [Download the source manually from GitHub](https://github.com/daviddarnes/is-playing/releases) into your project.\n1. Skip this step and use the script directly via a 3rd party CDN (not recommended for production use)\n\n### Usage\n\nMake sure you include the `\u003cscript\u003e` in your project (choose one of these):\n\n```html\n\u003c!-- Host yourself --\u003e\n\u003cscript type=\"module\" src=\"is-playing.js\"\u003e\u003c/script\u003e\n```\n\n```html\n\u003c!-- 3rd party CDN, not recommended for production use --\u003e\n\u003cscript\n  type=\"module\"\n  src=\"https://www.unpkg.com/@daviddarnes/is-playing@2.0.0/is-playing.js\"\n\u003e\u003c/script\u003e\n```\n\n```html\n\u003c!-- 3rd party CDN, not recommended for production use --\u003e\n\u003cscript\n  type=\"module\"\n  src=\"https://esm.sh/@daviddarnes/is-playing@2.0.0\"\n\u003e\u003c/script\u003e\n```\n\n### Multiple `audio` and `video` elements\n\n`is-playing` will also reveal which audio element is playing by adding a `playing` attribute to itself with the value of the playing elements ID. Note that in order for this to happen the playing element must have an `id` and there needs to be at least 2 `audio` or `video` elements:\n\n```html\n\u003cis-playing\u003e\n  \u003caudio\n    id=\"audio-2\"\n    controls\n    src=\"https://darn.es/sounds/daviddarnes2.m4a\"\n  \u003e\u003c/audio\u003e\n  \u003caudio\n    id=\"audio-3\"\n    controls\n    src=\"https://darn.es/sounds/daviddarnes3.m4a\"\n  \u003e\u003c/audio\u003e\n\u003c/is-playing\u003e\n```\n\n## Credit\n\nWith thanks to the following people:\n\n- [Zach Leatherman](https://zachleat.com) for inspiring this [Web Component repo template](https://github.com/daviddarnes/component-template)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaviddarnes%2Fis-playing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaviddarnes%2Fis-playing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaviddarnes%2Fis-playing/lists"}