72 lines
1.6 KiB
HTML
72 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script src="js/p5.min.js"></script>
|
|
<script src="js/Tone.min.js"></script>
|
|
|
|
<title>Sketch</title>
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
canvas {
|
|
display: block;
|
|
}
|
|
|
|
.overlay-userinput {
|
|
display: grid;
|
|
justify-content: center;
|
|
align-items: center;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0, 255, 255, 0.5);
|
|
color: black;
|
|
z-index: 2;
|
|
/* display: none; */
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<button id='btn' class='overlay-userinput' onclick='requestPermissions();'>
|
|
<div>터치하고-시작하기!</div>
|
|
</button>
|
|
|
|
<!-- <audio controls>
|
|
<source src="https://radio.dianaband.in:8000/stream" type="audio/aac" />
|
|
<source src="audio/delayecho.mp3" type="audio/mpeg" />
|
|
</audio> -->
|
|
|
|
<script>
|
|
function requestPermissions() {
|
|
const audio = new Audio();
|
|
|
|
audio.crossOrigin = "anonymous";
|
|
const AudioContext = window.AudioContext || window.webkitAudioContext,
|
|
audioCtx = new AudioContext(),
|
|
audioSrc = audioCtx.createMediaElementSource(audio);
|
|
|
|
audioSrc.connect(audioCtx.destination);
|
|
|
|
audio.addEventListener('canplaythrough', () => {
|
|
audio.play();
|
|
|
|
audio.src = 'https://radio.dianaband.in:8000/stream';
|
|
audio.type = 'audio/aac'
|
|
audio.load();
|
|
};
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html> |