How to stream videos in WPF? - wpf

I want to stream video in a WPF application. There are two potential ways:
Embed VLC. Problem: I know how to embed VLC in a WinForm application but not in a WPF one.
Use MediaElement. Problem: I know how to play a wmv file, but I don't know how to play a stream.
So what can I do to play video streams in WPF?

It's very easy task. You can find out VlcDotnet. it's open source and using the VLC libraries. This is the Github link. It is fit with WPF.
Source File

Related

How do I prevent subtitles from showing up on my MediaElement?

I'm trying to create my own Media Player application using a WPF MediaElement. I know that the MediaElement actually uses Windows Media Player as its source and that's why it also loads the .srt (subtitle) file and shows subtitles below the video.
My application is actually supposed to override default subtitle rendering and show its own version of subtitles, so I need the MediaElement to ignore loading and displaying the .srt file.
How do I do this through WPF?
Thought I answer it for other people.
Loading subtitles may be related to the CODEC that's being used. Modifying the configuration of the CODEC through the configuration app it was provided with must solve the problem.

Howto play video with external audio in Silverlight?

Is there any proper method to play synchronously video and external audio, other than simply having two MediaElement (one for video source and one for audio) started simultaneously? I need to play video with different soundtracks, but I belive that just two separated MediaElements will be out of sync at some point of time. Maybe there is some way to add audio source to the existing MediaElement with video?
Platform: SL3, but SL4 will be good as well.
Thanks in advance.
This project provides "support for multiple audio tracks" which sounds like it will do what you want: http://smf.codeplex.com/

How to use a windows forms embedded resource as the Source for a WPF mediaelement?

I am hosting a MediaElement in a WinForms application, which I would like to play both images and video through. My images and video are set as embedded resources to the application.
The MediaElement.Source property only accepts a URI.
Any ideas on how to get the MediaElement to play the embedded resourece files without writing them to disk?
Thanks.
MediaElement cannot play from embedded resources files. It would be possible by writing your own DirectShow source filter, but that might be a lot of work for little benefit.

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 possible 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);

Convert a silverlight application to video format

I'm planning to make an animation with Silverlight, i want to export the animation to a video format, to be able to share it on video sharing website.
How can i do this ?
You could use a tool like Camtasia to record your screen or part of your screen. It then can be exported to a bunch of different video formats.
A pure code approach is to write a sequence of images, and then combine those images together as a video file. Eric Gunnerson has code to capture images from an animation , its WPF but would probably work in Silverlight? Codeproject has an example of converting a stream of images to an AVI video file in C#. It creates an AVI output. It would be great to go straight to mpg, but as it's compressed the input needs to be a video stream. If you do need mpg as the final output look for an off the shelf avi->mpg converter.
BTW - Let me know how you get on, I'm interested in the performance/functionality of this solution.
MrTelly: That approach would not work because Silverlight does not expose the RenderTargetBitmap class. (Well, this is not completely true, the class is there, but its constructor and methods are all marked SecurityCritical and as such are not normally accessible.)
The Camtasia solution proposed by Jakers is likely the simplest solution.
It's nuts that there isn't a simple way to do this in Silverlight, it's easy as pie in flash.

Resources