mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2025-01-18 05:30:06 -05:00
Use StartAudioContext to allow playing on mobile safari
This commit is contained in:
parent
20d05ee5c9
commit
a9168f04aa
2 changed files with 3 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
||||||
"json": "^9.0.6",
|
"json": "^9.0.6",
|
||||||
"minilog": "^3.0.1",
|
"minilog": "^3.0.1",
|
||||||
"soundfont-player": "0.10.5",
|
"soundfont-player": "0.10.5",
|
||||||
|
"startaudiocontext": "1.2.1",
|
||||||
"travis-after-all": "^1.4.4",
|
"travis-after-all": "^1.4.4",
|
||||||
"webpack": "2.4.0"
|
"webpack": "2.4.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
const StartAudioContext = require('startaudiocontext');
|
||||||
const AudioContext = require('audio-context');
|
const AudioContext = require('audio-context');
|
||||||
|
|
||||||
const log = require('./log');
|
const log = require('./log');
|
||||||
|
@ -153,6 +154,7 @@ class AudioPlayer {
|
||||||
class AudioEngine {
|
class AudioEngine {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.audioContext = new AudioContext();
|
this.audioContext = new AudioContext();
|
||||||
|
StartAudioContext(this.audioContext);
|
||||||
|
|
||||||
this.input = this.audioContext.createGain();
|
this.input = this.audioContext.createGain();
|
||||||
this.input.connect(this.audioContext.destination);
|
this.input.connect(this.audioContext.destination);
|
||||||
|
|
Loading…
Reference in a new issue