mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
play silent audio for browsers that don't implement resume
this jumpstarts the AudioContext
This commit is contained in:
parent
8b92b7469b
commit
0f67791315
2 changed files with 11 additions and 5 deletions
|
@ -18,6 +18,12 @@ define(["Tone/core/Tone", "Tone/shim/OfflineAudioContext"], function(Tone){
|
|||
//not functionally equivalent
|
||||
if (!AudioContext.prototype.resume){
|
||||
AudioContext.prototype.resume = function(){
|
||||
//play some silent audio to jumpstart the context
|
||||
var buffer = this.createBuffer(1, 1, this.sampleRate);
|
||||
var source = this.createBufferSource();
|
||||
source.buffer = buffer;
|
||||
source.connect(this.destination);
|
||||
source.start(0);
|
||||
return Promise.resolve();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -111,13 +111,13 @@ module.exports = function(config){
|
|||
flags : ["--no-sandbox", "--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", "--autoplay-policy=no-user-gesture-required"]
|
||||
},
|
||||
HeadlessFirefox : {
|
||||
base : "Firefox",
|
||||
base : "Firefox",
|
||||
flags : ["-headless"],
|
||||
prefs : {
|
||||
"media.navigator.permission.disabled" : true,
|
||||
prefs : {
|
||||
"media.navigator.permission.disabled" : true,
|
||||
"focusmanager.testmode" : true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue