虎牙开放平台文档

hyExt.context.sendGift

  • 当前观众送礼
  • 需要用户授权使用
  • 引入版本 1.3.0
  • 适用终端
    • 虎牙直播主站
    • 虎牙直播APP-iOS:7.9.3
    • 虎牙直播APP-安卓:7.9.4
    • 虎牙直播PC客户端-观众侧:5.0.0.0

接口签名

declare namespace hyExt { module context { /** * 当前观众送礼 * @param params 输入参数 */ function sendGift(params: SendGiftReq): Promise<void> } /** * 发送礼物信息 */ type SendGiftReq = { /** * 发送礼物Id */ giftId: number /** * 发送礼物个数 */ giftCount: number } }

示例代码

hyExt.context .sendGift({ giftId: 1, giftCount: 1, }) .then(() => { console.log("调用hyExt.context.sendGift成功") }) .catch((err) => { console.log("调用hyExt.context.sendGift失败", err) })

相关链接