1.0.7 • Published 6 years ago

play-web-audio v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Play Web Audio

Install

yarn add play-web-audio

Usage

import { playAudio, loadAudioUrls } from 'play-web-audio'

let squakk
const soundUrls = ['./sounds/squakk.mp3']

loadAudioUrls(this.soundUrls, bufferList => {
  squakk = bufferList[0]
})

playAudio(squakk) // plays the audio file
/*
    N.B. on many device autoplay is not allowed, then this must be initiated by a user interaction, like a mouse click or finger tap.

*/

Example

Demonstration of using the Web Audio API using React. See folder example. Try this on iPhone/Safari (iOS), playback is instant! Now compare it with the implementation using the <audio> HTML tag... long delay on iPhone.

Ergo: use the Web Audio API instead.

https://play-it.now.sh

Credits

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago