try a list of sample rates; prefer 48kHz
This commit is contained in:
parent
57efdff43e
commit
2334ad1d5b
@ -14,9 +14,17 @@ function AudioEngine(maxBufferLength, audioReporter) {
|
|||||||
this.onStartCallbacks = [];
|
this.onStartCallbacks = [];
|
||||||
|
|
||||||
this.started = false;
|
this.started = false;
|
||||||
try {
|
// try common working sample rates
|
||||||
this.audioContext = new ctx({sampleRate: 44100});
|
if (![48000, 44100].some(function(sr) {
|
||||||
} catch (error) {
|
try {
|
||||||
|
this.audioContext = new ctx({sampleRate: sr});
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, this)) {
|
||||||
|
// fallback: let the browser decide
|
||||||
|
// this may cause playback problems down the line
|
||||||
this.audioContext = new ctx();
|
this.audioContext = new ctx();
|
||||||
}
|
}
|
||||||
var me = this;
|
var me = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user