{"id":14990165,"url":"https://github.com/daviddarnes/random-source","last_synced_at":"2025-04-12T02:05:29.870Z","repository":{"id":239970642,"uuid":"729976102","full_name":"daviddarnes/random-source","owner":"daviddarnes","description":"A Web Component to randomly change audio or video sources","archived":false,"fork":false,"pushed_at":"2024-08-02T09:48:25.000Z","size":14,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T21:47:33.279Z","etag":null,"topics":["component","components","customelement","customelements","webcomponent","webcomponents"],"latest_commit_sha":null,"homepage":"https://daviddarnes.github.io/random-source/demo.html","language":"JavaScript","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":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}},"created_at":"2023-12-10T23:03:18.000Z","updated_at":"2025-03-03T19:25:36.000Z","dependencies_parsed_at":"2024-09-24T16:00:33.401Z","dependency_job_id":null,"html_url":"https://github.com/daviddarnes/random-source","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"939b2c9310c8ff76fc303e855c0cd90f188e601f"},"previous_names":["daviddarnes/random-source"],"tags_count":3,"template":false,"template_full_name":"daviddarnes/component-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Frandom-source","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Frandom-source/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Frandom-source/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daviddarnes%2Frandom-source/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daviddarnes","download_url":"https://codeload.github.com/daviddarnes/random-source/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208603,"owners_count":21065203,"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.670Z","updated_at":"2025-04-12T02:05:29.840Z","avatar_url":"https://github.com/daviddarnes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `random-source`\n\nA Web Component to randomly change audio or video sources.\n\n**[Demo](https://daviddarnes.github.io/random-source/demo.html)** | **[Further reading](https://darn.es/random-source-web-component/)**\n\n## Examples\n\n```html\n\u003cscript type=\"module\" src=\"random-source.js\"\u003e\u003c/script\u003e\n\n\u003crandom-source\u003e\n  \u003caudio controls\u003e\n    \u003csource src=\"https://darn.es/sounds/daviddarnes.m4a\" /\u003e\n    \u003csource src=\"https://darn.es/sounds/daviddarnes2.m4a\" /\u003e\n  \u003c/audio\u003e\n\u003c/random-source\u003e\n```\n\n## Features\n\nThis Web Component allows you to:\n\n- Randomly change the source of an `audio` or `video` element once the source has ended\n- Trust that the first `source` element will always be used on load, to match default behaviour\n\n## Installation\n\nYou have a few options (choose one of these):\n\n1. Install via [npm](https://www.npmjs.com/package/@daviddarnes/random-source): `npm install @daviddarnes/random-source`\n1. [Download the source manually from GitHub](https://github.com/daviddarnes/random-source/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=\"random-source.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/random-source@1.1.1/random-source.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/random-source@1.1.1\"\n\u003e\u003c/script\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%2Frandom-source","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaviddarnes%2Frandom-source","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaviddarnes%2Frandom-source/lists"}