Yesterday, I gave you a very sloppy talk about dealing with the flip of a physical camera, today, still this topic, and the content is not bad, just for completeness, incidentally also provides the runtime API version, in fact, the implementation of the SL framework version is similar, after all, the two frameworks have a lot of APIs are shared.
First, open the manifest file, and on the Application tab, select the horizontal side of the "supported rotation" to the right, and the other not to select only the landscape .
Then switch to the "Features" tab and hook up the webcam and photo gallery because we want to use them.
Also, use the Mediacapture class to be aware of releasing the application when it hangs, and initializing it when the application starts or continues to run.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/
Add the following code to the App class:
<summary>///Video Capture object///</summary> public mediacapture thecapture {get; private Set ///<summary>///Initialization camera///</summary> private Async Task Initializeca
Pture () {thecapture = new mediacapture ();
Find rear-facing camera var devicecollection = await deviceinformation.findallasync (deviceclass.videocapture); Deviceinformation Backcamera = Devicecollection.firstordefault (d => D.enclosurelocation.panel = =
Windows.Devices.Enumeration.Panel.Back); if (Backcamera!= null) {mediacaptureinitializationsettings setting = new mediacaptureinitial
Izationsettings (); Setting.
Audiodeviceid = ""; Setting.
Videodeviceid = backcamera.id;
await Thecapture.initializeasync (setting);
else {await thecapture.initializeasync (); }///<summary>///Cleanup Camera related resources///</summary> Private V
OID Cleanupcapture () {if (thecapture!= null) {thecapture.dispose ();
Thecapture = null; }
}