Files
AiQ_GUI/Mobile Tests/VLC.cs
Bradley Born 4a2e874b9d - Replaced single TabPage CurrentTab with List<TabPage> CurrentTabs to support multiple tabs.
- Added new tab called Video

- Removed unused tabs on load (Soak, Mobile, Video, Images).

- Refactored InsertCamTab():

- Uses CurrentTabs to manage multiple tabs per camera type.

Mobile → inserts Video + Mobile tabs.
AiQ → inserts Images + Soak tabs.

-Cleans up previous tabs before inserting new ones.

-Updated BtnTest_Click():
Added 5-second delay before snapshot.
Takes snapshot after video starts playing.

- New file created VLC.cs
Streams the given IP into the Video tab and takes a snapshot
2026-01-12 16:30:04 +00:00

49 lines
1.2 KiB
C#

using AiQ_GUI;
using LibVLCSharp.Shared;
using LibVLCSharp.WinForms;
using System.IO;
internal class VLC
{
public static LibVLC libVLC;
static VLC()
{
// Ensure LibVLC is initialized before first use
Core.Initialize();
libVLC = new LibVLC();
}
public static string RtspUrl = $"rtsp://ADMIN:1234@192.168.0.85:554/live/main";
public static string SnapshotPath = Path.Combine(LDS.MAVPath, "Mobile_ov_snapshot.png");
public static void Play(VideoView VLCVV)
{
var media = new Media(libVLC, RtspUrl, FromType.FromLocation);
VLCVV.MediaPlayer.Play(media);
}
public static bool IsPLaying(VideoView VLCVV)
{
return VLCVV.MediaPlayer.IsPlaying;
}
public static void TakeSnapshot(VideoView VLCVV)
{
VLCVV.MediaPlayer.TakeSnapshot(0, SnapshotPath, 1280, 720);
}
public static void Stop(VideoView VLCVV)
{
VLCVV.MediaPlayer.Stop();
}
public static void Capture(VideoView VLCVV)
{
var media = new Media(libVLC, RtspUrl, FromType.FromLocation);
media.AddOption(":rtsp-tcp");
VLCVV.MediaPlayer.Play(media);
}
}