Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PackageReference Include="BootstrapBlazor.FluentSystemIcon" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.Gantt" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.HikVision" Version="10.0.6" />
<PackageReference Include="BootstrapBlazor.HikVision" Version="10.0.7" />
<PackageReference Include="BootstrapBlazor.Holiday" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.Html2Image" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="10.0.1" />
Expand Down
13 changes: 12 additions & 1 deletion src/BootstrapBlazor.Server/Components/Samples/HikVisions.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@

<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="@Localizer["BasicUsageIntro"]" Name="Normal">
<section ignore>
<p>注意事项:</p>
<p class="code-label">注意事项:</p>
<ul class="ul-demo">
<li><code>HikVisionWebPlugin</code> 组件依赖海康威视 Web 插件包,仅支持 windows 平台</li>
<li>由于核心功能均由海康威视 Web 插件提供所有浏览器控制台中会有部分提示或者报错信息均属于正常现象</li>
<li>由海康威视 Web 插件绘制的预览窗口并不是 html dom 元素,所以出现被截断遮挡其他窗口,多屏显示不正确时请刷新浏览器即可</li>
</ul>
<p class="code-label">录像功能说明:</p>
<ul class="ul-demo">
<li>必须登录并且开始预览后才可以开启录像功能</li>
<li>开始录像后,文件默认存储在插件安装路径文件夹内(C:\Users\[UserName]\HCWebSDKPlugins\RecordFiles)</li>
</ul>
</section>
<HikVisionWebPlugin @ref="_hikVision" OnInitedAsync="OnInitedAsync"
OnLoginAsync="OnLoginAsync" OnLogoutAsync="OnLogoutAsync" OnGetChannelsAsync="OnGetChannelsAsync"
Expand Down Expand Up @@ -85,6 +90,12 @@
<Button OnClick="OnCapture" IsDisabled="_stopRealPlayStatus">
<span>抓图</span>
</Button>
<Button OnClick="OnStartRecord" IsDisabled="_startRecordStatus">
<span>开始录像</span>
</Button>
<Button OnClick="OnStopRecord" IsDisabled="_stopRecordStatus">
<span>停止录像</span>
</Button>
</div>
}
</div>
Expand Down
36 changes: 36 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/HikVisions.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public partial class HikVisions
private bool _stopRealPlayStatus = true;
private bool _openSoundStatus = true;
private bool _closeSoundStatus = true;
private bool _startRecordStatus = true;
private bool _stopRecordStatus = true;

private List<SelectedItem> _analogChannels = [];
private int _channelId = 1;
Expand Down Expand Up @@ -114,6 +116,36 @@ private async Task OnCapture()
await _hikVision.CapturePictureAndDownload();
}

private async Task OnStartRecord()
{
var result = await _hikVision.StartRecord();
if (result)
{
_startRecordStatus = true;
_stopRecordStatus = false;
await ToastService.Success("消息通知", "开始录像成功");
}
else
{
await ToastService.Error("消息通知", "开始录像失败");
}
}

private async Task OnStopRecord()
{
var result = await _hikVision.StopRecord();
if (result)
{
_startRecordStatus = false;
_stopRecordStatus = true;
await ToastService.Success("消息通知", "结束录像成功");
}
else
{
await ToastService.Error("消息通知", "结束录像失败");
}
}

private async Task OnInitedAsync(bool initialized)
{
_inited = initialized;
Expand Down Expand Up @@ -181,6 +213,8 @@ private Task OnStartRealPlayedAsync()
_stopRealPlayStatus = !_startRealPlayStatus;
_openSoundStatus = false;
_closeSoundStatus = true;
_startRecordStatus = false;
_stopRecordStatus = true;
StateHasChanged();
return Task.CompletedTask;
}
Expand All @@ -191,6 +225,8 @@ private Task OnStopRealPlayedAsync()
_stopRealPlayStatus = !_startRealPlayStatus;
_openSoundStatus = true;
_closeSoundStatus = true;
_startRecordStatus = true;
_stopRecordStatus = true;
StateHasChanged();
return Task.CompletedTask;
}
Expand Down
Loading