Socket
Socket
Sign inDemoInstall

@soundws/hls-web-audio

Package Overview
Dependencies
0
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @soundws/hls-web-audio

A package allowing for steaming multiple audio tracks with precision.


Version published
Weekly downloads
299
increased by147.11%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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';

// 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/.

Keywords

FAQs

Last updated on 06 Jun 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc