We are developing a C# console application with MIP SDK.
We wanted to send a PC Microphone and File audio to the Milestone Speaker. We can successfully send the File stream as follows.
public bool PlayAudioFromFile(string filePath)
{
bool rtnVal = false;
try
{
if (\_outgoingSpeakerController == null)
\_outgoingSpeakerController = new OutgoingSpeakerController();
else
\_outgoingSpeakerController.Close();
Stream soundFileStream = new System.IO.FileStream(filePath, System.IO.FileMode.Open);
AudioStreamPlayer audioStreamPlayer = new AudioStreamPlayer(soundFileStream, true);
\_outgoingSpeakerController.Init(audioStreamPlayer);
\_outgoingSpeakerController.Connect(this.\_speaker.FQID, 0);
\_outgoingSpeakerController.TransmitStart();
rtnVal = true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
return rtnVal;
}
But we can’t send the Client’s PC Mic audio to the Milestone Speaker. When we tried to use the sample code as shown in the VideoViewer2WayAudio, we got exceptions as
“GeneratePcAudioRecorder not available in this MIP Environment”.
The function is as follows.
public bool PlayAudioFromMic()
{
bool rtnVal = false;
try
{
if (\_outgoingSpeakerController == null)
\_outgoingSpeakerController = new OutgoingSpeakerController();
else
\_outgoingSpeakerController.Close();
var audioRecorder = ClientControl.Instance.GeneratePcAudioRecorder();
audioRecorder.OutgoingAudioWaveFormatSamplesPerSecond = 8000;
\_outgoingSpeakerController.DoRetryConnect = true;
\_outgoingSpeakerController.Init(audioRecorder);
\_outgoingSpeakerController.Connect(this.\_speaker.FQID, 0);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
return rtnVal;
}
Any idea why GeneratePcAudioRecorder is not supported in the C# Console App? What is the Alternative way to send PC audio to the Milestone speaker?
Please help.