Socket
Book a DemoInstallSign in
Socket

@daviddarnes/duration-property

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/duration-property

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

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

duration-property

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

Demo

Examples

<script type="module" src="duration-property.js"></script>

<duration-property>
  <audio controls src="https://darn.es/sounds/daviddarnes.m4a"></audio>
</duration-property>

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

  • Install via npm: npm install @daviddarnes/duration-property
  • 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="duration-property.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script type="module" src="https://www.unpkg.com/@daviddarnes/duration-property@1.0.0/duration-property.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script type="module" src="https://esm.sh/@daviddarnes/duration-property@1.0.0"></script>

Credit

With thanks to the following people:

Keywords

web

FAQs

Package last updated on 18 Feb 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