A 15 millisecond silent MP3 file generated by Audacity, and exported as a datauri string. This can be used for detecting autoplay behaviour in browsers.
Note: The 15 ms duration was decided through testing on Samsung Galaxy S6, which was not capable of handling smaller files in audioContext.decodeAudioData
.
npm install silent-mp3-datauri --save
The main export is a string, a datauri for the mp3.
var silence = require('silent-mp3-datauri')
var audio = new Audio()
audio.addEventListener('canplay', () => {
console.log("Can play!")
})
audio.src = silence
MIT, see LICENSE.md for details.