TIP: Try navigating through list using left & right arrow keys
ta

ts-audio

:musical_score: ts-audio is an agnostic library that makes it easy to work with AudioContext and create audio playlists in the browser

98
Github issues
0Github stars
10 days ago
Github last update date
4
NPM current week downloads

ts-audio · Build Status license

ts-audio is an agnostic and easy-to-use library to work with the AudioContext API and create Playlists.

Features

  • Simple API that abstracts the complexity of the AudioContext API
  • Cross-browser support
  • Makes easy to create audio playlist
  • Works with any language that compiles to JavaScript
  • Supports to Types
  • Zero-dependecy

Installation

To install ts-audio, execute:

$ npm install ts-audio

or

$ yarn add ts-audio

Quickstart

ts-audio has two components at its core: Audio and AudioPlaylist. Both components are functions that you can call with certain parameters.

Below is an example of how to use the Audio:

import Audio from 'ts-audio';

const audio = Audio({
  file: './song.mp3',
  loop: true,
  volume: 0.2,
});

audio.play();

To use the AudioPlaylist component is also quite simple:

import { AudioPlaylist } from 'ts-audio';

const playlist = AudioPlaylist({
  files: ['./songOne.mp3', './songTwo.mp3', './songThree.mp3'],
  volume: 0.7,
});

playlist.play();

Docs

License

MIT

Buy us a coffeeBuy us a coffee