0

I'm writing a program to show different pictures and videos on a form. I started with displaying images with transparency using GDI. Due to the fact that GDI doesn't support transparency, the loading and displaying was very very slow, so I moved over to SharpDX.

In the meantime I managed (with one of the samples from SharpDX) to display different images on my form with opacity, positioning and sizing the images. The images are drawn with DrawBitmap of the RenderTarget class in the render loop.

Now I want to do the same with videos. My goal is to play videos (more than one at the same time) in my form and set the position, size and transparency of the different videos.

I'm new to SharpDX and information about graphic programming and the documentation and the samples of SharpDX are very rare. I found many samples for playing videos with SharpDX, but all for XAML and WIN8 or Store-Apps, but no samples of how to play video in normal C# programs. What I found is one video player with SharpDX, but I don't know how to change this sample to add transpareny, sizing and positioning of the video playing.

Can anyone give me some examples how to play videos with SharpDX in a form or picturebox/panel? It would be great if this would show the things from above.

Gorgsenegger
  • 7,356
  • 4
  • 51
  • 89
jonas
  • 21
  • 4
  • 1
    If you are using SharpDX, you can try to use same code in desktop apps as in the Win8-xaml ones, as long as your OS supports needed functions. For playing videos you will need to work with MediaFoundation assemblies. – Artiom Ciumac Mar 11 '14 at 09:39
  • In the Win8 Samples of SharpDX there is an MediaPlayer.cs sample. It uses the SharpDX.MediaFoundation and in an RenderLoop it draws the new video frame, that would perfectly fit in my concept of my image renderer. The problem is that the MediaEngine, MediaEngineEx classes are only available for Win8 apps. Is there any alternative for these classes? – jonas Mar 11 '14 at 11:27
  • According to [MSDN documentation](http://msdn.microsoft.com/en-us/library/windows/desktop/hh447918%28v=vs.85%29.aspx) this class is available only in Windows 8, both for Desktop and Windows Store apps. If you are using an earlier OS - then it might not work. In SharpDX this class is available in DirectX 11.2 assemblies. – Artiom Ciumac Mar 11 '14 at 15:35
  • Yes I use Windows 7 and the destination OS of my program should be windows 7 (and later if i can test it windows 8). Is there any alternative how to play videos without the MediaEngine class (on windows 7)? – jonas Mar 11 '14 at 16:16
  • [This](http://stackoverflow.com/questions/1144609/displaying-a-video-in-directx) question has some info about video playback in DirectX, and [this](http://code.google.com/p/sharpdx/issues/detail?id=190) issue contains additional information about how to do it in C#. – Artiom Ciumac Mar 11 '14 at 20:20
  • Please supply example code for us to play around with – WonderWorker Jun 27 '16 at 07:53

0 Answers0