Before reading this article, please go through the following articles-
- Developing Windows Store Apps: Introduction And Requirement Specification
- Plans For Designing Metro Style Apps (Windows Store Apps)
- Windows Store Application Life-Cycle
- Guidelines to Pass Windows Store App Certification
- Navigation Patterns to Develop Windows Store Application
- Templates to Develop Windows Store Apps
- Develop Your First Windows Store App (Hello World)
- Controls to Design Windows Store Apps
- Lay-out Design Guidelines For Windows Store Apps
- Guidelines to Create Splash Screen For Windows Store Application
- Configure Your Windows Store Application Using Manifest Designer
- Working With Progress Controls in Windows Store Application
- Global AppBar For Windows Store Applications
-
Using Webcam to Preview Video In Windows Store App
Introduction
In the last article, we saw how to
capture video using webcam in windows store application. In this article, we will see how to rotate the video captured from a webcam in a Windows Store application. If you need to place the video in a corner in your application due to limited space on the screen and since you need to show a rotated video then you can use this technique for rotating the video. Let's see how to rotate a video.
Step 1
Follow the steps given in my
last article to create a first video captured application using a webcam.
Step 2
After you created a video capture enabled Windows Store application, add the rotation effect to your application. In the Windows Store, we have two kinds of rotation, one is PreviewRotation and the second is RecordRotation.
Preview Rotation
A Preview rotation is for when you need to rotate the captured video while the video is being captured from the webcam or other capture enabled device. If you need to rotate the preview of the video then you can use preview rotation. Preview rotation can be provided using MediaCapture object's SetPreviewRotation method that takes a VideoRotation enumerations value as input and rotates the video.
VideoRotation enumeration can found under the "Windows.Media.Capture.VideoRotation" namespace.
The VideoRotation enumeration has values for 0, 90, 180 and 270 degrees. For applying PreviewRotation on video use the following line of code.
captureMgr.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
In the above line, we have captureMgr as the MediaCapture object. We called the SetPreviewRotation method of the MediaCapture class to rotate the video while previewing.
Record Rotation
Record rotation is used when we need to rotate the video while recording. When you are recording video in a Windows Store application and need the video to be rotated then you can use Record Rotation. RecordRotation can be applied by calling the SetRecordRotation method of the MediaCapture class that also takes the same enumeration values as input as does Preview Rotation.
captureMgr.SetRecordRotation(VideoRotation.Clockwise90Degrees);
Conclusion
In this easy way, we can apply rotation on video in a Windows Store application.