Get started with quicksound.js CDN

MIT licensed

QuickSound.js is a library for playing sound effects in the web browser.

Tags:
  • audio
  • WebAudio

Stable version

Copied!

How to start using quicksound.js CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with quicksound.js CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/quicksound.js/0.5.2/quicksound.min.js"></script>
  <style>
    body { text-align: center; margin-top: 50px; }
  </style>
</head>
<body>
  <button id="play-button">Play Sound</button>
  <script>
    const QS = QuickSound;
    const sound = new QS.Sound();

    document.getElementById('play-button').addEventListener('click', () => {
      sound.load('sound.wav');
      sound.play();
    });

    sound.onload = () => {
      console.log('Sound loaded.');
    };

    sound.onfinish = () => {
      console.log('Sound finished playing.');
    };
  </script>
</body>
</html>
Copied!
Copied!
Copied!

All versions