Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing streaming video in WPF

Tags:

c#

wpf

streaming

I've written a WCF service that streams media files. I'm now writing a WPF application that consumes this service and have only just found out that the MediaElement does not accept Stream objects as input parameters for the source property.

I've been Googling endlessly for the past two days and have looked at several alternatives including the Silverlight Viewports inside WPF, VLC ActiveX controls, VideoRendererElement and WPFMediaKit. Unfortunately I've been hampered by lack of documentation and/or examples and haven't really made any progress so far. The fact that this is the very first time I'm using WPF doesn't help either.

To put it simply, what I'm looking for is something that comes with documentation or examples demonstrating streaming in WPF and, if possible, is also straightforward to implement. The solution doesn't have to be perfect; all I need is something that works.

like image 315
rafale Avatar asked Aug 21 '11 03:08

rafale


1 Answers

You could host a HttpListener inside your WPF app and supply the stream which you receive from your WCF service through an URL which is served by HttpListener to MediaElement.Source .

Other options (though you seem to have ruled them out):

  • http://directshownet.sourceforge.net/
  • http://wpfmediakit.codeplex.com/

Not sure if this is an option for you, but there are commercial libraries for multimedia including video playback from streams in WPF:

  • http://www.leadtools.com/sdk/multimedia-suite.htm#-
  • http://www.visioforge.com/video-capture-sdk-net2.html or http://www.visioforge.com/media-player-sdk-net.html
like image 154
Yahia Avatar answered Sep 19 '22 11:09

Yahia