added audioplayer contrib module
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
// Create an instance
|
||||
var wavesurfer;
|
||||
|
||||
// Init & load audio file
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Init
|
||||
wavesurfer = WaveSurfer.create({
|
||||
container: document.querySelector('#waveform'),
|
||||
waveColor: '#A8DBA8',
|
||||
progressColor: '#3B8686',
|
||||
backend: 'MediaElement',
|
||||
plugins: [
|
||||
WaveSurfer.regions.create({
|
||||
regions: [
|
||||
{
|
||||
start: 1,
|
||||
end: 3,
|
||||
color: 'hsla(400, 100%, 30%, 0.5)'
|
||||
}, {
|
||||
start: 5,
|
||||
end: 7,
|
||||
color: 'hsla(200, 50%, 70%, 0.4)'
|
||||
}
|
||||
],
|
||||
dragSelection: {
|
||||
slop: 5
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
// Load audio from URL
|
||||
wavesurfer.load('../media/demo.wav');
|
||||
|
||||
// this is already being done in /examples/trivia.js
|
||||
// document.querySelector(
|
||||
// '[data-action="play"]'
|
||||
// ).addEventListener('click', wavesurfer.playPause.bind(wavesurfer));
|
||||
|
||||
});
|
||||
@@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>wavesurfer.js | Regions</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="https://katspaugh.github.io/wavesurfer.js/example/screenshot.png" />
|
||||
|
||||
<!-- wavesurfer.js -->
|
||||
<script src="../../dist/wavesurfer.js"></script>
|
||||
|
||||
<!-- plugins -->
|
||||
<script src="../../dist/plugin/wavesurfer.timeline.js"></script>
|
||||
<script src="../../dist/plugin/wavesurfer.regions.js"></script>
|
||||
<script src="../../dist/plugin/wavesurfer.minimap.js"></script>
|
||||
|
||||
<!-- App -->
|
||||
<script src="../trivia.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="http://schema.org/WebApplication">
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<ul class="nav nav-pills pull-right">
|
||||
<li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
|
||||
</ul>
|
||||
|
||||
<h1 itemprop="name">wavesurfer.js Regions</h1>
|
||||
</div>
|
||||
|
||||
<div id="demo">
|
||||
<div id="waveform">
|
||||
<!-- Here be waveform -->
|
||||
</div>
|
||||
|
||||
<div class="controls">
|
||||
<button class="btn btn-primary" data-action="play">
|
||||
<i class="glyphicon glyphicon-play"></i>
|
||||
Play
|
||||
/
|
||||
<i class="glyphicon glyphicon-pause"></i>
|
||||
Pause
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row marketing">
|
||||
<p>
|
||||
<pre><code>var wavesurfer = WaveSurfer.create({
|
||||
container: document.querySelector('#waveform'),
|
||||
waveColor: '#A8DBA8',
|
||||
progressColor: '#3B8686',
|
||||
backend: 'MediaElement',
|
||||
plugins: [
|
||||
WaveSurfer.regions.create{
|
||||
regions: [
|
||||
{
|
||||
start: 1,
|
||||
end: 3,
|
||||
color: 'hsla(400, 100%, 30%, 0.5)'
|
||||
}, {
|
||||
start: 5,
|
||||
end: 7,
|
||||
color: 'hsla(200, 50%, 70%, 0.4)'
|
||||
}
|
||||
],
|
||||
dragSelection: {
|
||||
slop: 5
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
</code></pre>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="footer row">
|
||||
<div class="col-sm-12">
|
||||
<a rel="license" href="https://opensource.org/licenses/BSD-3-Clause"><img alt="BSD-3-Clause License" style="border-width:0" src="https://img.shields.io/badge/License-BSD%203--Clause-blue.svg" /></a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<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 href="https://github.com/katspaugh/wavesurfer.js">katspaugh</a> is licensed under a <a rel="license" href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause License</a>.
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<p>
|
||||
The sound file is from <a href="https://librivox.org/librivox-multilingual-short-works-collection-001-by-various/">librivox.org</a>.
|
||||
</p>
|
||||
</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>
|
||||
Reference in New Issue
Block a user