Squirrowse/squirrowse.client/Connection.cs

36 lines
770 B
C#
Raw Normal View History

2020-06-19 18:39:08 +02:00
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR.Client;
namespace squirrowse.client
{
public class Connection
{
public string ip { get; set; }
private readonly Webcam _cam;
public Connection()
{
_cam = new Webcam();
}
public async IAsyncEnumerable<byte[]> clientStreamData()
{
for (;;)
{
var data = _cam.GetBitmap();
2020-06-19 21:08:30 +02:00
await Task.Delay(100);
2020-06-19 18:39:08 +02:00
yield return data;
}
//After the for loop has completed and the local function exits the stream completion will be sent.
}
}
}