在Windows Phone 8.1上打开Lumia 1520上的手电筒

时间:2015-07-30 01:10:16

标签: c# windows-phone-8.1

我想打开Lumia 1520上的手电筒。我尝试使用此代码但不起作用:

if (captureManager.VideoDeviceController.TorchControl.Supported)
        {
            var videoEncodingProperties = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Vga);
            StorageFolder folder = KnownFolders.VideosLibrary;
            StorageFile videoStorageFile;               
            videoStorageFile = await folder.CreateFileAsync("tempVideo.mp4", CreationCollisionOption.GenerateUniqueName);
            Capture.Source = captureManager;
            await captureManager.StartRecordToStorageFileAsync(videoEncodingProperties, videoStorageFile);
            captureManager.VideoDeviceController.TorchControl.Enabled = true;
            int i;
            for (i = 0; i < 3; i++)
            {
                await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(1));
            }
            captureManager.VideoDeviceController.TorchControl.Enabled = false;
            captureManager.Dispose();
        }

我试过这篇文章Toggle flashlight in Windows Phone 8.1,但没有用。 支持FlashControl和TorchControl。它没有错误也没有光。

0 个答案:

没有答案