# @soundws/hls-web-audio

> A package allowing for steaming multiple audio tracks with precision.

Latest version **2.3.1-beta.1** (published 2024-06-06) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @soundws/hls-web-audio
pnpm add @soundws/hls-web-audio
yarn add @soundws/hls-web-audio
bun add @soundws/hls-web-audio
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.1-beta.1 |
| Published | 2024-06-06 |
| First published | 2023-04-25 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 263.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | The First Coders Team |
| Maintainers | firstcoders |
| Keywords | hls, m3u8, web-audio, stems, streaming |

## Links

- npm: https://www.npmjs.com/package/@soundws/hls-web-audio
- Repository: https://github.com/soundws/hls-web-audio
- Issues: https://github.com/soundws/hls-web-audio/issues
- npm.io page: https://npm.io/package/@soundws/hls-web-audio

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.3.1-beta.1 (latest) — 2024-06-06
- 2.3.1-beta.0 — 2024-06-04
- 2.3.0 — 2024-06-01
- 2.3.0-beta.4 — 2024-06-01
- 2.3.0-beta.3 — 2024-05-23
- 2.3.0-beta.2 — 2024-05-23
- 2.3.0-beta.1 — 2024-05-06
- 2.3.0-beta.0 — 2024-05-03
- 2.2.1 — 2024-04-09
- 2.2.1-beta.4 — 2024-04-09
- 2.2.1-beta.3 — 2024-03-28
- 2.2.1-beta.2 — 2024-03-07
- 2.2.1-beta.1 — 2024-03-06
- 2.2.1-beta.0 — 2024-03-06
- 2.2.0 — 2024-02-29
- … 22 more at https://npm.io/package/@soundws/hls-web-audio/versions

## README

# hls-web-audio

A package allowing for steaming multiple audio tracks with precision.

It uses the [HLS protocol](https://en.wikipedia.org/wiki/HTTP_Live_Streaming), however it will play any audio format that is supported by the relevant browser

and the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/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

```JS
import { Controller, HLS } from '@soundws/hls-web-audio';

// Create a controller to control playback
const controller = new Controller();

// register the HLS tracks with the controller
const drums = new HLS({ controller });
const piano = new HLS({ controller });
const vocal = new HLS({ controller });

// Load all the tracks
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)
})

// seek
controller.currentTime = 30 // seconds
controller.pct = 50 // percent

// events
controller.on('start', () => { /*..*/ }) // when playback starts
controller.on('pause', () => { /*..*/ }) // when playback pauses
controller.on('pause-start', () => { /*..*/ }) // when pausing (due to buffering) starts
controller.on('pause-end', () => { /*..*/ }) // when pausing (due to buffering) ends
controller.on('timeupdate', ({ t, pct }) => { /*..*/ }) // progress events, emitted ongoing
controller.on('seek', ({ t, pct }) => { /*..*/ }) // seek event, when currentTime is changed via setting either controller.currentTime or controller.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/>.

---
_Source: https://npm.io/package/@soundws/hls-web-audio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
