benjamin-paine commited on
Commit
f180665
1 Parent(s): f97e736

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -0
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