Merge pull request #4267 from dmitrylyzo/fix-audiocontext-limit

Fix AudioContext limit exceeded
This commit is contained in:
Bill Thornton 2023-01-10 10:00:55 -05:00 committed by GitHub
commit ea79d2651a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -294,16 +294,24 @@ import browser from './browser';
(browser.tizen && isTizenFhd ? 20000000 : null)));
}
let maxChannelCount = null;
function getSpeakerCount() {
if (maxChannelCount != null) {
return maxChannelCount;
}
maxChannelCount = -1;
const AudioContext = window.AudioContext || window.webkitAudioContext || false; /* eslint-disable-line compat/compat */
if (AudioContext) {
const audioCtx = new AudioContext();
return audioCtx.destination.maxChannelCount;
maxChannelCount = audioCtx.destination.maxChannelCount;
}
return -1;
return maxChannelCount;
}
function getPhysicalAudioChannels(options, videoTestElement) {