hls-web-audio
A package allowing for steaming multiple audio tracks with precision.
It uses the HLS protocol, however it will play any audio format that is supported by the relevant browser
and the Web Audio API.
Contributing
This repo is a subtree split of our monorepo which will be made public in due course. We cannot process any pull-requests to this repo. Please contact us for help.
Usage
import { Controller, HLS } from '@soundws/hls-web-audio';
const controller = new Controller();
const drums = new HLS({ controller });
const piano = new HLS({ controller });
const vocal = new HLS({ controller });
Promise.all([
drums.load('http://my-server.com/drums.m3u8').promise,
piano.load('http://my-server.com/piano.m3u8').promise,
vocal.load('http://my-server.com/vocal.m3u8').promise
]).then(() => {
controller.play()
}).catch((err) => {
console.error(err)
})
controller.currentTime = 30
controller.pct = 50
controller.on('start', () => { })
controller.on('pause', () => { })
controller.on('pause-start', () => { })
controller.on('pause-end', () => { })
controller.on('timeupdate', ({ t, pct }) => { })
controller.on('seek', ({ t, pct }) => { })
License
Copyright (C) 2019-2023 First Coders LTD
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.