Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akarachen/audio-queue
https://github.com/akarachen/audio-queue
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/akarachen/audio-queue
- Owner: AkaraChen
- Created: 2024-05-31T14:21:23.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-01T03:17:42.000Z (5 months ago)
- Last Synced: 2024-10-24T04:08:34.642Z (14 days ago)
- Language: TypeScript
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# audio-queue
```
๐งช WIP: will be available later
```Just add audio to the queue and it will play it for you, one after the other.
## Installation
```bash
npm install audio-queue howler
npm install -D @types/howler
```## Usage
```javascript
import { AudioQueue } from 'audio-queue'
import { Howl } from 'howler'const audioQueue = new AudioQueue()
audioQueue.add(new Howl({ src: ['audio.mp3'] }))
```And you can abort an audio by calling `.abort()` on the return of `add`:
```javascript
const abortController = audioQueue.add(new Howl({ src: ['audio.mp3'] }))abortController.abort()
```Or you can pause/resume/stop the current audio:
```javascript
audioQueue.pause()
audioQueue.resume()
audioQueue.stop()
```And you can even clear the queue:
```javascript
audioQueue.clear()
```