mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-04-05 06:26:50 +00:00
try a list of sample rates; prefer 48kHz
This commit is contained in:
parent
57efdff43e
commit
2334ad1d5b
1 changed files with 11 additions and 3 deletions
|
|
@ -14,9 +14,17 @@ function AudioEngine(maxBufferLength, audioReporter) {
|
|||
this.onStartCallbacks = [];
|
||||
|
||||
this.started = false;
|
||||
try {
|
||||
this.audioContext = new ctx({sampleRate: 44100});
|
||||
} catch (error) {
|
||||
// try common working sample rates
|
||||
if (![48000, 44100].some(function(sr) {
|
||||
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();
|
||||
}
|
||||
var me = this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue