36 lines
770 B
C#
36 lines
770 B
C#
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(100);
|
|
yield return data;
|
|
|
|
}
|
|
//After the for loop has completed and the local function exits the stream completion will be sent.
|
|
}
|
|
|
|
}
|
|
}
|