chiro-canto/public/scripts/wavesurfer/example/annotation/index.html

254 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>wavesurfer.js | Annotation tool</title>
<link href="data:image/gif;" rel="icon" type="image/x-icon" />
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
<link rel="stylesheet" href="app.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 Annotations Tool</h1>
</div>
<div id="demo">
<p id="subtitle" class="text-center text-info">&nbsp;</p>
<div id="wave-timeline"></div>
<div id="waveform">
<!-- Here be waveform -->
</div>
<div class="row" style="margin: 30px 0">
<div class="col-sm-10">
<p>
Click on a region to enter an annotation.<br />
Shift-click plays a region in a loop.
</p>
</div>
<div class="col-sm-2">
<button class="btn btn-primary btn-block" data-action="play">
<span id="play">
<i class="glyphicon glyphicon-play"></i>
Play
</span>
<span id="pause" style="display: none">
<i class="glyphicon glyphicon-pause"></i>
Pause
</span>
</button>
</div>
</div>
</div>
<form role="form" name="edit" style="opacity: 0; transition: opacity 300ms linear; margin: 30px 0;">
<div class="form-group">
<label for="start">Start</label>
<input class="form-control" id="start" name="start" />
</div>
<div class="form-group">
<label for="end">End</label>
<input class="form-control" id="end" name="end" />
</div>
<div class="form-group">
<label for="note">Note</label>
<textarea id="note" class="form-control" rows="3" name="note"></textarea>
</div>
<button type="submit" class="btn btn-success btn-block">Save</button>
<center><i>or</i></center>
<button type="button" class="btn btn-danger btn-block" data-action="delete-region">Delete</button>
</form>
<div class="row">
<h4>Region events:</h4>
<ul>
<li><code>region-in</code> When playback enters a region. Callback will receive the <code>Region</code> object.</li>
<li><code>region-out</code> When playback leaves a region. Callback will receive the <code>Region</code> object.</li>
<li><code>region-mouseenter</code> - When the mouse moves over a region. Callback will receive the <code>Region</code> object, and a <code>MouseEvent</code> object.</li>
<li><code>region-mouseleave</code> - When the mouse leaves a region. Callback will receive the <code>Region</code> object, and a <code>MouseEvent</code> object.</li>
<li><code>region-click</code> - When the mouse clicks on a region. Callback will receive the <code>Region</code> object, and a <code>MouseEvent</code> object.</li>
<li><code>region-dblclick</code> - When the mouse double-clicks on a region. Callback will receive the <code>Region</code> object, and a <code>MouseEvent</code> object.</li>
<li><code>region-created</code> When a region is created. Callback will receive the <code>Region</code> object.</li>
<li><code>region-updated</code> When a region is updated. Callback will receive the <code>Region</code> object.</li>
<li><code>region-update-end</code> When dragging or resizing is finished. Callback will receive the <code>Region</code> object.</li>
<li><code>region-removed</code> When a region is removed. Callback will receive the <code>Region</code> object.</li>
</ul>
<h4>Regions Plugin</h4>
<p>Regions are visual overlays on waveform that can be used to play and
loop portions of audio. Regions can be dragged and resized.</p>
<p>Visual customization is possible via CSS (using the selectors
<code>.wavesurfer-region</code> and <code>.wavesurfer-handle</code>).</p>
<p>To enable the plugin, add the script <code>plugin/wavesurfer.regions.js</code> to
your page.</p>
<p>After doing that, use <code>wavesurfer.addRegion()</code> to create Region objects.</p>
<h5>Exposed Methods</h5>
<ul>
<li><code>addRegion(options)</code> Creates a region on the waveform. Returns a <code>Region</code> object. See <a href="#region-options">Region Options</a>, <a href="#region-methods">Region Methods</a> and <a href="#region-events">Region Events</a> below.
<ul>
<li><strong>Note:</strong> You cannot add regions until the audio has finished loading, otherwise the <code>start:</code> and <code>end:</code> properties of the new region will be set to <code>0</code>, or an unexpected value.</li>
</ul></li>
<li><code>clearRegions()</code> Removes all regions.</li>
<li><code>enableDragSelection(options)</code> Lets you create regions by selecting.
areas of the waveform with mouse. <code>options</code> are Region objects' params (see <a href="#region-options">below</a>).</li>
<li><code>disableDragSelection()</code> - Disables ability to create regions.</li>
</ul>
<h5>Region Options</h5>
<table><thead>
<tr>
<th>option</th>
<th>type</th>
<th>default</th>
<th>description</th>
</tr>
</thead><tbody>
<tr>
<td><code>id</code></td>
<td>string</td>
<td>random</td>
<td>The id of the region.</td>
</tr>
<tr>
<td><code>start</code></td>
<td>float</td>
<td><code>0</code></td>
<td>The start position of the region (in seconds).</td>
</tr>
<tr>
<td><code>end</code></td>
<td>float</td>
<td><code>0</code></td>
<td>The end position of the region (in seconds).</td>
</tr>
<tr>
<td><code>loop</code></td>
<td>boolean</td>
<td><code>false</code></td>
<td>Whether to loop the region when played back.</td>
</tr>
<tr>
<td><code>drag</code></td>
<td>boolean</td>
<td><code>true</code></td>
<td>Allow/dissallow dragging the region.</td>
</tr>
<tr>
<td><code>resize</code></td>
<td>boolean</td>
<td><code>true</code></td>
<td>Allow/dissallow resizing the region.</td>
</tr>
<tr>
<td><code>color</code></td>
<td>string</td>
<td><code>"rgba(0, 0, 0, 0.1)"</code></td>
<td>HTML color code.</td>
</tr>
</tbody></table>
<h5>Region Methods</h5>
<ul>
<li><code>remove()</code> - Remove the region object.</li>
<li><code>update(options)</code> - Modify the settings of the region.</li>
<li><code>play()</code> - Play the audio region from the start to end position.</li>
</ul>
<h5>Region Events</h5>
<p>General events:</p>
<ul>
<li><code>in</code> - When playback enters the region.</li>
<li><code>out</code> - When playback leaves the region.</li>
<li><code>remove</code> - Happens just before the region is removed.</li>
<li><code>update</code> - When the region's options are updated.</li>
</ul>
<p>Mouse events:</p>
<ul>
<li><code>click</code> - When the mouse clicks on the region. Callback will receive a <code>MouseEvent</code>.</li>
<li><code>dblclick</code> - When the mouse double-clicks on the region. Callback will receive a <code>MouseEvent</code>.</li>
<li><code>over</code> - When mouse moves over the region. Callback will receive a <code>MouseEvent</code>.</li>
<li><code>leave</code> - When mouse leaves the region. Callback will receive a <code>MouseEvent</code>.</li>
</ul>
</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>