Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -132,6 +132,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 132 |
const current = {};
|
| 133 |
const active = {};
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
/** Instantiate */
|
| 136 |
const heyBuddy = new HeyBuddy(options);
|
| 137 |
|
|
|
|
| 132 |
const current = {};
|
| 133 |
const active = {};
|
| 134 |
|
| 135 |
+
/** Get user media to request permission and start the microphone */
|
| 136 |
+
try {
|
| 137 |
+
await navigator.mediaDevices.getUserMedia({ audio: true });
|
| 138 |
+
} catch (error) {
|
| 139 |
+
alert("Microphone access has been denied, this demo will not function. Please reset audio permissions and refresh the page to try again.");
|
| 140 |
+
return;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
/** Instantiate */
|
| 144 |
const heyBuddy = new HeyBuddy(options);
|
| 145 |
|