Skip to content

Commit

Permalink
Merge branch 'rm/312460' into 'master'
Browse files Browse the repository at this point in the history
do not specify sample rate to audio context if firefox on linux

See merge request kchat/webapp!957
  • Loading branch information
antonbuks committed Oct 24, 2024
2 parents b6a040c + 738c5a4 commit 5f6d413
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {createEncoder} from 'wasm-media-encoders';
import {AudioFileExtensions} from 'utils/constants';
import {generateDateSpecificFileName} from 'utils/file_utils';
import {getWasmFileURL} from 'utils/url_import';
import {isFirefox, isLinux} from 'utils/user_agent';

declare global {
interface Window {
Expand Down Expand Up @@ -145,7 +146,13 @@ export function useAudioRecorder(props: Props) {
audio: true,
});

const audioContext = new (window.AudioContext || window.webkitAudioContext)({sampleRate: 48000});
const audioContextConfig: AudioContextOptions = {};

if (!(isFirefox() && isLinux())) {
audioContextConfig.sampleRate = 48000;
}

const audioContext = new (window.AudioContext || window.webkitAudioContext)(audioContextConfig);

const audioAnalyzer = audioContext.createAnalyser();
audioAnalyzer.fftSize = props.audioAnalyzerFFTSize;
Expand Down

0 comments on commit 5f6d413

Please sign in to comment.