Skip to content

Instantly share code, notes, and snippets.

@modeverv
Created July 20, 2018 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modeverv/701c90bf07c0d4b2f12491575a7fe6ec to your computer and use it in GitHub Desktop.
Save modeverv/701c90bf07c0d4b2f12491575a7fe6ec to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>home</h1>
<audio id="player" controls></audio>
<script>
var player = document.getElementById('player');
var handleSuccess = function (stream) {
if (window.URL) {
player.src = window.URL.createObjectURL(stream);
} else {
player.src = stream;
}
};
navigator.mediaDevices.getUserMedia({
audio: true,
video: false
}).then(handleSuccess)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment