虎牙开放平台文档

hyExt.reg.onHumanContourDetection

  • 监听当前直播间人体轮廓点检测消息
  • 双面镜、两屏、三屏的时候提示接口不支持
  • 引入版本 1.8.0
  • 适用终端
    • 虎牙直播助手-iOS:未实现
    • 虎牙直播助手-安卓:未实现
    • 虎牙直播PC客户端-主播侧:4.16.1.0

接口签名

declare namespace hyExt { module reg { /** * 监听当前直播间人体轮廓点检测消息 * @param param 输入参数 */ function onHumanContourDetection( param: HumanContourDetectionReq ): Promise<void> } /** * 人体轮廓识别消息参数 */ type HumanContourDetectionReq = { /** * 画布信息 */ callback: HumanCallback } /** * 画布信息 * @param recognition 人体轮廓识别消息 */ type HumanCallback = (recognition: HumanInfo) => void /** * 人体轮廓识别消息 */ type HumanInfo = { /** * 画布信息 */ canvas: CanvasInfo /** * 轮廓点 */ contourPoints: ContourPointInfo[] /** * 轮廓数,值域为正整数 */ contourCount: number } /** * 画布信息 */ type CanvasInfo = { /** * 画布宽度 */ width: number /** * 画布高度 */ height: number } /** * 轮廓点信息 */ type ContourPointInfo = { /** * 横坐标(值域 [0, 画布宽],单位是像素) */ x: number /** * 纵坐标(值域 [0, 画布高],单位是像素) */ y: number } }

示例代码

hyExt.reg .onHumanContourDetection({ callback: (recognition) => { const { canvas, contourPoints, contourCount } = recognition console.log("回调触发", recognition) }, }) .then(() => { console.log("调用hyExt.reg.onHumanContourDetection成功") }) .catch((err) => { console.log("调用hyExt.reg.onHumanContourDetection失败", err) })