Load Working/ did not understand

by Ehsan Ziya

HTML

<input type="button" id="Play" value="Play">

JavaScript

var context = new webkitAudioContext();
var myAudioBuffer = null;
var url = 'http://thelab.thingsinjars.com/web-audio-tutorial/hello.mp3';
var button = document.getElementById('Play');


function loadSound(url) {
    var request = new XMLHttpRequest();
    request.open('GET', url, true);
    request.responseType = "arraybuffer";
    request.addEventListener('load', function () {
        context.decodeAudioData(request.response, function (buffer) {
            myAudioBuffer = buffer;
        });
    }, false);
    request.send();
}


//var source = null;

function playSound(anyBuffer) {
source = context.createBufferSource();
source.buffer = anyBuffer;
source.connect(context.destination);
source.noteOn(0);

}

loadSound(url);

button.addEventListener('click', function(){
  playSound(myAudioBuffer);
}, false);