访问silverlight中的网络摄像头返回false

时间:2012-11-09 19:07:32

标签: wpf silverlight

我已经完成了访问我的网络摄像头的Silverlight应用程序。

代码:

public MainPage()
{
  InitializeComponent();      

  if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
  {
      snapshot.Visibility = Visibility.Collapsed;
      src.Start();
  }
  // Event Wiring
  //cameraButton.Click += new RoutedEventHandler(cameraButton_Click);
  photoButton.Click += new RoutedEventHandler(photoButton_Click);
  saveButton.Click += new RoutedEventHandler(saveButton_Click);

  // Setup Capture Source
  cameraBrush.SetSource(src);
}

问题:

以下功能始终返回false。我尝试在调试模式和发布模式下运行,但没有成功。

if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
  {
      snapshot.Visibility = Visibility.Collapsed;
      src.Start();
  }

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您必须处于发布模式。没有连接调试器。 https://stackoverflow.com/a/9258569/413032

CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();返回?