File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change
1
+ export type AudioStreamOptions = {
2
+ echoCancellation ?: boolean ;
3
+ noiseSuppression ?: boolean ;
4
+ autoGainControl ?: boolean ;
5
+ } ;
6
+
1
7
/**
2
8
* Requests an audio stream from the user's device using the `getUserMedia` API.
3
9
* The stream will have echo cancellation, noise suppression, and auto gain control enabled.
4
10
*
5
11
* @returns {Promise<MediaStream> } A promise that resolves to a `MediaStream` containing audio data only.
6
12
* @throws {DOMException } If the user denies access or no audio input devices are found.
7
13
*/
8
- export const getAudioStream = async (
9
- echoCancellation : boolean = true ,
10
- noiseSuppression : boolean = true ,
11
- autoGainControl : boolean = true ,
12
- ) : Promise < MediaStream > => {
14
+ export const getAudioStream = async ( audioStreamOptions : AudioStreamOptions = { } ) : Promise < MediaStream > => {
15
+ const { echoCancellation = true , noiseSuppression = true , autoGainControl = true } = audioStreamOptions ;
13
16
return navigator . mediaDevices . getUserMedia ( {
14
17
audio : {
15
18
echoCancellation,
You can’t perform that action at this time.
0 commit comments