private void Window_Initialized(object sender, EventArgs e) { _decoder.StartDecodingAsync("http://83.128.74.78:8083/mjpg/video.mjpg"); _decoder.OnFrameReceived += _decoder_OnFrameReceived; // Not used anymore //_worker.DoWork += _worker_DoWork; //_worker.RunWorkerAsync(); }
static void Main(string[] args) { if (Directory.Exists(FramesDir)) { Directory.Delete(FramesDir, true); } if (!Directory.Exists(FramesDir)) { Directory.CreateDirectory(FramesDir); } var decoder = new StreamDecoder(); decoder.OnFrameReceived += Decoder_OnFrameReceived; decoder.StartDecodingAsync("http://83.128.74.78:8083/mjpg/video.mjpg"); Console.ReadLine(); //while (true) //{ // Thread.Sleep(1000); // var frame = decoder.GetLastFrame(); // if (frame == null) continue; // Console.WriteLine($"Frame received at: {DateTime.Now}"); // using (FileStream fs = new FileStream($"Frames\\{DateTime.Now:HH-mm-ss}.jpeg", FileMode.CreateNew)) // { // fs.Write(frame, 0, frame.Length); // fs.Flush(); // } //} }
public void StartDecoding() => _decoder.StartDecodingAsync("http://83.128.74.78:8083/mjpg/video.mjpg");