Squirrowse/squirrowse.client/Connection.cs

36 lines
776 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();
await Task.Delay(1000 / 33);
yield return data;
}
//After the for loop has completed and the local function exits the stream completion will be sent.
}
}
}