Tone.js/examples/player.html

50 lines
1.2 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2014-03-15 03:17:18 +00:00
<html>
<head>
<meta charset="utf-8">
2019-01-09 01:21:29 +00:00
<title>Player</title>
2014-09-06 19:35:31 +00:00
2019-01-09 01:21:29 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">
2019-01-09 01:21:29 +00:00
<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>
2014-03-15 03:17:18 +00:00
</head>
<body>
2019-01-09 01:21:29 +00:00
<tone-example>
<tone-loader></tone-loader>
2015-06-26 05:23:05 +00:00
2019-01-09 01:21:29 +00:00
<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">
2015-02-12 03:39:28 +00:00
//the player
2015-06-26 05:23:05 +00:00
var player = new Tone.Player({
"url" : "./audio/FWDL.[mp3|ogg]",
2019-01-09 01:21:29 +00:00
"loop" : true,
"loopStart" : 0.5,
"loopEnd" : 0.7,
2015-06-26 05:23:05 +00:00
}).toMaster();
2015-06-27 22:02:55 +00:00
2019-01-09 01:21:29 +00:00
//bind the interface
document.querySelector("tone-player").bind(player);
document.querySelector("tone-play-toggle").bind(player);
2014-03-15 03:17:18 +00:00
</script>
2017-03-26 20:39:19 +00:00
2014-03-15 03:17:18 +00:00
</body>
</html>