refactor(gui,api,logging): UI layout tweaks, cleanup, and improved diagnostics
- CbBxCamType now spans the full width of CbBxCameraModel - BtnTest_Click moved to the bottom of AiQ_GUI.cs for easier testing/navigation - Unused using directives removed across files - Login credentials factored out and reused in MobileAPI.cs - VLC.cs Capture function reviewed and superseded by TakeSnapshot - InsertCamTab implementation updated to avoid use of `var` - Misleading '// Non-ONVIF cameras' comment corrected - Added Level.Debug logging, accessible only to developers, for detailed diagnostics
This commit is contained in:
43
MobileTests/VLC.cs
Normal file
43
MobileTests/VLC.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using AiQ_GUI;
|
||||
using Emgu.CV.Dai;
|
||||
using LibVLCSharp.Shared;
|
||||
using LibVLCSharp.WinForms;
|
||||
using System.IO;
|
||||
using System.Security.Policy;
|
||||
|
||||
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)
|
||||
{
|
||||
var media = new Media(libVLC, $"rtsp://ADMIN:1234@{MainForm.Instance.CamOnTest.IP}:554/live/main", FromType.FromLocation);
|
||||
|
||||
VLCVV.MediaPlayer.Play(media);
|
||||
}
|
||||
|
||||
public static bool IsPLaying(VideoView VLCVV)
|
||||
{
|
||||
return VLCVV.MediaPlayer.IsPlaying;
|
||||
}
|
||||
|
||||
public static void TakeSnapshot(VideoView VLCVV, string filename = "Mobile_ov_snapshot.png")
|
||||
{
|
||||
string path = Path.Combine(LDS.MAVPath, filename);
|
||||
VLCVV.MediaPlayer.TakeSnapshot(0, path, 1280, 720);
|
||||
}
|
||||
|
||||
public static void Stop(VideoView VLCVV)
|
||||
{
|
||||
VLCVV.MediaPlayer.Stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user