虎牙开放平台文档

hyExt.player.getVideoInfo

  • 获取当前直播间播放视频的信息
  • 仅限于播放点播视频模式
  • 引入版本 1.6.0
  • 适用终端
    • 虎牙直播主站
    • 虎牙直播APP-iOS:7.9.3
    • 虎牙直播APP-安卓:7.9.4
    • 虎牙直播PC客户端-观众侧:未实现

接口签名

declare namespace hyExt { module player { /** * 获取当前直播间播放视频的信息 */ function getVideoInfo(): Promise<VideoInfoRsp> } /** * 当前视频信息 */ type VideoInfoRsp = { /** * 点播视频信息 */ videoInfo: VideoInfo } /** * 视频信息 */ type VideoInfo = { /** * 视频时长 */ duration: number /** * 当前播放时间 */ currentTime: number /** * 是否正在播放 */ isPlaying: boolean } }

示例代码

hyExt.player .getVideoInfo() .then((res) => { const { videoInfo } = res console.log("调用hyExt.player.getVideoInfo成功", res) }) .catch((err) => { console.log("调用hyExt.player.getVideoInfo失败", err) })