# 视频号(选接)

# 打开视频号主页

# 接口说明

用于在游戏内打开视频号主页。

sdkInstance.openChannelsUserProfile(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.21.2,调用 sdkInstance.openChannelsUserProfile(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
finderUserName string -- 视频号ID,以“sph”开头的ID,可在视频号助手获取
success function -- 接口调用成功的回调函数
fail function -- 接口调用失败的回调函数
complete function -- 接口调用完成的回调函数,成功或失败均会调用

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.21.2,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.openChannelsUserProfile({
  finderUserName: "sphxxxxxxxxxx",
  success: function(response) {
    console.log(response);
  },
  fail: function(error) {
    console.log(error);
  },
  complete: function(result) {
    // do something here...
  }
});

# 打开视频号活动页

# 接口说明

用于在游戏内打开视频号活动页。

sdkInstance.openChannelsEvent(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.21.0,调用 sdkInstance.openChannelsEvent(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
finderUserName string -- 视频号ID,以“sph”开头的ID,可在视频号助手获取
eventId string -- 活动ID
success function -- 接口调用成功的回调函数
fail function -- 接口调用失败的回调函数
complete function -- 接口调用完成的回调函数,成功或失败均会调用

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.21.0,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.openChannelsEvent({
  finderUserName: "sphxxxxxxxxxx",
  eventId: "xxxxxxxxxx",
  success: function(response) {
    console.log(response);
  },
  fail: function(error) {
    console.log(error);
  },
  complete: function(result) {
    // do something here...
  }
});

# 打开视频号视频

# 接口说明

用于在游戏内打开视频号视频。

sdkInstance.openChannelsActivity(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.19.2,调用 sdkInstance.openChannelsActivity(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
finderUserName string -- 视频号ID,以“sph”开头的ID,可在视频号助手获取
feedId string -- 视频feedId
success function -- 接口调用成功的回调函数
fail function -- 接口调用失败的回调函数
complete function -- 接口调用完成的回调函数,成功或失败均会调用

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.19.2,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.openChannelsActivity({
  finderUserName: "sphxxxxxxxxxx",
  feedId: "xxxxxxxxxx",
  success: function(response) {
    console.log(response);
  },
  fail: function(error) {
    console.log(error);
  },
  complete: function(result) {
    // do something here...
  }
});

# 打开视频号直播

# 接口说明

用于在游戏内打开视频号直播。

sdkInstance.openChannelsLive(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.15.0,调用 sdkInstance.openChannelsLive(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
finderUserName string -- 视频号ID,以“sph”开头的ID,可在视频号助手获取
feedId string -- 直播feedId,通过 getChannelsLiveInfo 接口获取(基础库 2.19.2 之前的版本需要填写)
noticeId string -- 直播nonceId,通过 getChannelsLiveInfo 接口获取(基础库 2.19.2 之前的版本需要填写)
success function -- 接口调用成功的回调函数
fail function -- 接口调用失败的回调函数
complete function -- 接口调用完成的回调函数,成功或失败均会调用

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.15.0,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.openChannelsLive({
  finderUserName: "sphxxxxxxxxxx",
  feedId: "xxxxxxxxxx",
  noticeId: "xxxxxxxxxx",
  success: function(response) {
    console.log(response);
  },
  fail: function(error) {
    console.log(error);
  },
  complete: function(result) {
    // do something here...
  }
});

# 预约视频号直播

# 接口说明

用于在小游戏内预约视频号直播。

sdkInstance.reserveChannelsLive(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.19.0,调用 sdkInstance.reserveChannelsLive(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
noticeId string -- 预告ID,通过 getChannelsLiveNoticeInfo 接口获取

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.19.0,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.reserveChannelsLive({
  noticeId: "xxxxxxxxxx"
});

# 视频号直播预告信息

# 接口说明

用于在游戏内获取视频号直播预告信息。

sdkInstance.getChannelsLiveNoticeInfo(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.19.0,调用 sdkInstance.getChannelsLiveNoticeInfo(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
finderUserName string -- 视频号ID,以“sph”开头的ID,可在视频号助手获取
success function -- 接口调用成功的回调函数
fail function -- 接口调用失败的回调函数
complete function -- 接口调用完成的回调函数,成功或失败均会调用

# 返回值说明

WARNING

返回值格式:JSON 格式。

选项 类型 说明
code number 响应状态码,为 0 时表示获取成功,其他非 0 状态码均表示获取失败
data object 获取成功时返回视频号直播预告信息,失败时返回 null
    data.noticeId string 预告ID
    data.status number 预告状态,0 可用、1 取消、2 已用
    data.startTime string 开始时间
    data.headUrl string 直播封面
    data.nickname string 视频号昵称
    data.reservable boolean 是否可预约
    data.otherInfos object[] 除最近的一条预告信息外,其他的预告信息列表(注意:每次最多返回按时间戳增序排列的15个预告信息,其中时间最近的那个预告信息会在接口其他的返回参数中展示,其余的预告信息会在该字段中展示)
message string 获取成功或失败时的相应描述信息

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.19.0,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.getChannelsLiveNoticeInfo({
  finderUserName: "sphxxxxxxxxxx",
  success: function(response) {
    console.log(response);
  },
  fail: function(error) {
    console.log(error);
  },
  complete: function(result) {
    // do something here...
  }
});

# 视频号直播信息

# 接口说明

用于在游戏内获取视频号直播信息。

sdkInstance.getChannelsLiveInfo(options);

最低基础库版本要求

若用户客户端基础库版本低于 2.15.0,调用 sdkInstance.getChannelsLiveInfo(options) 接口将中断用户当前操作并弹出升级提示,不会报错!

# 参数说明

参数说明如下表所示:

选项 类型 必填 默认值 说明
finderUserName string -- 视频号ID,以“sph”开头的ID,可在视频号助手获取
startTime number -- 起始时间,筛选指定时间段的直播;若设置了 endTime,未设置 startTime,则 startTime 默认为 0
endTime number -- 结束时间,筛选指定时间段的直播;若设置了 startTime,未设置 endTime,则 endTime 默认取当前时间
success function -- 接口调用成功的回调函数
fail function -- 接口调用失败的回调函数
complete function -- 接口调用完成的回调函数,成功或失败均会调用

# 返回值说明

WARNING

返回值格式:JSON 格式。

选项 类型 说明
code number 响应状态码,为 0 时表示获取成功,其他非 0 状态码均表示获取失败
data object 获取成功时返回视频号直播信息,失败时返回 null
    data.feedId string 直播feedId
    data.noticeId string 直播nonceId
    data.description string 直播主题
    data.status number 直播状态,2 直播中、3 直播结束
    data.replayStatus number 直播回放状态,0 未生成、1 已生成、3 生成中、6 已过期
    data.headUrl string 视频号头像
    data.nickname string 视频号昵称
    data.otherInfos object[] 除最近的一条直播外,其他的直播列表(注意:每次最多返回按时间戳增序排列的15个直播信息,其中时间最近的那个直播会在接口其他的返回参数中展示,其余的直播会在该字段中展示)
message string 获取成功或失败时的相应描述信息

# 示例代码

注:示例代码中的参数或选项均为演示数据,仅供参考,谢谢!

// 若用户客户端基础库版本低于 2.15.0,调用此接口将中断用户当前操作并弹出升级提示,不会报错!
sdkInstance.getChannelsLiveInfo({
  finderUserName: "sphxxxxxxxxxx",
  success: function(response) {
    console.log(response);
  },
  fail: function(error) {
    console.log(error);
  },
  complete: function(result) {
    // do something here...
  }
});
Last Updated: 2024/11/10 18:46:15