An open API service indexing awesome lists of open source software.

https://github.com/daviddarnes/duration-property

A Web Component to surface an audio or video's duration as a CSS Custom Property
https://github.com/daviddarnes/duration-property

component components customelement customelements webcomponent webcomponents

Last synced: about 1 year ago
JSON representation

A Web Component to surface an audio or video's duration as a CSS Custom Property

Awesome Lists containing this project

README

          

# `duration-property`

A Web Component to surface an audio or video's duration as a CSS Custom Property.

**[Demo](https://daviddarnes.github.io/duration-property/demo.html)** | **[Further reading](https://darn.es/duration-property-web-component/)**

## Examples

```html

```

## Features

This Web Component allows you to:

- Surface the duration of an audio or video elements source duration as a CSS Custom Property (`--duration`)
- Update the `--duration` custom property if the duration of the source changes

## Installation

You have a few options (choose one of these):

1. Install via [npm](https://www.npmjs.com/package/@daviddarnes/duration-property): `npm install @daviddarnes/duration-property`
1. [Download the source manually from GitHub](https://github.com/daviddarnes/duration-property/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="duration-property.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)