i have a console app testing NAudio library, the code below works fine on my local machine and on the testing server but throws an error on the production server
the audio file is a .m4a file
class Program
{
static void Main(string[] args)
{
string audioPath = ConfigurationManager.AppSettings["AudioFile"];
Console.WriteLine(new AudioFileReader(audioPath).TotalTime.TotalMilliseconds);
Console.ReadLine();
}
}
Error Message
System.Runtime.InteropServices.COMException: No suitable tr
ansform was found to encode or decode the content. (Exception from HRESULT: 0xC0
0D5212)
at NAudio.MediaFoundation.IMFSourceReader.SetCurrentMediaType(Int32 dwStreamI
ndex, IntPtr pdwReserved, IMFMediaType pMediaType)
at NAudio.Wave.MediaFoundationReader.CreateReader(MediaFoundationReaderSettin
gs settings)
at NAudio.Wave.MediaFoundationReader.Init(MediaFoundationReaderSettings initi
alSettings)
at NAudio.Wave.MediaFoundationReader..ctor(String file)
at NAudio.Wave.AudioFileReader.CreateReaderStream(String fileName)
at NAudio.Wave.AudioFileReader..ctor(String fileName)
at NAudioTest.Program.Main(String[] args) in C:\Users\staff\source\repos\NAud
ioTest\NAudioTest\Program.cs:line 15
any suggestions on what could be causing this error ?
The server you are running on is missing the Media Foundation Codecs that are needed to perform the. You'll have to install the feature (from memory, I think it's the "Desktop Experience")