Description:
Stop sound and play again.
Result:
Stop sound when click the stop button. Play sound when click the play button.
Code:
            var playing = false;
            
            function onload() {
                $('#audio').jWebAudio('addSoundSource', {
                    'url': '../../examples/resource/a.ogg',
                    'preLoad': true,
                    'callback': function() {
                        $('#audio').jWebAudio('play');
                        playing = true;
                        $('#btn')[0].disabled = false;
                    }
                });
            }
            
            function play() {
                if (playing) {
                    // pause
                    $('#btn').text('Play');
                    $('#audio').jWebAudio('stop');
                } else {
                    // play
                    $('#btn').text('Stop');
                    $('#audio').jWebAudio('play');
                }
                playing = !playing;
            }