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.

This commit is contained in:
picklesrus 2018-06-06 16:49:46 -07:00
parent ca6a7f9311
commit 391f47d100

View file

@ -546,7 +546,8 @@ class Scratch3SpeechBlocks {
* @private * @private
*/ */
_initializeMicrophone () { _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({ this._audioPromise = navigator.mediaDevices.getUserMedia({
audio: { audio: {
echoCancellation: true, echoCancellation: true,