开发者

How can I play an MP3 from a memory stream in C#?

开发者 https://www.devze.com 2023-01-31 23:36 出处:网络
I\'m trying to play an MP3 sound but I need it played from a memory stream (I don\'t have the actual file). What\'s my best option to do this? mciSendString accepts a file name as a parameter but not

I'm trying to play an MP3 sound but I need it played from a memory stream (I don't have the actual file). What's my best option to do this? mciSendString accepts a file name as a parameter but not a memory strea开发者_Python百科m. Is is possible to play the mp3 file with winmm's PlaySound?

Thanks!


For Alvas.Audio see code below

//Memory stream with mp3 audio data
MemoryStream ms = new MemoryStream();
Mp3Reader mr = new Mp3Reader(ms);
PlayerEx plex = new PlayerEx();
plex.OpenPlayer(mr.ReadFormat());
plex.AddData(mr.ReadData());
plex.StartPlay();
0

精彩评论

暂无评论...
验证码 换一张
取 消