我有Lumia 830,并且尝试在UWP C#中创建手电筒应用程序。我的设备手电筒工作的很好,但我不知道为什么我不能创建我自己的应用程序打开/关闭手机的火炬。 我用灯类:如何在uwp C中创建手电筒应用程序#
var lamp = await Lamp.GetDefaultAsync();
if (lamp == null)
{
ShowErrorMessage("No Lamp device found");
return;
}
lamp.IsEnabled = true;
当我的手机“灯”运行这段代码为null并且无法找到我的FlashLED。我从MSDN.Microsoft.com得到这个代码和禅师说
如果返回的对象为null,灯泡API是 设备上不支持。即使设备上实际存在一个 指示灯,某些设备也可能不支持Lamp API。
这个课程不适用于我的Lumia 830我不知道为什么? :(
也是我使用此代码:
var mediaDev = new MediaCapture();
await mediaDev.InitializeAsync();
var videoDev = mediaDev.VideoDeviceController;
var tc = videoDev.TorchControl;
if (tc.Supported)
{
// But wait, for this to work with Blue camera drivers, we have to Start a recording session
// Create video encoding profile as MP4
var videoEncodingProperties = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Vga);
// Start Video Recording
var videoStorageFile = await KnownFolders.VideosLibrary.CreateFileAsync("tempVideo.mp4", CreationCollisionOption.GenerateUniqueName);
await mediaDev.StartRecordToStorageFileAsync(videoEncodingProperties, videoStorageFile);
// Turn on Torch
mediaDev.VideoDeviceController.TorchControl.Enabled = true;
}
此代码的工作和我的FlashLED打开,但它录制视频,并把它的用户SD卡内存 请帮助我,如果你知道有最好的方法。 由于打开/关闭手电筒或FlashLED。提前 侯赛因·哈比比Juybari
请,任何一个不知道? –