Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>USB Audio</title>
- </head>
- <body>
- <div id="container">
- <audio id="audioElement" controls autoplay muted>
- </audio>
- </div>
- <button type="button" onclick="get_device()">Activate</button>
- <script>
- function get_device()
- {
- if (navigator.mediaDevices.getUserMedia)
- {
- navigator.mediaDevices.getUserMedia({video: false, audio: true})
- .then(function (stream) {
- document.querySelector("#audioElement").srcObject = stream;
- });
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement