Skip to content

WhepPlay

whepwright 是一个基于浏览器的 WHEP 播放测试工具。它通过 Playwright 启动真实浏览器(Chromium、Firefox 或 WebKit),订阅 WHEP 端点,并验证浏览器 WebRTC 协议栈能否正常接收和渲染视频流。

构建

bash
# 需要 Node.js 和 Playwright
cargo build --bin whepwright --features whepwright

用法

使用 Chromium 播放 WHEP 端点:

bash
whepwright -w http://localhost:7777/whep/live

使用 Firefox,并设置 60 秒超时:

bash
whepwright -w http://localhost:7777/whep/live --browser firefox --timeout 60

以可视化浏览器窗口运行,方便调试:

bash
whepwright -w http://localhost:7777/whep/live --headless=false

使用本机安装的 Google Chrome 播放 H.265。注意 headless Chromium 不支持 H.265 WebRTC,所以必须同时开启可视化窗口:

bash
whepwright -w http://localhost:7777/whep/live \
          --browser chromium --channel chrome --headless=false

选项

选项默认值说明
-w, --whep必填WHEP 端点 URL
-t, --tokenWHIP/WHEP 认证使用的 Bearer token
--browserchromium浏览器类型:chromiumfirefoxwebkit
--channel浏览器 channel,例如 chromemsedge(仅 Chromium)
--headlesstrue是否以无头模式运行浏览器(truefalse
--outputhuman输出格式:humanjson
--timeout30整体超时时间(秒)

退出码

  • 0:播放成功(WHEP 已连接且视频已渲染)。
  • 1:播放失败或发生错误。

Released under the MPL-2.0 License.