Question Play a small video file

Where you put the file is up to you. If it's a content file that won't change then the program folder or a subfolder under it would be perfectly fine. Assuming a WinForms application, you can then use Application.StartupPath to get the folder path. To do that, add the file to your project (under a folder if desired), set the Build Action to Content and Copy to Output Directory to anything but Do not copy.

As for the code required, there's no one answer to that because there's no standard video player control that comes with Windows Forms. It's up to you to decide what third-party control you want to use and then work out how to use it. We can help with specifics but your question is a bit general at the moment, so you should spend some time doing some research on the web. It used to be that you could use Windows Media Player but that has been deprecated in Windows now so it not necessarily available to all users. You may be able to add a video player via a NuGet package but you will likely have to install something on your system and any other users would like need to install the same thing, as the control may not be able to be distributed separately from the application it was built to be part of.
 
Back
Top