Small changes to vmodels
This commit is contained in:
parent
327faae0bc
commit
69628be9ce
10
.gitignore
vendored
10
.gitignore
vendored
@ -337,4 +337,12 @@ ASALocalRun/
|
|||||||
.localhistory/
|
.localhistory/
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
# BeatPulse healthcheck temp database
|
||||||
healthchecksdb
|
healthchecksdb
|
||||||
|
|
||||||
|
# Application Specific
|
||||||
|
|
||||||
|
*.avi
|
||||||
|
*.mkv
|
||||||
|
*.mpg
|
||||||
|
*.divx
|
||||||
|
*.xvid
|
||||||
|
@ -28,8 +28,7 @@ namespace Squirrowse.Client.Service
|
|||||||
using var fr = await GetFrame();
|
using var fr = await GetFrame();
|
||||||
yield return fr.ConvertToJpgByte();
|
yield return fr.ConvertToJpgByte();
|
||||||
await Task.Delay(1000 / 30);
|
await Task.Delay(1000 / 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
//fr.Dispose();
|
//fr.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
using System;
|
using Squirrowse.Core.Models;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Squirrowse.Client.Models
|
namespace Squirrowse.Client.Models
|
||||||
{
|
{
|
||||||
public class VideoFrame
|
public class VStream
|
||||||
{
|
{
|
||||||
|
public User user { get; set; }
|
||||||
public byte[] FrameBytes { get; set; }
|
public byte[] FrameBytes { get; set; }
|
||||||
public DateTime TimeStamp => DateTime.Now;
|
public DateTime TimeStamp => DateTime.Now;
|
||||||
public Guid id => Guid.NewGuid();
|
public Guid id => Guid.NewGuid();
|
@ -15,7 +15,7 @@ namespace Squirrowse.Service.Hubs
|
|||||||
{
|
{
|
||||||
private readonly ILogger<StreamHub> logger;
|
private readonly ILogger<StreamHub> logger;
|
||||||
private readonly IStreamManager manager;
|
private readonly IStreamManager manager;
|
||||||
|
|
||||||
|
|
||||||
public StreamHub(ILogger<StreamHub> logger, IStreamManager manager)
|
public StreamHub(ILogger<StreamHub> logger, IStreamManager manager)
|
||||||
{
|
{
|
||||||
@ -85,23 +85,42 @@ namespace Squirrowse.Service.Hubs
|
|||||||
|
|
||||||
public async Task UploadByteStream(IAsyncEnumerable<byte[]> stream)
|
public async Task UploadByteStream(IAsyncEnumerable<byte[]> stream)
|
||||||
{
|
{
|
||||||
manager.SaveData(stream);
|
|
||||||
await foreach (var frame in stream)
|
await foreach (var frame in stream)
|
||||||
{
|
{
|
||||||
var frameStamp = frame.ConvertByteToMat();
|
// var frameStamp = frame.ConvertByteToMat();
|
||||||
string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff",
|
// string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff",
|
||||||
CultureInfo.InvariantCulture);
|
// CultureInfo.InvariantCulture);
|
||||||
Cv2.PutText(frameStamp, timestamp, new Point(1,480/2), HersheyFonts.HersheySimplex,0.5f,Scalar.Red);
|
// Cv2.PutText(frameStamp, timestamp, new Point(1, 480 / 2), HersheyFonts.HersheySimplex, 0.5f, Scalar.Red);
|
||||||
logger.LogInformation($"{this.GetHashCode()}: send frame");
|
logger.LogInformation($"{this.GetHashCode()}: send frame");
|
||||||
|
|
||||||
//logger.LogInformation($"Got frame size: {frame.Length} ");
|
//logger.LogInformation($"Got frame size: {frame.Length} ");
|
||||||
//if (!streamOn) continue;
|
//if (!streamOn) continue;
|
||||||
// logger.LogInformation($"Send frame of size: {frame.Length} to {Core.Models.Groups.superUser.ToString()}");
|
// 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");
|
logger.LogInformation($"{this.GetHashCode()}: send data");
|
||||||
//await Task.Delay(100); //leave some delay for debug purpose
|
//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)
|
public async Task<IEnumerable<User>> GetListOfTypeUser(ConnectionType t)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ namespace Squirrowse.Service.Hubs
|
|||||||
|
|
||||||
public IEnumerable<User> getAllUsers()
|
public IEnumerable<User> getAllUsers()
|
||||||
{
|
{
|
||||||
var t = _users;
|
// var t = _users;
|
||||||
return _users;
|
return _users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<StartupObject>Squirrowse.Service.Program</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
<button id="StopViewCast" disabled="@(IsViewingCastOf(agent.AgentName))" class="btn btn-warning btn-sm" @onclick="@(() => OnStopViewCastClicked(agent.ConnectionId))">
|
<button id="StopViewCast" disabled="@(IsViewingCastOf(agent.AgentName))" class="btn btn-warning btn-sm" @onclick="@(() => OnStopViewCastClicked(agent.ConnectionId))">
|
||||||
Stop cast
|
Stop cast
|
||||||
</button>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -71,7 +78,16 @@
|
|||||||
{
|
{
|
||||||
return agentName == CurrentViewCastAgent;
|
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)
|
async Task OnStreamDataReceived(byte[] streamData)
|
||||||
{
|
{
|
||||||
@ -81,12 +97,12 @@
|
|||||||
// imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
// imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||||
// StateHasChanged();
|
// StateHasChanged();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var base64 = Convert.ToBase64String(streamData);
|
var base64 = Convert.ToBase64String(streamData);
|
||||||
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
async Task OnStreamDataReceivedEn(byte[] streamData)
|
async Task OnStreamDataReceivedEn(byte[] streamData)
|
||||||
{
|
{
|
||||||
//await foreach (var t in streamData)
|
//await foreach (var t in streamData)
|
||||||
@ -95,9 +111,9 @@
|
|||||||
// imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
// imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||||
// StateHasChanged();
|
// StateHasChanged();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var base64 = Convert.ToBase64String(streamData);
|
var base64 = Convert.ToBase64String(streamData);
|
||||||
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
imageSource = String.Format("data:image/jpg;base64,{0}", base64);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<StartupObject>Squirrowse.Web.Program</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user