diff --git a/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj b/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj
index b2d513a4..8cbcfcdd 100644
--- a/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj
+++ b/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj
@@ -1,7 +1,7 @@
- 11.0.3
+ 11.0.4
bb-hikvision
@@ -12,7 +12,6 @@
-
@@ -28,4 +27,9 @@
+
+
+
+
+
diff --git a/src/components/BootstrapBlazor.HikVision/Components/HikVisionWebRtc.razor b/src/components/BootstrapBlazor.HikVision/Components/HikVisionWebRtc.razor
deleted file mode 100644
index 3e9db3ce..00000000
--- a/src/components/BootstrapBlazor.HikVision/Components/HikVisionWebRtc.razor
+++ /dev/null
@@ -1,40 +0,0 @@
-@namespace BootstrapBlazor.Components
-@inherits BootstrapComponentBase
-
-
- @if (Options is null)
- {
-
- @Localizer["OptionsMissingText"]
-
- }
- else if (_initializing)
- {
-
- @Localizer["InitializingText"]
-
- }
- else if (string.IsNullOrEmpty(_registeredUrl))
- {
-
- @if (_missingToolPath is not null)
- {
- @Localizer[_failureTextKey, _missingToolPath]
- }
- else
- {
- @Localizer[_failureTextKey]
- }
-
- }
- else if (PlayerUrl is { } url)
- {
-
- }
- else
- {
-
- @Localizer["InvalidUrlText"]
-
- }
-
diff --git a/src/components/BootstrapBlazor.HikVision/Components/HikVisionWebRtc.razor.cs b/src/components/BootstrapBlazor.HikVision/Components/HikVisionWebRtc.razor.cs
deleted file mode 100644
index 30dd00fa..00000000
--- a/src/components/BootstrapBlazor.HikVision/Components/HikVisionWebRtc.razor.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-// Website: https://www.blazor.zone or https://argozhang.github.io/
-
-using Microsoft.AspNetCore.Components;
-using Microsoft.Extensions.Localization;
-using Microsoft.Extensions.Logging;
-using System.Web;
-
-namespace BootstrapBlazor.Components;
-
-///
-/// 通过 MediaMTX 播放页面以 WebRTC 方式实时预览海康威视摄像机
-/// Displays a live WebRTC preview from a Hikvision camera using the MediaMTX player page
-/// 11.0.2
-///
-public partial class HikVisionWebRtc : IDisposable
-{
- ///
- /// 获得/设置摄像头配置。首次交互渲染时调用 IMediaMtxService 启动网关并登记摄像头,成功后显示播放器。需在服务端注册 AddMediaMtxService 并提前部署 MediaMTX 工具;组件不负责下载工具。首次渲染后更改配置不会重新登记。
- /// Gets or sets the camera options. On the first interactive render, calls IMediaMtxService to start the gateway and register the camera before displaying the player. Requires AddMediaMtxService on the server and pre-deployed MediaMTX tools; the component does not download tools. Changing the options after the first render does not re-register the camera.
- /// 11.0.3
- ///
- [Parameter]
- public MediaMtxCameraOptions? Options { get; set; }
-
- ///
- /// 获得/设置 播放器的无障碍标题
- /// Gets or sets the accessible title of the player
- /// 11.0.2
- ///
- [Parameter]
- public string Title { get; set; } = "WebRTC";
-
- ///
- /// 获得/设置静音选项,默认值为 true,此时保留原播放地址,不覆盖已有的 muted 参数。设为 false 时写入 muted=false,有声自动播放仍受浏览器策略限制。
- /// Gets or sets the mute option. Defaults to true, preserving the original player URL and any existing muted parameter. Set to false to write muted=false; audible autoplay remains subject to browser policies.
- /// 11.0.2
- ///
- [Parameter]
- public bool IsMuted { get; set; } = true;
-
- [Inject, NotNull]
- private IStringLocalizer? Localizer { get; set; }
-
- [Inject, NotNull]
- private ILogger? Log { get; set; }
-
- [Inject, NotNull]
- private IMediaMtxService? MediaMtxService { get; set; }
-
- private string? ClassString => CssBuilder.Default("ratio ratio-16x9")
- .AddClassFromAttributes(AdditionalAttributes)
- .Build();
-
- private string? StyleString => CssBuilder.Default()
- .AddStyleFromAttributes(AdditionalAttributes)
- .Build();
-
- private Uri? PlayerUrl => GetPlayerUrl();
-
- private bool _initializing = true;
-
- private string? _registeredUrl;
-
- private string _failureTextKey = "RegistrationFailedText";
-
- private string? _missingToolPath;
-
- private readonly CancellationTokenSource _initializationCancellation = new();
-
- private bool _disposed;
-
- ///
- ///
- ///
- protected override async Task OnAfterRenderAsync(bool firstRender)
- {
- await base.OnAfterRenderAsync(firstRender);
-
- if (!firstRender || _disposed)
- {
- return;
- }
-
- var cancellationToken = _initializationCancellation.Token;
- if (Options is { } options)
- {
- var started = await TryEnsureStartedAsync(cancellationToken);
- if (started)
- {
- _registeredUrl = await RegisterUrl(options, cancellationToken);
- }
- }
- _initializing = false;
- if (!_disposed)
- {
- StateHasChanged();
- }
- }
-
- private async Task TryEnsureStartedAsync(CancellationToken cancellationToken)
- {
- var started = false;
- try
- {
- await MediaMtxService.EnsureStartedAsync(cancellationToken);
- cancellationToken.ThrowIfCancellationRequested();
- started = true;
- }
- catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
- {
- // cancellation requested, do not log as an error
- }
- catch (MediaMtxToolNotFoundException ex)
- {
- Log.LogError(ex, "The MediaMTX gateway executable is missing.");
- var path = ex.FileName;
- if (!string.IsNullOrEmpty(path))
- {
- var relativePath = Path.IsPathFullyQualified(path) ? Path.GetRelativePath(AppContext.BaseDirectory, path) : path;
- _missingToolPath = Path.IsPathRooted(relativePath) ? null : relativePath;
- }
- _failureTextKey = _missingToolPath is null ? "MediaMtxToolMissingText" : "MediaMtxToolMissingPathText";
- }
- catch (Exception ex)
- {
- _failureTextKey = "GatewayStartFailedText";
- Log.LogError(ex, "Failed to start the MediaMTX gateway. Check the installation and listener ports.");
- }
- return started;
- }
-
- private async Task RegisterUrl(MediaMtxCameraOptions options, CancellationToken cancellationToken)
- {
- string? registeredUrl = null;
- try
- {
- registeredUrl = await MediaMtxService.AddOrUpdateAsync(options, cancellationToken);
- cancellationToken.ThrowIfCancellationRequested();
- }
- catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
- {
- // cancellation requested, do not log as an error
- }
- catch (Exception ex)
- {
- Log.LogError(ex, "Failed to register the camera for WebRTC preview. Check the camera path and RTSP URL.");
- }
- return registeredUrl;
- }
-
- private Uri? GetPlayerUrl()
- {
- if (!Uri.TryCreate(Options?.PlayUrl ?? _registeredUrl, UriKind.Absolute, out var url) ||
- url.Scheme is not ("http" or "https") || url.UserInfo.Length != 0)
- {
- return null;
- }
-
- if (IsMuted)
- {
- return url;
- }
-
- var query = HttpUtility.ParseQueryString(url.Query);
- query["muted"] = "false";
- return new UriBuilder(url) { Query = query.ToString() }.Uri;
- }
-
- ///
- ///
- ///
- public void Dispose()
- {
- if (_disposed)
- {
- return;
- }
-
- _disposed = true;
- _initializationCancellation.Cancel();
- _initializationCancellation.Dispose();
- GC.SuppressFinalize(this);
- }
-}
diff --git a/src/components/BootstrapBlazor.HikVision/Locales/en.json b/src/components/BootstrapBlazor.HikVision/Locales/en.json
deleted file mode 100644
index 266d76a1..00000000
--- a/src/components/BootstrapBlazor.HikVision/Locales/en.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "BootstrapBlazor.Components.HikVisionWebRtc": {
- "OptionsMissingText": "Camera configuration is missing. Unable to initialize the player.",
- "InitializingText": "Preparing preview, please wait ...",
- "MediaMtxToolMissingText": "The MediaMTX backend tool is missing. Contact an administrator to deploy it.",
- "MediaMtxToolMissingPathText": "The MediaMTX backend tool is missing: {0} (relative to the application directory). Contact an administrator to deploy it.",
- "GatewayStartFailedText": "The MediaMTX backend gateway could not start. Check the server logs.",
- "RegistrationFailedText": "Camera registration failed. Check the server logs.",
- "InvalidUrlText": "The player URL must be an absolute HTTP or HTTPS URL without credentials."
- }
-}
diff --git a/src/components/BootstrapBlazor.HikVision/Locales/zh.json b/src/components/BootstrapBlazor.HikVision/Locales/zh.json
deleted file mode 100644
index 167a1aba..00000000
--- a/src/components/BootstrapBlazor.HikVision/Locales/zh.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "BootstrapBlazor.Components.HikVisionWebRtc": {
- "OptionsMissingText": "未配置摄像头,无法初始化播放器。",
- "InitializingText": "正在准备预览,请稍后 ...",
- "MediaMtxToolMissingText": "未找到后台 MediaMTX 工具,请联系管理员部署。",
- "MediaMtxToolMissingPathText": "未找到后台 MediaMTX 工具:{0}(相对于应用目录)。请联系管理员部署。",
- "GatewayStartFailedText": "后台 MediaMTX 网关启动失败,请查看服务端日志。",
- "RegistrationFailedText": "摄像头登记失败,请查看服务端日志。",
- "InvalidUrlText": "播放地址必须是不含凭据的绝对 HTTP 或 HTTPS 地址。"
- }
-}
diff --git a/src/components/BootstrapBlazor.HikVision/README.HikVision.md b/src/components/BootstrapBlazor.HikVision/README.HikVision.md
index 75a4834f..89745124 100644
--- a/src/components/BootstrapBlazor.HikVision/README.HikVision.md
+++ b/src/components/BootstrapBlazor.HikVision/README.HikVision.md
@@ -1,56 +1,11 @@
# BootstrapBlazor.HikVision
-海康威视摄像机预览组件,包括通过 MediaMTX 播放页面预览的 `HikVisionWebRtc`,以及依赖海康 WebSDK 的 `HikVisionWebPlugin`。
+海康威视摄像机预览组件,包括依赖海康 WebSDK 的 `HikVisionWebPlugin`。
```powershell
dotnet add package BootstrapBlazor.HikVision
```
-## WebRTC 预览
-
-`HikVisionWebRtc` 使用服务端 `BootstrapBlazor.MediaMtx` 管理网关和登记摄像头,再以 iframe 展示播放页面。网关由服务管理,组件不负责下载工具或管理进程;此方案需要支持运行进程的服务端宿主,不适用于独立 WebAssembly 宿主。
-
-在服务端注册:
-
-```csharp
-builder.Services.AddBootstrapBlazor();
-builder.Services.AddMediaMtxService();
-```
-
-在已授权的 Interactive Server 页面使用:
-
-```razor
-@using BootstrapBlazor.Components
-
-
-
-@code {
- private readonly MediaMtxCameraOptions camera = new()
- {
- Path = "entrance",
- RtspUrl = "rtsp://192.0.2.1:554/Streaming/Channels/101"
- };
-}
-```
-
-组件仅在首次交互渲染时启动网关并登记摄像头,预渲染不会启动。`Options` 未设置时显示配置缺失提示;异步加载配置时,应等配置就绪后再创建组件。首次渲染后的配置更改不会重新登记,重试或更换摄像头源时需要重新创建组件实例。
-
-默认服务要求 `Path` 非空,`RtspUrl` 为不含用户信息的绝对 RTSP/RTSPS 地址。凭据使用 `UserName`、`Password` 由服务端安全配置提供,不要写入地址、日志或浏览器存储。登记成功只表示网关接受配置,不代表摄像机在线或已有首帧。相同路径的更新或删除会影响所有观看者。
-
-`PlayUrl` 为 `null` 时由服务生成播放地址,空字符串无效;自定义地址必须是不含凭据的绝对 HTTP/HTTPS 地址。`IsMuted` 默认保留原地址及其 `muted` 参数;设为 `false` 时写入 `muted=false`,有声自动播放仍受浏览器策略限制。`Title` 默认为 `WebRTC`,用作 iframe 无障碍标题。
-
-首次使用前需单独部署 MediaMTX 原生工具,例如使用独立的 `BootstrapBlazor.MediaMtx.Cli`:
-
-```powershell
-dotnet tool install -g BootstrapBlazor.MediaMtx.Cli --prerelease
-bb-mediamtx --download
-bb-mediamtx --copy --output .\publish
-```
-
-`--download` 未指定 `--rid` 时准备本机平台的缓存,指定具体 RID 时只准备该平台,指定 `--rid all` 时准备全部支持平台。`--copy` 从缓存复制到指定目录的 `mediamtx-tools\`,未指定 RID 时复制本机平台;跨平台复制需指定目标 `--rid`。组合 `--download --copy --rid all` 时会准备全部平台缓存,但只复制本机平台;`--copy --rid all` 无效。CLI 失败时输出警告,但仍以成功状态退出,应检查提示和目标文件。服务不会自动下载工具;工具缺失、网关启动失败和摄像头登记失败分别显示对应提示。
-
-默认网关的 HTTP、Control API 和 ICE 仅监听回环地址。远程播放需要可达的信令和媒体路径、HTTPS 与鉴权;仅设置 `WebRtcPublicUrl` 或 `PlayUrl` 不会改变 ICE 地址。工具部署、配置及安全限制详见 `BootstrapBlazor.MediaMtx` 包文档。
-
## WebSDK 插件
`HikVisionWebPlugin` 使用浏览器端海康 WebSDK,需先等待 `OnInitedAsync` 返回初始化状态,再调用 `Login`。登录成功后通过 `OnGetChannelsAsync` 接收通道信息;登录失败可检查 `LoginErrorCode` 和 `LoginErrorMessage`。
diff --git a/src/components/BootstrapBlazor.HikVision/skills/bb-hikvision/SKILL.md b/src/components/BootstrapBlazor.HikVision/skills/bb-hikvision/SKILL.md
index c5bd2093..583b4878 100644
--- a/src/components/BootstrapBlazor.HikVision/skills/bb-hikvision/SKILL.md
+++ b/src/components/BootstrapBlazor.HikVision/skills/bb-hikvision/SKILL.md
@@ -5,58 +5,7 @@ description: 随 BootstrapBlazor.HikVision NuGet 包提供的 API 参考。需
# HikVision 使用参考
-先读 [references/llms.txt](references/llms.txt),再查 [HikVisionWebPlugin](references/components/HikVisionWebPlugin.txt) 或 [HikVisionWebRtc](references/components/HikVisionWebRtc.txt)。以实际引用版本和源码为准,不编造参数。
-
-## WebRTC 预览
-
-HikVision 引用 `BootstrapBlazor.MediaMtx`。在服务端注册:
-
-```csharp
-builder.Services.AddBootstrapBlazor();
-builder.Services.AddMediaMtxService();
-```
-
-在已授权的 Interactive Server 页面直接渲染:
-
-```razor
-
-
-@code {
- private readonly MediaMtxCameraOptions camera = new()
- {
- Path = "entrance",
- RtspUrl = "rtsp://192.0.2.1:554/Streaming/Channels/101"
- };
-}
-```
-
-示例源未配置认证;需要认证时从服务器安全配置提供 `UserName`、`Password`。WebRTC 网关需要可运行进程的服务端宿主,不支持独立 WebAssembly。
-
-### 初始化与展示
-
-- `Options` 类型为 `MediaMtxCameraOptions`。组件首次交互渲染时依次调用 `EnsureStartedAsync()`、`AddOrUpdateAsync(Options)`,成功后显示 iframe;预渲染不启动网关。
-- 初始化中显示黑底 16:9 占位;未配置、工具缺失、网关启动失败和摄像头登记失败显示本地化提示,异常记录到服务端日志。登记成功不代表已有视频首帧。
-- 首次交互渲染后修改 `Options` 不会重新登记;异步配置应就绪后再创建组件。重试或更改摄像头配置时重新创建实例,可使用 `@key`。
-- 即使指定 `Options.PlayUrl`,也必须完成网关启动与摄像头登记。组件不下载工具、不直接管理进程或调用 Control API。
-- 销毁组件会取消未完成的初始化,不删除已登记路径、不停止就绪网关;取消不保证撤销已提交的登记。
-
-| 参数 | 行为 |
-| --- | --- |
-| `Options` | 摄像头路径、RTSP 源和凭据;`PlayUrl` 可覆盖生成的播放地址。 |
-| `Title` | 默认 `WebRTC`,作为 iframe 无障碍标题。 |
-| `IsMuted` | 默认 `true`,保留原 URL 及已有 `muted` 参数;设为 `false` 写入 `muted=false`,有声自动播放仍受浏览器限制。 |
-
-容器支持附加 `class`、`style`。iframe 允许自动播放、全屏并设置 `referrerpolicy="no-referrer"`;HTTPS 页面应使用 HTTPS 播放地址,代理须允许 BB 页面嵌入。
-
-### 网关与播放配置
-
-- 提前用 `bb-mediamtx --download --copy --output <应用目录>` 部署原生工具,跨平台加 `--rid`。工具默认在应用目录 `mediamtx-tools\`,缺失时组件提示错误,不自动安装。
-- 自管模式必须通过安全配置源提供 `MediaMtxOptions:ApiPassword`;API 密码不是摄像头密码或播放密码。详细部署和服务规则见 MediaMtx 包的 `bb-mediamtx` skill 与 README。
-- `RtspUrl` 必须是无用户信息的绝对 RTSP/RTSPS 地址。`Path` 标识共享摄像头路径,不同源使用不同路径;更新同一路径会影响其他观看者。
-- `PlayUrl` 留为 `null` 时,使用 `WebRtcPublicUrl` 或默认 `http://127.0.0.1:/` 加 `Path/`。空字符串无效;单路 URL 覆盖不更改监听、来源或 ICE。
-- 自管网关公网部署需设置 `WebRtcPublicUrl`、`WebRtcConfigPath`,自行部署 YAML 片段并配置复制。HTTPS/nginx 负责播放页和信令,媒体另需可达的 UDP ICE 地址与端口;仅替换播放 URL 不够。
-- 同一用户的宿主可复用网关;指纹变化且目标进程路径相同时会自动重启,打断所有共享观看者。宿主退出后网关继续运行,动态路径在网关重启后需重新登记。
-- 网关不自动转码,视频、音频编码须兼容浏览器。音频可使用 G.711 μ-law(PCMU)或 A-law(PCMA);默认静音,需要时取消静音。
+先读 [references/llms.txt](references/llms.txt),再查 [HikVisionWebPlugin](references/components/HikVisionWebPlugin.txt)。以实际引用版本和源码为准,不编造参数。
## WebSDK 插件