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.
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.
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 this source code with complete windows forms & all files.