ts-audio v0.7.2
ts-audio
is an agnostic library that makes it easy to work with AudioContext
and create audio playlists in the browser.
What's new?
- Refactored out both
Audio
andAudioPlaylist
modules - Updated the
AudioPlaylist
module adding logic to support weighted files.- Note: If you pass files with a weighted structure, the playlist will be played in a loop and shuffled.
import { AudioPlaylist } from 'ts-audio';
import songOne from './1.mp3';
import songTwo from './2.mp3';
import songThree from './3.mp3';
const playlist = AudioPlaylist({
files: { [songOne]: 1, [songTwo]: 5, [songThree]: 1 },
});
playlist.play(); // `songTwo` will play five times more often than `songOne` and `songTree`