npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

audio-sync

v1.0.1

Published

An audio player that keeps multiple tracks synchronized.

Downloads

1

Readme

audiosync

An audio player allowing you switch tracks keeping the same timestamp.

Usage

<script src="https://cdn.jsdelivr.net/npm/audio-sync"></script>
<script>
  audioSync([
    ['file-a.mp3', 'track1-A'],
    ['file-b.mp3', 'track1-B'],
    ['file-c.mp3', 'track1-C']
  ]);
</script>

Instanciation

To instanciate a new player, use the provided audioSync() method.

This method needs an array of couples [fileLocation, element] with fileLocation being a string, and element being any HTMLElement or a string of the targeted HTMLElement id.

Example

audioSync([
  // 'track-en' will be converted to document.getElementById('track-en')
  ['english-version.mp3', 'track-en'],
  ['french-version.mp3', document.getElementById('track-fr')]
]);

Controls

Clicking an element while its track is paused will start playing it and will pause all the other tracks (and the all the other audio players instances with it).

Clicking an element while its track is playing will pause it.

Bindings

The HTMLElement is bound to the track once the track has finished loading.

Once all the tracks are available and ready to play, the player is set to ready and thus make it controllable.

If one of the track fails loading, then no binding occurs.

Customization

The HTMLElements will receive a class when its bound track state changes.

| Class | When | | :-------- | :------------------------- | | loading | The track is being fetched | | paused | The track is not playing | | playing | The track is playing | | failed | An error has occured* |

*This might happen when the sound file is not reachable or readable

Browser Compatibility and File Format Support

Retrocompatibility

Under the hood, audio-sync is using browser's native HTMLAudioElement to play the tracks.
audio-sync should support IE9 and every recent browser (tests required).
For more details → See browser compatibility

Audio file formats

| Format | | | -------| --- | | MP3 | See more | | OGG | See more | | AAC | See more | | FLAC | See more | | WAV | See more |

Or take a look at W3School compatibility table

Contribute

Feel free to report a bug or to provide any kind of improvement or fix through pull request.

Setup the project

git clone https://github.com/pellul/audio-sync.git
npm install

Build

npm run build

This will generate a index.js minified file in the dist/ folder.