🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@daviddarnes/sample-input

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daviddarnes/sample-input

A Web Component to sample audio or video added to an upload input

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

sample-input

A Web Component to sample audio or video added to an upload input

Demo

Examples

General usage example:

<script type="module" src="sample-input.js"></script>

<sample-input>
  <input aria-controls="preview" type="file">
  <audio id="preview" aria-live="polite" controls></audio>
</sample-input>

Example usage with the capture option to record live audio (not compatible with all hardware) and placeholder audio:

<script type="module" src="sample-input.js"></script>

<sample-input>
  <input aria-controls="preview" type="file" accept="audio/*" capture>
  <audio id="preview" aria-live="polite" controls src="https://darn.es/sounds/daviddarnes.m4a"></audio>
</sample-input>

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):

  • Install via npm: npm install @daviddarnes/sample-input
  • Download the source manually from GitHub into your project.
  • Skip this step and use the script directly via a 3rd party CDN (not recommended for production use)

Usage

Make sure you include the <script> in your project (choose one of these):

<!-- Host yourself -->
<script type="module" src="sample-input.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script type="module" src="https://www.unpkg.com/@daviddarnes/sample-input@1.0.0/sample-input.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script type="module" src="https://esm.sh/@daviddarnes/sample-input@1.0.0"></script>

Credit

With thanks to the following people:

Keywords

web

FAQs

Package last updated on 08 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts