added audioplayer contrib module

This commit is contained in:
Bachir Soussi Chiadmi
2017-11-25 16:05:32 +01:00
parent ff23c45e43
commit 0942e9a212
174 changed files with 21682 additions and 0 deletions
@@ -0,0 +1,52 @@
'use strict';
var wavesurfer;
// Init & load
document.addEventListener('DOMContentLoaded', function () {
// Create an instance
wavesurfer = WaveSurfer.create({
container : '#waveform',
waveColor : 'violet',
progressColor : 'purple',
loaderColor : 'purple',
cursorColor : 'navy',
plugins: [
WaveSurfer.spectrogram.create({
container: '#wave-spectrogram'
})
]
});
if (location.search.match('scroll')) {
options.minPxPerSec = 100;
options.scrollParent = true;
}
if (location.search.match('normalize')) {
options.normalize = true;
}
/* Progress bar */
(function () {
var progressDiv = document.querySelector('#progress-bar');
var progressBar = progressDiv.querySelector('.progress-bar');
var showProgress = function (percent) {
progressDiv.style.display = 'block';
progressBar.style.width = percent + '%';
};
var hideProgress = function () {
progressDiv.style.display = 'none';
};
wavesurfer.on('loading', showProgress);
wavesurfer.on('ready', hideProgress);
wavesurfer.on('destroy', hideProgress);
wavesurfer.on('error', hideProgress);
}());
wavesurfer.load('../media/demo.wav');
});