开发者

How to play mp3 stream using the MediaElement class from WPF?

开发者 https://www.devze.com 2022-12-10 04:19 出处:网络
I wondering if the MediaElement component (from WPF) is capable of playing and buffering mp3 streams.

I wondering if the MediaElement component (from WPF) is capable of playing and buffering mp3 streams.

I need play mp3 memory stream(not mp3 file) using MediaElement of WPF, if p开发者_开发问答ossible would you please tell me how to do it.

thanks a lot


Sadly this is functionality has not been implemented in WPF. There is a workaround quoting from a codeproject

"Since MediaElement control with Source property from WPF cannot receive byte[] or Stream, we can manipulate it using ASP.NET as a video stream."

Building a Personal Diary with WPF

Alternatively you could embed a plugin such as the VideoLan DotNet for WinForm & WPF which can stream files, and has very wide codec support. The downside to this is VideoLAN needs to be installed locally on the machine.

On another note there is a feature request to implement this in WPF. If you feel obliged, then vote;

WPF Feature Suggestions - Add stream capability to MediaElement


MemoryStream s;
...

MediaElement m = new MediaElement();
m.SetSource(s);
0

精彩评论

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

关注公众号