play-button
A Web Component to play audio or video with a button.
Demo
Examples
<script type="module" src="play-button.js"></script>
<play-button>
<audio controls src="https://darn.es/sounds/daviddarnes.m4a"></audio>
<button>Play</button>
</play-button>
Features
This Web Component allows you to:
- Control
audio or video elements with a single button which can play and pause the audio or video
Installation
You have a few options (choose one of these):
Usage
Make sure you include the <script> in your project (choose one of these):
<script type="module" src="play-button.js"></script>
<script type="module" src="https://www.unpkg.com/@daviddarnes/play-button@1.0.0/play-button.js"></script>
<script type="module" src="https://esm.sh/@daviddarnes/play-button@1.0.0"></script>
Credit
With thanks to the following people: