From a9168f04aab4e88a9f1de5c48fbdb95b6e924207 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 26 Jul 2017 20:20:39 -0400 Subject: [PATCH] Use StartAudioContext to allow playing on mobile safari --- package.json | 1 + src/index.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/package.json b/package.json index acd09e2..4a2e287 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "json": "^9.0.6", "minilog": "^3.0.1", "soundfont-player": "0.10.5", + "startaudiocontext": "1.2.1", "travis-after-all": "^1.4.4", "webpack": "2.4.0" } diff --git a/src/index.js b/src/index.js index 2dc62b3..087d250 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,4 @@ +const StartAudioContext = require('startaudiocontext'); const AudioContext = require('audio-context'); const log = require('./log'); @@ -153,6 +154,7 @@ class AudioPlayer { class AudioEngine { constructor () { this.audioContext = new AudioContext(); + StartAudioContext(this.audioContext); this.input = this.audioContext.createGain(); this.input.connect(this.audioContext.destination);