How to play mp3 stream using the MediaElement class from WPF?
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);
精彩评论