星火直播PC
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CameraWindow.xaml.cs 1.0KB

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. }