locked
How to know if the Camera is a front or a rear camera?

    Question

  • In the latest sample 'Media capture using capture device sample' source code, it use 'EnclosureLocation' of DeviceInformation to rotate the preview automatically in orientation changed event. But when I run the app on a tablet, the member 'EnclosureLocation' of DeviceInformation  is always null for the camera device.

    I run the MS default Camera app, the preview can be rotated correct and the preview is mirrored default for the front camera automatically.

    Anyone can tell me how MS Camera to know the camera is front or rear?

    Thanks.


    • Edited by ytshe Thursday, September 06, 2012 6:40 AM
    Thursday, September 06, 2012 6:35 AM

Answers

  • Hello,

    I'm not sure that I understand your question. The "DeviceInformation.EnclusureLocation" class is the way to get the location of the currently selected OEM camera. If the "DeviceInformation.EnclusureLocation" value is not getting set this is due to the fact that the OEM did not include this information in their driver metadata and is not available on the device.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, September 07, 2012 8:20 PM
    Moderator

All replies

  • Hello,

    I'm not sure that I understand your question. The "DeviceInformation.EnclusureLocation" class is the way to get the location of the currently selected OEM camera. If the "DeviceInformation.EnclusureLocation" value is not getting set this is due to the fact that the OEM did not include this information in their driver metadata and is not available on the device.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, September 07, 2012 8:20 PM
    Moderator
  • Hi, James:

    Thank you for your reply.

    I'm clear now that the "DeviceInformation.EnclusureLocation" class is only for the device that included this information in it's metadata.

    Is there any other way to identify the front/rear camera? In MS default Camera app, it seems that it can recognize which camera is the front camera even the information of 'DeviceInformation.EnclusureLocation' is null.

    Thanks.

     

    Monday, September 10, 2012 8:36 AM