changed controls

This commit is contained in:
Luke Berndt
2021-02-22 21:50:40 -05:00
parent 314a4fb880
commit c59f5241a1
2 changed files with 30 additions and 39 deletions

View File

@@ -9,6 +9,8 @@
name="%REACT_APP_SITE_NAME%"
content="Listen to live Police and Fire radio broadcasts. Archived for 30 days and searchable."
/>
<!-- Below is an ugly hack! I needed a way to add a tag to insert Twitter Meta if needed-->
<!-- I SED the tag below out and replace it with an EJS tag to insert a block of meta -->
<meta name="temp" conent="replace"/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/apple-touch-icon.png" />
<!--

View File

@@ -4,38 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>OpenMHz</title>
<script src="https://unpkg.com/wavesurfer.js"></script>
<script>
// Create an instance
let wavesurfer;
var call_url="<%- url%>";
// Init & load audio file
document.addEventListener("DOMContentLoaded", function () {
// Init
wavesurfer = WaveSurfer.create({
container: document.querySelector("#waveform"),
waveColor: "#A8DBA8",
progressColor: "#3B8686",
backend: "MediaElement",
mediaControls: true,
});
wavesurfer.once("ready", function () {
console.log("Using wavesurfer.js " + WaveSurfer.VERSION);
});
wavesurfer.on("error", function (e) {
console.warn(e);
});
// Load audio from URL
wavesurfer.load(call_url);
// toggle play button
document
.querySelector('[data-action="play"]')
.addEventListener("click", wavesurfer.playPause.bind(wavesurfer));
});
</script>
</head>
<body>
@@ -43,15 +12,35 @@
<div id="waveform">
<!-- Here be the waveform -->
</div>
<script>
// Create an instance
let wavesurfer;
var call_url="<%- url%>";
// Init & load audio file
document.addEventListener("DOMContentLoaded", function () {
// Init
wavesurfer = WaveSurfer.create({
container: document.querySelector("#waveform"),
waveColor: "#A8DBA8",
progressColor: "#3B8686",
backend: "MediaElement",
mediaControls: true,
});
wavesurfer.once("ready", function () {
console.log("Using wavesurfer.js " + WaveSurfer.VERSION);
});
wavesurfer.on("error", function (e) {
console.warn(e);
});
// Load audio from URL
wavesurfer.load(call_url);
});
</script>
<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>
</body>
</html>