Small changes to vmodels
This commit is contained in:
parent
327faae0bc
commit
69628be9ce
8
.gitignore
vendored
8
.gitignore
vendored
@ -338,3 +338,11 @@ ASALocalRun/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Application Specific
|
||||
|
||||
*.avi
|
||||
*.mkv
|
||||
*.mpg
|
||||
*.divx
|
||||
*.xvid
|
||||
|
@ -29,7 +29,6 @@ namespace Squirrowse.Client.Service
|
||||
yield return fr.ConvertToJpgByte();
|
||||
await Task.Delay(1000 / 30);
|
||||
}
|
||||
|
||||
//fr.Dispose();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
@ -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());
|
||||
// logger.LogInformation($"Send frame of size: {frame.Length} to {Core.Models.Groups.superUser.ToString()}");
|
||||
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);
|
||||
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)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ namespace Squirrowse.Service.Hubs
|
||||
|
||||
public IEnumerable<User> getAllUsers()
|
||||
{
|
||||
var t = _users;
|
||||
// var t = _users;
|
||||
return _users;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<StartupObject>Squirrowse.Service.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -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)
|
||||
{
|
||||
@ -82,8 +98,8 @@
|
||||
// StateHasChanged();
|
||||
//}
|
||||
|
||||
var base64 = Convert.ToBase64String(streamData);
|
||||
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||
var base64 = Convert.ToBase64String(streamData);
|
||||
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||
StateHasChanged();
|
||||
|
||||
}
|
||||
@ -96,8 +112,8 @@
|
||||
// StateHasChanged();
|
||||
//}
|
||||
|
||||
var base64 = Convert.ToBase64String(streamData);
|
||||
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||
var base64 = Convert.ToBase64String(streamData);
|
||||
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||
StateHasChanged();
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<StartupObject>Squirrowse.Web.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user