BadDeviceId calling waveInOpen , I am using Naudio on .net core 6 and getting error after deploy web app for recording on azure

huangapple go评论81阅读模式
英文:

BadDeviceId calling waveInOpen , I am using Naudio on .net core 6 and getting error after deploy web app for recording on azure

问题

  1. 当我在浏览器上打开部署在Azure服务器上的Web应用程序时,对于录音和麦克风访问会发生什么情况?它会打开我的系统上的麦克风,还是在服务器上使用某些音频设备?

  2. 当我在浏览器上打开部署在Azure服务器上的应用程序时,我需要做什么来确保我的应用程序可以录音?

英文:

I created application which is recording audio calls using NAudio .net package c#. It is working fine and it is opening mic for recording on loclhost. But when i deployed my web app on azure server then it is giving error **BadDeviceId calling waveInOpen ** and not recording audios in files, also not opening mic on my system.

WaveInEvent waveIn = new WaveInEvent();
                // Set the desired format for the captured microphone sound
                waveIn.WaveFormat = new WaveFormat(16000, 16, 1);
                
               ;
                //}
                chunkFileName = Path.Combine(path + nameOfFolderUsingDate , "mic" + fileNameCounter + ".wav");               

                micWriteChunk = new WaveFileWriter(chunkFileName, waveIn.WaveFormat);
                //micWriter = new WaveFileWriter(Path.Combine(AppDomain.CurrentDomain.BaseDirectory+ "/Recordings/"+ userName + "/" + nameOfFolderUsingDate, "mic_complete_file.wav"), waveIn.WaveFormat);
                micWriter = new WaveFileWriter(Path.Combine(path + nameOfFolderUsingDate, "mic_complete_file.wav"), waveIn.WaveFormat);

                // AudioChunkRecorder recorder = new AudioChunkRecorder(sampleRate, channels, bitDepth, chunkDurationMs, outputFolder, outputPrefix);

                // Register event handlers for DataAvailable events of both capture instances                
                waveIn.DataAvailable += WaveIn_DataAvailable;


                // Set up the timer to save audio chunks every 3 seconds               
                waveIn.StartRecording();

<p>
1.I want to ask what happens for recording and for mic access when i open my web application on browser which is deployed on azure server, will it open mic on my system or is it using some audio devices on server.
</p>
<p>
2.Also what should i need to do for my app records when i open it on browser, which is deployed on azure server.
</p>

答案1

得分: 0

尝试想象一下我们的C#代码,使用NAudio .net包,并最终编译成.dll文件并部署到服务器上。Web应用程序通过浏览器打开并希望调用麦克风,但实际上调用的是服务器上的麦克风,对吗?这就是我们遇到这个问题的原因。

NAudio .net包是用于桌面应用程序,如WPF。

在Web应用程序中,我们应该使用Web音频API这是Web音频API示例。

英文:

Try to imagine our C# code, using the NAudio .net package, and finally compiles the .dll file and deploys it in the server. The web application is opened through a browser and wants to call mic, and the code is executed, but the server mic is called, right? That's why we're having this issue.

The NAudio .net package is for desktop applications such as WPF.

In webapplication, we should use Web Audio API. Here is Web Audio API SAMPLE.

huangapple
  • 本文由 发表于 2023年7月17日 22:43:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76705593.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定