Custom Video Player in C#

This C# Tutorial is about creating a video player without embedding the windows media player in winforms with .NET compatibility error resolved & with Codecs. You can Download it with Complete source code.


A member asked in our C# Facebook group about how can he implement a Video player in C# windows forms. So here I’ve wrote the complete tutorial.

Steps:

1- You have to include Microsoft.DirectX.AudioVideoPlayback.dll in your Project.
>> [check how to attach a dll in csharp windows form?] 2- Now add this Assembly to your project.

using Microsoft.DirectX.AudioVideoPlayback; //here we add it.
The Mixed Mode Assembly….version ‘v1.1.4322’ error:
3- Third important step is you have to edit your app.config file as follows. Locate this file in your application’s project & open it.
Write this line of code in between <configuration> </configuration>.
<startup useLegacyV2RuntimeActivationPolicy="true">
 <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
 </startup>

We are adding above code in our app.config file because sometimes the following error occurs in our application.

This error is due to .Net version compatibility. It can be resolved by adding above code in your app.config file.

Source Code:


4- And the work is done. All you have to do is see this code & if you need any more functions in this add them.

Download:

Download this source code with complete windows forms & all files.

13 thoughts on “Custom Video Player in C#”

  1. Its showing this exception!
    FileNotFoundException was unhandled
    Could not load file or assembly 'Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
    '
    Please Help!

    • Amna.. You have not installed Microsoft DirectX. Install it. Because its using a Dll of Microsoft.DirectX.AudioVideoPlayback; . Without it you will get this error

  2. my error was The Mixed Mode Assembly….version 'v1.1.4322' error. Thanks… you solved my problem. 😀

  3. its give following exception!

    Could not load file or assembly 'Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Comments are closed.