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,113 @@
'use strict';
var wavesurfer;
// Init & load
document.addEventListener('DOMContentLoaded', function () {
var pluginOptions = {
minimap: {
waveColor : '#777',
progressColor : '#222',
height: 30
},
timeline: {
container: '#wave-timeline'
},
spectrogram: {
container: '#wave-spectrogram'
},
regions: {
regions: [
{
start: 1,
end: 3,
color: 'hsla(400, 100%, 30%, 0.5)'
},
{
start: 4,
end: 5.4
},
{
start: 6.22,
end: 7.1
}
]
},
elan: {
url: '../elan/transcripts/001z.xml',
container: '#annotations',
tiers: {
Text: true,
Comments: true
}
}
};
var options = {
container : '#waveform',
waveColor : 'violet',
progressColor : 'purple',
loaderColor : 'purple',
cursorColor : 'navy',
plugins: [
WaveSurfer.minimap.create(pluginOptions.minimap)
]
};
if (location.search.match('scroll')) {
options.minPxPerSec = 100;
options.scrollParent = true;
}
if (location.search.match('normalize')) {
options.normalize = true;
}
// Init wavesurfer
wavesurfer = WaveSurfer.create(options);
[].forEach.call(document.querySelectorAll('[data-activate-plugin]'), function (el) {
var activePlugins = wavesurfer.initialisedPluginList;
Object.keys(activePlugins).forEach(function(name) {
if (el.dataset.activatePlugin === name) {
el.checked = true;
}
});
});
[].forEach.call(document.querySelectorAll('[data-activate-plugin]'), function (el) {
el.addEventListener('change', function (e) {
var pluginName = e.currentTarget.dataset.activatePlugin;
var activate = e.target.checked;
var options = pluginOptions[pluginName] || {};
var plugin = WaveSurfer[pluginName].create(options);
if (activate) {
wavesurfer.addPlugin(plugin).initPlugin(pluginName);
} else {
wavesurfer.destroyPlugin(pluginName);
}
});
});
/* 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');
});
@@ -0,0 +1,188 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>wavesurfer.js | Timeline plugin</title>
<link href="data:image/gif;" rel="icon" type="image/x-icon" />
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
<link rel="screenshot" itemprop="screenshot" href="//katspaugh.github.io/wavesurfer.js/example/screenshot.png" />
<!-- wavesurfer.js -->
<script src="../../dist/wavesurfer.js"></script>
<!-- timeline format renderer -->
<script src="../../dist/plugin/wavesurfer.timeline.js"></script>
<script src="../../dist/plugin/wavesurfer.minimap.js"></script>
<script src="../../dist/plugin/wavesurfer.cursor.js"></script>
<script src="../../dist/plugin/wavesurfer.elan.js"></script>
<script src="../../dist/plugin/wavesurfer.microphone.js"></script>
<script src="../../dist/plugin/wavesurfer.regions.js"></script>
<script src="../../dist/plugin/wavesurfer.spectrogram.js"></script>
<!-- App -->
<script src="app.js"></script>
<script src="../trivia.js"></script>
<!-- Styling information for the elan plugin -->
<style type="text/css">
#annotations {
max-height: 300px;
overflow: auto;
}
.wavesurfer-annotations tr.wavesurfer-active td {
background-color: yellow;
}
.wavesurfer-time {
width: 100px;
color: #555;
}
.wavesurfer-tier-Text {
width: 500px;
}
td.wavesurfer-tier-Comments {
color: #999;
}
.wavesurfer-handle {
background-color: #c9e2b3;
}
</style>
</head>
<body itemscope itemtype="http://schema.org/WebApplication">
<div class="container">
<div class="header">
<noindex>
<ul class="nav nav-pills pull-right">
<li><a href="?fill">Fill</a></li>
<li><a href="?scroll">Scroll</a></li>
</ul>
</noindex>
<h1 itemprop="name"><a href="http://wavesurfer-js.org">wavesurfer.js</a><noindex> Plugin system</noindex></h1>
</div>
<div id="demo">
<div id="waveform">
<div class="progress progress-striped active" id="progress-bar">
<div class="progress-bar progress-bar-info"></div>
</div>
<!-- Here be waveform -->
</div>
<div id="wave-timeline"></div>
<div id="wave-spectrogram"></div>
<div id="annotations"></div>
<div class="controls">
</div>
</div>
<div class="row">
<div class="col-lg-4">
<div class="form-group marketing">
<h4>Disable and enable plugins on the fly:</h4>
<hr />
<div class="checkbox">
<label><input type="checkbox" value="" data-activate-plugin="minimap">Minimap</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" data-activate-plugin="timeline">Timeline</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" data-activate-plugin="cursor">Cursor</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" data-activate-plugin="spectrogram">Spectrogram</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" data-activate-plugin="regions">Regions</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" data-activate-plugin="elan">Elan</label>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="marketing">
<h4>Initialising wavesurfer with plugins</h4>
<hr />
<p>The <code>plugins</code> option is an array of plugin definitions. Calling a plugin with the parameter <code>deferInit: true</code> will stop it from automatically initialising you can do that at a later time with <code>wavesurfer.initPlugin('mypluginname')</code>.</p>
<noindex><p>
<pre><code>var wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: 'violet',
// ... other wavesurfer options
plugins: [
WaveSurfer.timeline.create{
container: '#wave-timeline',
// ... other timeline options
})
]
});
wavesurfer.load('example/media/demo.mp3');</code></pre>
</p></noindex>
</div>
<div class="marketing">
<h4>Dynamically adding and initialising a plugin</h4>
<hr />
<noindex><p>
<pre><code>var wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: 'violet',
// ... other wavesurfer options
});
// adding and initialising a plugin after initialisation
wavesurfer.addPlugin(WaveSurfer.timeline.create{
container: '#wave-timeline',
// ... other timeline options
})).initPlugin('timeline')
wavesurfer.load('example/media/demo.mp3');</code></pre>
</p></noindex>
</div>
</div>
</div>
<div class="footer row">
<div class="col-sm-12">
<a rel="license" href="https://creativecommons.org/licenses/by/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/80x15.png" /></a>
</div>
<div class="col-sm-12">
<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">wavesurfer.js</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/katspaugh/wavesurfer.js" property="cc:attributionName" rel="cc:attributionURL">katspaugh</a> is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/3.0/deed.en_US">Creative Commons Attribution 3.0 Unported License</a>.
</div>
</div>
</div>
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a itemprop="isBasedOnUrl" href="https://github.com/katspaugh/wavesurfer.js">Fork me on GitHub</a>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50026819-1', 'wavesurfer.fm');
ga('send', 'pageview');
</script>
</body>
</html>