Capturing and saving a Video in Windows 10 Application

In this blog post, we would work with capturing video in Windows 10 Application. Video capturing is one of the common tool used now-a-days in application development. So, we begin with the application:
In Visual Studio 2015, Start a new project and select Blank app in Universal App category. Before starting any coding, we have to go to package.appxmanifest file of the solution, we need to select Webcam and Video Library under Capabilities.

Then in the MainPage.xaml file we will add the code for button which will be used to capture the video and a media element where video will be shown:

 

After adding the above code in the xaml file, we will go to the methods of the buttons: Capture_button and Save_button and add their functionality. But before adding the functionality to the methods, we need to add the namespaces which will be required in the application:

 

Now, we add the declaration code for two objects of StorageFile class and IRandomAccessStream class which will be used throughtout the application:

 

Now, the functionality for Capture_button method which will invoke the default video capturing tool of the system:

 

Now, as the save functionality we used in the last blog of Capture and save Image, same we will be using here but with minor adjustments for the Video file extensions:

Now, run the program and enjoy!

Let me know of any query.