2

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 possible would you please tell me how to do it.

thanks a lot

wonea
  • 4,783
  • 17
  • 86
  • 139
hellojacktom
  • 21
  • 1
  • 3
  • Have a look here as well http://stackoverflow.com/questions/7117589/using-mediaelement-to-play-video-from-stream – NoWar Feb 06 '13 at 11:54

2 Answers2

1

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

wonea
  • 4,783
  • 17
  • 86
  • 139
-5
MemoryStream s;
...

MediaElement m = new MediaElement();
m.SetSource(s);
Mike Blandford
  • 3,952
  • 4
  • 29
  • 32
  • But this class is in System.Windwos.dll that is belong to Silverlight not WPF(in PresentationFramework.dll). they have the same class name and the Wpf version does not support this method. – hellojacktom Nov 02 '09 at 02:35
  • It won't work when I reference the same class name(and the same namespace)in my WPF project. – hellojacktom Nov 02 '09 at 02:46
  • SetSource is not available in the WPF MediaElement. – eodabash May 20 '11 at 21:06