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.
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.
<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.
Anonymous
Its awesome….
Anonymous
Its helped me alot. thanks
Amna Rahman
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!
SajjadGul
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
Anonymous
my error was The Mixed Mode Assembly….version 'v1.1.4322' error. Thanks… you solved my problem. 😀
haris
great
Abdul Rukhman
i tried this in my C# project. thank u.
Anonymous
Open source C#. wow. amazing site. thanks 4 putting all this online.
ravi chandra
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.
ravi chandra
i have install already installed Microsoft DirectX
Anonymous
solve it
Vamp_102
Video quality is crap… Did I do something wrong?
Nasib Zada
If these projects were posted on github too, cloning them would be a lot easier.