49 lines
1.2 KiB
C#
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);
|
|||
|
|
}
|
|||
|
|
}
|