mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 03:53:07 +00:00
49 lines
1.2 KiB
HTML
49 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Player</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">
|
|
|
|
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
|
|
<script src="../build/Tone.js"></script>
|
|
<script src="./js/tonejs-ui.js"></script>
|
|
<style type="text/css">
|
|
tone-play-toggle {
|
|
margin-bottom: 10px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<tone-example>
|
|
<tone-loader></tone-loader>
|
|
|
|
<tone-explanation label="Player">
|
|
Click on the button to play the audio file on loop
|
|
using <a href="https://tonejs.github.io/docs/Player">Tone.Player</a>.
|
|
</tone-explanation>
|
|
|
|
<tone-content>
|
|
<tone-play-toggle></tone-play-toggle>
|
|
<tone-player></tone-player>
|
|
</tone-content>
|
|
</tone-example>
|
|
|
|
<script type="text/javascript">
|
|
//the player
|
|
var player = new Tone.Player({
|
|
"url" : "./audio/FWDL.[mp3|ogg]",
|
|
"loop" : true,
|
|
"loopStart" : 0.5,
|
|
"loopEnd" : 0.7,
|
|
}).toMaster();
|
|
|
|
//bind the interface
|
|
document.querySelector("tone-player").bind(player);
|
|
document.querySelector("tone-play-toggle").bind(player);
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|