Get started with soundmanager2 CDN

BSD licensed

SoundManager2 is a library for managing and loading audio files in web applications.

Tags:
  • browser
  • audio
  • sound
  • mp3
  • mpeg4
  • html5

Stable version

Copied!

How to start using soundmanager2 CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with soundmanager2 CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/soundmanager2/V2.97a.20170601/script/soundmanager2-nodebug-jsmin.js"></script>
</head>
<body>
  <button id="play">Play Sound</button>
  <script>
    // Initialize SoundManager2
    SoundManager.setup();

    // Create a new sound
    var mySound = new Sound();
    mySound.src = "sound.mp3"; // Replace with the path to your sound file

    // Load the sound
    mySound.load();

    // Attach a click event to the play button
    document.getElementById("play").addEventListener("click", function() {
      // Play the sound
      mySound.play();
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions