Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi ,Guys

I Have Big Problem

How Can Play Video From MemoryStream In WinForms Using C#

Thanks Alot
Posted
Comments
Artefakt94 6-Jun-13 5:05am    

1 solution

If you can drop the requirement to play from MemoryStream and are happy to play it from file, you could use WPF MediaElement inside forms ElementHost:
C#
ElementHost host = new ElementHost();
MediaElementControl mediaElement = new MediaElementControl();
host.Child = mediaElement;
this.Controls.Add(host);
mediaElement.mediaPlayer.Source = new Uri(@"c:\temp\delta.mpg");
mediaElement.mediaPlayer.LoadedBehavior = System.Windows.Controls.MediaState.Manual;
mediaElement.mediaPlayer.Play();

MediaElementControl.xaml
XML
<usercontrol x:class="WindowsFormsApplication2.MediaElementControl" xmlns:x="#unknown">
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
<mediaelement x:name="mediaPlayer" />
</usercontrol>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900