Skip to content

Commit 6f722c8

Browse files
committed
feat(HikVision): add OpenSound/CloseSound method
1 parent 30c29bb commit 6f722c8

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<PackageReference Include="BootstrapBlazor.FluentSystemIcon" Version="10.0.0" />
4343
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="10.0.0" />
4444
<PackageReference Include="BootstrapBlazor.Gantt" Version="10.0.0" />
45-
<PackageReference Include="BootstrapBlazor.HikVision" Version="10.0.4" />
45+
<PackageReference Include="BootstrapBlazor.HikVision" Version="10.0.5" />
4646
<PackageReference Include="BootstrapBlazor.Holiday" Version="10.0.0" />
4747
<PackageReference Include="BootstrapBlazor.Html2Image" Version="10.0.0" />
4848
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="10.0.1" />

src/BootstrapBlazor.Server/Components/Samples/HikVisions.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
<Button OnClick="OnStopRealPlay" IsDisabled="_stopRealPlayStatus">
7777
<span>停止预览</span>
7878
</Button>
79+
<Button OnClick="OnOpenSound" IsDisabled="_stopRealPlayStatus">
80+
<span>打开声音</span>
81+
</Button>
82+
<Button OnClick="OnCloseSound" IsDisabled="_stopRealPlayStatus">
83+
<span>关闭声音</span>
84+
</Button>
7985
</div>
8086
}
8187
</div>

src/BootstrapBlazor.Server/Components/Samples/HikVisions.razor.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public partial class HikVisions
1515
[Inject, NotNull]
1616
private SwalService? SwalService { get; set; }
1717

18+
[Inject, NotNull]
19+
private ToastService? ToastService { get; set; }
20+
1821
private HikVisionWebPlugin _hikVision = default!;
1922

2023
private string _ip = "47.121.113.151";
@@ -70,6 +73,32 @@ private async Task OnStopRealPlay()
7073
await _hikVision.StopRealPlay();
7174
}
7275

76+
private async Task OnOpenSound()
77+
{
78+
var result = await _hikVision.OpenSound();
79+
if (result)
80+
{
81+
await ToastService.Success("消息通知", "打开声音成功");
82+
}
83+
else
84+
{
85+
await ToastService.Error("消息通知", "打开声音失败");
86+
}
87+
}
88+
89+
private async Task OnCloseSound()
90+
{
91+
var result = await _hikVision.CloseSound();
92+
if (result)
93+
{
94+
await ToastService.Success("消息通知", "关闭声音成功");
95+
}
96+
else
97+
{
98+
await ToastService.Error("消息通知", "关闭声音失败");
99+
}
100+
}
101+
73102
private async Task OnInitedAsync(bool initialized)
74103
{
75104
_inited = initialized;

0 commit comments

Comments
 (0)