星火直播PC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CameraWindow.xaml.cs 1.0KB

пре 4 година
123456789101112131415161718192021222324252627282930313233343536
  1. using AForge.Video.DirectShow;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. namespace XHZB.Desktop
  16. {
  17. /// <summary>
  18. /// CameraWindow.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class CameraWindow : Window
  21. {
  22. public CameraWindow()
  23. {
  24. InitializeComponent();
  25. FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
  26. if(videoDevices.Count>0)
  27. {
  28. var videoDevice = new VideoCaptureDevice(videoDevices[0].MonikerString);
  29. videoDevice.VideoResolution = videoDevice.VideoCapabilities[0];
  30. player.VideoSource = videoDevice;
  31. player.Start();
  32. }
  33. }
  34. }
  35. }