dascritch / cpu-audio

An audio WebComponent to provide timecoded links and other features to an audio tag
https://dascritch.github.io/cpu-audio/
GNU Lesser General Public License v3.0
24 stars 2 forks source link
audio-player hyperlink playlist sound timecoded-links vanilla webcomponents

CPU-Audio WebComponent

An audio WebComponent to provide an user-interface, timecoded links and some other features to an <audio> tag.

<cpu-audio title="Au carnaval avec Samba Résille (2003)" poster="https://dascritch.net/vrac/.blog2/entendu/.1404-SambaResille_m.jpg" canonical="https://dascritch.net/post/2014/04/08/Au-Carnaval-avec-Samba-R%C3%A9sille" waveform="./tests-assets/waveform-sambaresille.png" twitter="@dascritch"

Purpose

A generic WebComponent crafted with a hashtag observer for <audio> tags with fancy interface, hyperlinks, chaptering, playlist and share buttons.

When you load a page :

  1. if your URL has a hash with a timecode (https://example.com/page#tagID&t=10m), the service will position the named <audio controls> at this timecode (here, #TagID at 10 minutes) ;
  2. or, if a audio source (qualified by its url) was played in your website, and was unexpectedly exited, the service will reposition its <audio controls> at the same timecode.

During the page life :

This link starts the upper player at 20:45, and a link can limit playing between a start (0:05) and end (0:08) marks

Features

TL;DR ? See it in action

It could have been done via polyfills or frameworks, but I wanted a plain standard, vanilla javascript, easy to install and configure.

HOW TO install

A unique and lightweight js file to install, without any dependencies.

Keyboard functions

When the interface got the focus, you can use those keys :

For handheld users, a long press on the timeline will show you another interface for a more precise navigation (Desktop users can try it via a right click on it).

Some links

Participate

Credits

Thank you to my lovely friends :

Really sorry, NerOcrO

Keeping in touch