jQuery Plugin For Playing Sounds On Events - Ion.Sound

File Size: 902 KB
Views Total: 12664
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Playing Sounds On Events - Ion.Sound

Ion.Sound is a lightweight and cross-browser jQuery plugin which allows to play a collection of sounds (ogg and mp3) with options and events (such as mouse click).

Basic Usage:

1. Inlcude jQuery library and jQuery Ion.Sound plugin on your web page

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="static/js/ion-sound/ion.sound.js"></script>

2. Create a button to play the sounds

<button class="button" id="b01">Play</button>

3. Call the plugin

$(function(){
ion.sound.init();
$("#b01").on("click", function(){
ion.sound.play("beer_can_opening");
});
});

4. Options

ion.sound.init({

// set sounds names
// Collection of sound objects. 
// Each object contains information about sound file and (optional) individual settings
sounds: [],

// set path to sounds
path: "sounds/",

// enable infinite loop. 
// or paste a number to set loop limit
loop: false

// set to true to preload that sound file on page load.
preload: false,   

// playback volume from 0 to 1
volume: "0.3",

// callbacks will be called in that object's scope
scope: null,

// called after sound file is fully uploaded
ready_callback: null,

// Called each time then sound file will reach it's end
ended_callback: null

});

Change logs:

2018-02-28

  • Removed console log

v3.0.0 (2015-02-11)

v2.0.1 (2014-08-01)

  • 2 versions of plugin, jQuery and non-jQuery
  • new API, loop sounds feature

v1.3.0 (2013-11-30)

  • new methods "stop" and "kill". Ability to reset sound volume.

v1.2.0 (2013-10-14)

  • now you can set individual volume for any sound. 

v1.1.0 (2013-09-22)

  • plugin moved to jQuery namespace, new method and 10 new sounds

This awesome jQuery plugin is developed by IonDen. For more Advanced Usages, please check the demo page or visit the official website.