Get started with buzz CDN
MIT licensed
Buzz is a lightweight library for playing MP3 files in the browser.
Tags:- html5
- audio
- library
- buzz
- buzz.js
Stable version
Copied!
How to start using buzz CDN
// Include the Buzz library
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/buzz/1.2.1/buzz.min.js';
document.head.appendChild(script);
// Wait for the library to load
window.addEventListener('Buzz:load', () => {
// Create a new player instance
const player = new Buzz.Player('path/to/your/mp3file.mp3', {
formats: ['mp3'], // Set the format of the file
devices: ['audio'] // Set the output device
});
// Play the file
player.play();
// Attach event listeners for state changes
player.on('timeupdate', () => {
console.log('Current time:', player.getCurrentTime());
});
player.on('ended', () => {
console.log('File has ended.');
});
});
Copied!
Copied!