Small changes to vmodels

This commit is contained in:
ziomus5555 2019-11-16 13:07:20 +01:00
parent 327faae0bc
commit 69628be9ce
8 changed files with 69 additions and 23 deletions

8
.gitignore vendored
View File

@ -338,3 +338,11 @@ ASALocalRun/
# BeatPulse healthcheck temp database
healthchecksdb
# Application Specific
*.avi
*.mkv
*.mpg
*.divx
*.xvid

View File

@ -29,7 +29,6 @@ namespace Squirrowse.Client.Service
yield return fr.ConvertToJpgByte();
await Task.Delay(1000 / 30);
}
//fr.Dispose();
}
}

View File

@ -1,9 +1,11 @@
using System;
using Squirrowse.Core.Models;
using System;
namespace Squirrowse.Client.Models
{
public class VideoFrame
public class VStream
{
public User user { get; set; }
public byte[] FrameBytes { get; set; }
public DateTime TimeStamp => DateTime.Now;
public Guid id => Guid.NewGuid();

View File

@ -85,23 +85,42 @@ namespace Squirrowse.Service.Hubs
public async Task UploadByteStream(IAsyncEnumerable<byte[]> stream)
{
manager.SaveData(stream);
await foreach (var frame in stream)
{
var frameStamp = frame.ConvertByteToMat();
string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff",
CultureInfo.InvariantCulture);
Cv2.PutText(frameStamp, timestamp, new Point(1,480/2), HersheyFonts.HersheySimplex,0.5f,Scalar.Red);
// var frameStamp = frame.ConvertByteToMat();
// string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff",
// CultureInfo.InvariantCulture);
// Cv2.PutText(frameStamp, timestamp, new Point(1, 480 / 2), HersheyFonts.HersheySimplex, 0.5f, Scalar.Red);
logger.LogInformation($"{this.GetHashCode()}: send frame");
//logger.LogInformation($"Got frame size: {frame.Length} ");
//if (!streamOn) continue;
// logger.LogInformation($"Send frame of size: {frame.Length} to {Core.Models.Groups.superUser.ToString()}");
await Clients.Groups(Core.Models.Groups.superUser.ToString()).SendAsync("RecData", frameStamp.ConvertToJpgByte());
var framewithTs = await AddTimestamp(frame);
await Clients.Groups(Core.Models.Groups.superUser.ToString()).SendAsync("RecData",framewithTs );
logger.LogInformation($"{this.GetHashCode()}: send data");
//await Task.Delay(100); //leave some delay for debug purpose
await Task.Delay(1000 / 30);
}
}
public async Task StartRecord(string connectionId)
{
}
public async Task StopRecord(string connectionId)
{
}
public async Task<byte[]> AddTimestamp(byte[] framebytes)
{
var frameStamp = framebytes.ConvertByteToMat();
string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff",
CultureInfo.InvariantCulture);
Cv2.PutText(frameStamp, timestamp, new Point(1, 480 / 2), HersheyFonts.HersheySimplex, 0.5f, Scalar.Red);
return frameStamp.ConvertToJpgByte();
}
public async Task<IEnumerable<User>> GetListOfTypeUser(ConnectionType t)
{

View File

@ -48,7 +48,7 @@ namespace Squirrowse.Service.Hubs
public IEnumerable<User> getAllUsers()
{
var t = _users;
// var t = _users;
return _users;
}

View File

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<StartupObject>Squirrowse.Service.Program</StartupObject>
</PropertyGroup>
<ItemGroup>

View File

@ -28,6 +28,13 @@
<button id="StopViewCast" disabled="@(IsViewingCastOf(agent.AgentName))" class="btn btn-warning btn-sm" @onclick="@(() => OnStopViewCastClicked(agent.ConnectionId))">
Stop cast
</button>
<button id="StartRecording" disabled="@(IsViewingCastOf(agent.AgentName))" class="btn btn-warning btn-sm" @onclick="@(() =>StartRecording(agent.ConnectionId))">
Stop cast
</button>
<button id="StartRecording" disabled="@(IsViewingCastOf(agent.AgentName))" class="btn btn-warning btn-sm" @onclick="@(() =>StopRecording(agent.ConnectionId))">
Stop cast
</button>
</div>
</div>
</div>
@ -71,7 +78,16 @@
{
return agentName == CurrentViewCastAgent;
}
async Task StartRecording(string agent)
{
await connection.SendAsync("StartRecord");
StateHasChanged();
}
async Task StopRecording(string agent)
{
await connection.SendAsync("StopRecord");
StateHasChanged();
}
async Task OnStreamDataReceived(byte[] streamData)
{

View File

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<StartupObject>Squirrowse.Web.Program</StartupObject>
</PropertyGroup>
<ItemGroup>