mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
29 lines
727 B
HTML
29 lines
727 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Audio WAV Player</title>
|
|
</head>
|
|
<body>
|
|
<h1>Audio WAV Player</h1>
|
|
<audio id="audioPlayer" controls>
|
|
<source src="" type="audio/wav">
|
|
</audio>
|
|
|
|
<script>
|
|
const audioPlayer = document.getElementById('audioPlayer');
|
|
const ws = new WebSocket('ws://localhost:8080');
|
|
|
|
let mediaSource = new MediaSource();
|
|
audioPlayer.src = URL.createObjectURL(mediaSource);
|
|
|
|
mediaSource.addEventListener('sourceopen', function(event) {
|
|
const sourceBuffer = mediaSource.addSourceBuffer('audio/wav');
|
|
|
|
ws.onmessage = function(event) {
|
|
sourceBuffer.appendBuffer(event.data);
|
|
};
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|