Merge pull request #58 from paulkaplan/start-audio-ios

Use StartAudioContext to allow playing on mobile safari
This commit is contained in:
Paul Kaplan 2017-07-27 09:54:51 -04:00 committed by GitHub
commit e57484c2f5
2 changed files with 3 additions and 0 deletions

View file

@ -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"
}

View file

@ -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);