hi all
how to Playing embedded resource mp3 file
using C#
i want to play mp3 file from embedded resource
with best regards
NazHim
hi all
how to Playing embedded resource mp3 file
using C#
i want to play mp3 file from embedded resource
with best regards
NazHim
hello
TimonYang-MSFT
thanks


uninstall NAudio?
with best Regards
NazHim
No, I mean uninstall VisioForge.Shared.NAudio.
According to the error message, the reason for the error should be that there is a class called WaveOut in both packages. They both have an Init method but require different parameters.
When we do not use the full path of the class, it uses the VisioForge.Shared.NAudio by default, but what we need is the one in NAudio.
It should be useful to use the full path: NAudio.Wave.WaveOut waveOut = new NAudio.Wave.WaveOut();
But it is better to uninstall the redundant nuget package, in case the same problem occurs unintentionally in the future and causes additional trouble.
What problem are you encountering now? Are you not sure how to read this file or are you encountering an exception?
I added MP3 to Resources, and then used the following code to play it, hoping to give you some ideas.
private void button1_Click(object sender, EventArgs e)
{
byte[] fileByte = Properties.Resources.au1_mp3;
Stream stream = new MemoryStream(fileByte);
var reader = new NAudio.Wave.Mp3FileReader(stream);
var waveOut = new WaveOut();
waveOut.Init(reader);
waveOut.Play();
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
hello
TimonYang-MSFT
thanks for your fast response
getting error pic at below
using System.IO;
using VisioForge.Shared.NAudio.Wave;

how i can do it?
with best regards
NazHim
I think it might be because we installed different nuget packages, this is the one I installed:

hello
TimonYang-MSFT
NAudio installed but
getting another error pic at below

with regards
NazHim
Try change var reader = new NAudio.Wave.Mp3FileReader(stream); to NAudio.Wave.Mp3FileReader reader = new NAudio.Wave.Mp3FileReader(stream);
Has the previous nuget package been uninstalled? If not, please uninstall it.
If it still doesn’t work, hover your mouse over the place where the error occurred so that we can see the error message.
You can use the Snipping Tool that comes with Windows to delay screenshots.
7 people are following this question.
Insert a node as child ,before or after a node in nested dynamic JSON Node using C#
Visual Studio 2019: Undefined behavior in a C++/CLI wrapper project.
Example for how to get Package Metadata from Azure DevOps Rest-Api Artifacts using c#
How to collapse individual nested grids/stackpanels inside a grid?