added audioplayer contrib module
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
// Create an instance
|
||||
var wavesurfer;
|
||||
|
||||
// Init & load
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var playButton = document.querySelector('#playBtn'),
|
||||
toggleMuteButton = document.querySelector('#toggleMuteBtn'),
|
||||
setMuteOnButton = document.querySelector('#setMuteOnBtn'),
|
||||
setMuteOffButton = document.querySelector('#setMuteOffBtn');
|
||||
|
||||
// Init wavesurfer
|
||||
wavesurfer = WaveSurfer.create({
|
||||
container : '#waveform',
|
||||
waveColor : 'black',
|
||||
interact : false,
|
||||
cursorWidth : 0
|
||||
});
|
||||
|
||||
wavesurfer.load('../media/demo.wav');
|
||||
|
||||
wavesurfer.on('ready', function() {
|
||||
playButton.onclick = function() {
|
||||
wavesurfer.playPause();
|
||||
};
|
||||
|
||||
toggleMuteButton.onclick = function() {
|
||||
wavesurfer.toggleMute();
|
||||
}
|
||||
|
||||
setMuteOnButton.onclick = function() {
|
||||
wavesurfer.setMute(true);
|
||||
}
|
||||
|
||||
setMuteOffButton.onclick = function() {
|
||||
wavesurfer.setMute(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>wavesurfer.js | Mute Example</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" />
|
||||
|
||||
<!-- wavesurfer.js -->
|
||||
<script src="../../dist/wavesurfer.js"></script>
|
||||
|
||||
<!-- App -->
|
||||
<script src="app.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>
|
||||
<a href="http://wavesurfer-js.org">wavesurfer.j</a> (Muting)
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div id="demo">
|
||||
<div id="waveform"></div>
|
||||
|
||||
<div class="controls">
|
||||
<button id="playBtn" class="btn btn-primary">Play / Pause</button>
|
||||
<button id="toggleMuteBtn" class="btn btn-primary">Toggle Mute</button>
|
||||
<button id="setMuteOnBtn" class="btn btn-primary">
|
||||
Mute <i class="glyphicon glyphicon-volume-off"></i>
|
||||
</button>
|
||||
|
||||
<button id="setMuteOffBtn" class="btn btn-primary">
|
||||
Unmute <i class="glyphicon glyphicon-volume-up"></i>
|
||||
</button>
|
||||
</div>
|
||||
</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-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 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>
|
||||
</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