From 391f47d1000a9f34f8b37d04cb179cee1fb1ec0c Mon Sep 17 00:00:00 2001
From: picklesrus <picklesrus@users.noreply.github.com>
Date: Wed, 6 Jun 2018 16:49:46 -0700
Subject: [PATCH] Add webkitAudioContext if AudioContext does not exist. This
 might fix the speech extension in safari, but it is tricky to tell since I am
 running into problems with permissions and localhost.

---
 src/extensions/scratch3_speech/index.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/extensions/scratch3_speech/index.js b/src/extensions/scratch3_speech/index.js
index 9ffc24fa5..7e2ff7126 100644
--- a/src/extensions/scratch3_speech/index.js
+++ b/src/extensions/scratch3_speech/index.js
@@ -546,7 +546,8 @@ class Scratch3SpeechBlocks {
      * @private
      */
     _initializeMicrophone () {
-        this._context = new AudioContext();
+        // Safari still needs a webkit prefix for audio context
+        this._context = new (window.AudioContext || window.webkitAudioContext)();
         this._audioPromise = navigator.mediaDevices.getUserMedia({
             audio: {
                 echoCancellation: true,