2026-01-12 16:30:04 +00:00
|
|
|
|
using AiQ_GUI;
|
2026-01-13 15:31:50 +00:00
|
|
|
|
using Emgu.CV.Dai;
|
2026-01-12 16:30:04 +00:00
|
|
|
|
using LibVLCSharp.Shared;
|
|
|
|
|
|
using LibVLCSharp.WinForms;
|
|
|
|
|
|
using System.IO;
|
2026-01-13 15:31:50 +00:00
|
|
|
|
using System.Security.Policy;
|
2026-01-12 16:30:04 +00:00
|
|
|
|
|
|
|
|
|
|
internal class VLC
|
|
|
|
|
|
{
|
|
|
|
|
|
public static LibVLC libVLC;
|
|
|
|
|
|
|
|
|
|
|
|
static VLC()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Ensure LibVLC is initialized before first use
|
|
|
|
|
|
Core.Initialize();
|
|
|
|
|
|
libVLC = new LibVLC();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string SnapshotPath = Path.Combine(LDS.MAVPath, "Mobile_ov_snapshot.png");
|
|
|
|
|
|
|
|
|
|
|
|
public static void Play(VideoView VLCVV)
|
|
|
|
|
|
{
|
2026-01-13 15:31:50 +00:00
|
|
|
|
var media = new Media(libVLC, $"rtsp://ADMIN:1234@{MainForm.Instance.CamOnTest.IP}:554/live/main", FromType.FromLocation);
|
|
|
|
|
|
|
2026-01-12 16:30:04 +00:00
|
|
|
|
VLCVV.MediaPlayer.Play(media);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsPLaying(VideoView VLCVV)
|
|
|
|
|
|
{
|
|
|
|
|
|
return VLCVV.MediaPlayer.IsPlaying;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-13 15:31:50 +00:00
|
|
|
|
public static void TakeSnapshot(VideoView VLCVV, string filename = "Mobile_ov_snapshot.png")
|
2026-01-12 16:30:04 +00:00
|
|
|
|
{
|
2026-01-13 15:31:50 +00:00
|
|
|
|
string path = Path.Combine(LDS.MAVPath, filename);
|
|
|
|
|
|
VLCVV.MediaPlayer.TakeSnapshot(0, path, 1280, 720);
|
2026-01-12 16:30:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void Stop(VideoView VLCVV)
|
|
|
|
|
|
{
|
|
|
|
|
|
VLCVV.MediaPlayer.Stop();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void Capture(VideoView VLCVV)
|
|
|
|
|
|
{
|
2026-01-13 15:31:50 +00:00
|
|
|
|
var media = new Media(libVLC, $"rtsp://ADMIN:1234@{MainForm.Instance.CamOnTest.IP}:554/live/main", FromType.FromLocation);
|
2026-01-12 16:30:04 +00:00
|
|
|
|
media.AddOption(":rtsp-tcp");
|
|
|
|
|
|
VLCVV.MediaPlayer.Play(media);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|