Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EvandroLG/ts-audio
:musical_score: ts-audio is an agnostic library that makes it easy to work with AudioContext and create audio playlists in the browser
https://github.com/EvandroLG/ts-audio
audio audiocontext-api client-side song typescript
Last synced: 3 months ago
JSON representation
:musical_score: ts-audio is an agnostic library that makes it easy to work with AudioContext and create audio playlists in the browser
- Host: GitHub
- URL: https://github.com/EvandroLG/ts-audio
- Owner: EvandroLG
- License: mit
- Created: 2013-08-25T03:01:42.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-07-17T08:47:35.000Z (4 months ago)
- Last Synced: 2024-07-17T17:40:14.280Z (4 months ago)
- Topics: audio, audiocontext-api, client-side, song, typescript
- Language: TypeScript
- Homepage:
- Size: 11.6 MB
- Stars: 312
- Watchers: 6
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# · [![license](https://badgen.now.sh/badge/license/MIT)](./LICENSE)
`ts-audio` is an agnostic and easy-to-use library to work with the `AudioContext` API and create Playlists.
## Features
- Simple API that abstracts the complexity of the AudioContext API
- Cross-browser support
- Makes easy to create audio playlist
- Works with any language that compiles to JavaScript
- Supports to Types
- Zero-dependecy## Installation
To install `ts-audio`, execute:
```sh
$ npm install ts-audio
```or
```sh
$ yarn add ts-audio
```## Quickstart
`ts-audio` has two components at its core: `Audio` and `AudioPlaylist`. Both components are functions that you can call with certain parameters.
Below is an example of how to use the `Audio`:```js
import { Audio } from 'ts-audio';const audio = Audio({
file: './song.mp3',
loop: true,
volume: 0.2,
});audio.play();
```- [Complete example](https://codesandbox.io/s/ts-audio-audio-m54u5)
To use the `AudioPlaylist` component is also quite simple:
```js
import { AudioPlaylist } from 'ts-audio';const playlist = AudioPlaylist({
files: ['./songOne.mp3', './songTwo.mp3', './songThree.mp3'],
volume: 0.7,
});playlist.play();
```- [Complete example](https://codesandbox.io/s/ts-audio-playlist-ovynj)
## Docs
- Audio
- [Parameters](https://github.com/EvandroLG/ts-audio/wiki/Audio:-Parameters)
- [Properties](https://github.com/EvandroLG/ts-audio/wiki/Audio:-Properties)
- [Methods](https://github.com/EvandroLG/ts-audio/wiki/Audio:-Methods)
- [Events](https://github.com/EvandroLG/ts-audio/wiki/Audio:-Events)* AudioPlaylist
- [Parameters](https://github.com/EvandroLG/ts-audio/wiki/AudioPlaylist:-Parameters)
- [Properties](https://github.com/EvandroLG/ts-audio/wiki/AudioPlaylist:-Properties)
- [Methods](https://github.com/EvandroLG/ts-audio/wiki/AudioPlaylist:-Methods)
- [Events](https://github.com/EvandroLG/ts-audio/wiki/AudioPlaylist:-Events)## License
[MIT](https://github.com/EvandroLG/ts-audio/tree/master/LICENSE)