Пример #1
0
        /**
         * An async method to set the default camera and initialize the default camera
         */
        public async Task InitDefaultCameraAsync()
        {
            if (DefaultCamera == null)
            {
                var cameraDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

                // here we use the first or default camera. If requirement changes we can change the camera by changing selection here
                DeviceInformation defaultWebCamDev = cameraDevices.FirstOrDefault();
                DefaultCamera = await CameraDevice.CreateNewCameraDeviceAsync(defaultWebCamDev);
            }

            if (DefaultCamera.CameraCapture == null)
            {
                await DefaultCamera.InitCameraAsync();
            }
        }