Repository navigation
refactor(HikVision): remove generic MediaMTX WebRTC player #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| <HikVisionWebRtc Options="@camera" Title="入口摄像头" /> | ||
|
|
||
| @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\<RID>`,缺失时组件提示错误,不自动安装。 | ||
| - 自管模式必须通过安全配置源提供 `MediaMtxOptions:ApiPassword`;API 密码不是摄像头密码或播放密码。详细部署和服务规则见 MediaMtx 包的 `bb-mediamtx` skill 与 README。 | ||
| - `RtspUrl` 必须是无用户信息的绝对 RTSP/RTSPS 地址。`Path` 标识共享摄像头路径,不同源使用不同路径;更新同一路径会影响其他观看者。 | ||
| - `PlayUrl` 留为 `null` 时,使用 `WebRtcPublicUrl` 或默认 `http://127.0.0.1:<WebRtcPort>/` 加 `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)。以实际引用版本和源码为准,不编造参数。 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Low · Stale skill description The issue asks to keep the package documentation focused on HikVision-specific WebSDK components. The skill description still says it covers WebRTC preview APIs, although the updated reference directs users only to HikVisionWebPlugin. Prompt for AI agentsIn `src/components/BootstrapBlazor.HikVision/skills/bb-hikvision/SKILL.md` at line 8:
**Stale skill description**
The issue asks to keep the package documentation focused on HikVision-specific WebSDK components. The skill description still says it covers WebRTC preview APIs, although the updated reference directs users only to HikVisionWebPlugin.From #1405: Keep the package focused on HikVision-specific WebSDK components and documentation. |
||
|
|
||
| ## WebSDK 插件 | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High · HikVision examples fail to compile
When users follow the MediaMTX example or upgrade an application using
HikVisionWebRtcto 11.0.4,HikVisionWebRtcis no longer included, so the documented Razor element and existing calls fail compilation; shipping that removal in 11.0.4 also breaks callers without a major-version signal.Keep
HikVisionWebRtcavailable in this release, or defer its removal to a major release after updating the integration guidance.Also at
src/components/BootstrapBlazor.HikVision/skills/bb-hikvision/SKILL.md:8,src/components/BootstrapBlazor.HikVision/README.HikVision.md:25.Prompt for AI agents
From
AGENTS.mdL23:From
docs/agents/component-checklist.mdL5: