How to solve the camera flip problem in Windows phone 8.1 development (Runtimeapp article)

Source: Internet
Author: User

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; }
        }

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.