https://github.com/daviddarnes/sample-input
A Web Component to sample audio or video added to an upload input
https://github.com/daviddarnes/sample-input
component components customelement customelements webcomponent webcomponents
Last synced: 11 months ago
JSON representation
A Web Component to sample audio or video added to an upload input
- Host: GitHub
- URL: https://github.com/daviddarnes/sample-input
- Owner: daviddarnes
- License: mit
- Created: 2023-12-11T16:15:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T10:27:26.000Z (about 2 years ago)
- Last Synced: 2025-04-12T02:05:45.587Z (about 1 year ago)
- Topics: component, components, customelement, customelements, webcomponent, webcomponents
- Language: HTML
- Homepage: https://daviddarnes.github.io/sample-input/demo.html
- Size: 16.6 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# `sample-input`
A Web Component to sample audio or video added to an upload input
**[Demo](https://daviddarnes.github.io/sample-input/demo.html)** | **[Further reading](https://darn.es/sample-input-web-component/)**
## Examples
General usage example:
```html
```
Example usage with the `capture` option to record live audio (not compatible with all hardware) and placeholder audio:
```html
```
## Features
This Web Component allows you to:
- Add an audio or video file that's been added via an upload input to an `audio` or `video` element so it can be previewed
## Installation
You have a few options (choose one of these):
1. Install via [npm](https://www.npmjs.com/package/@daviddarnes/sample-input): `npm install @daviddarnes/sample-input`
1. [Download the source manually from GitHub](https://github.com/daviddarnes/sample-input/releases) into your project.
1. Skip this step and use the script directly via a 3rd party CDN (not recommended for production use)
### Usage
Make sure you include the `` in your project (choose one of these):
```html
<!-- Host yourself -->
<script type="module" src="sample-input.js">
```
```html
```
```html
```
## Credit
With thanks to the following people:
- [Zach Leatherman](https://zachleat.com) for inspiring this [Web Component repo template](https://github.com/daviddarnes/component-template)