-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I've encountered two cross-browser inconsistencies when using standardized-audio-context that seem to defeat the purpose of the library's cross-browser standardization goal. It also happens using these native features, so I am not sure if it is a bug.
Environment
Library version: 25.3.77
Browsers tested: Chrome (latest), Firefox (latest)
- Issue: AudioContext with custom sampleRate fails in Firefox
When creating an AudioContext with a custom sample rate:
import { AudioContext } from 'standardized-audio-context';
const audioContext = new AudioContext({ sampleRate: 16000 });Expected behavior: The AudioContext should be created successfully and handle sample rate conversion internally when connecting to MediaStreams with different sample rates.
Actual behavior: Firefox throws an error because the AudioContext sample rate differs from the MediaStream sample rate. Chrome and other browsers handle this gracefully.
- Issue: channelCount on MediaStreamAudioDestinationNode ignored in Firefox
When creating a MediaStreamAudioDestinationNode and setting channelCount to 1:
const destination = audioContext.createMediaStreamDestination();
destination.channelCount = 1;
// or
destination.channelCountMode = 'explicit';
destination.channelCount = 1;Expected behavior: The output MediaStream should be mono (1 channel).
Actual behavior:
β
Chrome: Works correctly, outputs mono audio
β Firefox: Ignores the setting and continues outputting stereo audio
Questions
Is this a known limitation of the library?
Are there any recommended workarounds for achieving consistent behavior across browsers?
Should the library normalize these behaviors, or is this considered out of scope?
Thank you for maintaining this library! π