Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MediaElement to play video from Stream

Is it possible to use the WPF MediaElement to play streaming video from a System.IO.Stream object? The Stream object is being retrieved from a WCF service that stores the media files.

like image 646
rafale Avatar asked Aug 19 '11 06:08

rafale


2 Answers

Before anyone wastes hours finding this out for themselves: it is impossible to host the Silverlight MediaElement in a WPF application. The reason for this is that it is one of a number of types that appear in PresentationFramework.dll (unavoidable for WPF) and System.Windows.dll (Silverlight versions) that have the same names and the same namespaces, but are different types. (Someone should explain why we have namespaces to microsoft!)

like image 106
Robert Avatar answered Oct 12 '22 23:10

Robert


I know this isn't what you asked for but you can host a VLC ActiveX component inside a window in WPF and then use that VLC control to connect to the stream and display the stream. This is how I got streaming working through WPF.

Edit: this page has an example of how to host an ActiveX control inside WPF

like image 44
stuartmclark Avatar answered Oct 13 '22 00:10

stuartmclark