文档

查询互动消息详情

更新时间:

本文主要介绍如何使用消息原子能力获取互动消息详情。

说明

  • 获取到的数据结构及说明如下:

    • likeCount,点赞数。

    • mute,请求用户是否被禁言。

    • muteAll,是否受到全体禁言的影响(true表示被全体禁言了,目前仅有普通观众会被全体禁言)。

    • sendCommentMaxLength,发送弹幕的最大长度,需要端上做限制。

    • sendCommentInterval,发送弹幕的间隔时间(单位: ms),需要端上做限制。

API使用示例

iOS:

//iOS目前只会透出点赞总数、评论总数及禁言相关内容
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.chat getCurrentChatInfoOnSuccess:^(NSDictionary * _Nonnull info) {
  NSLog(@"点赞总数%d", [[info valueForKey:@"total_like"] intValue]);
  NSLog(@"评论总数%d", [[info valueForKey:@"total_comment"] intValue]);
  NSLog(@"是否全体禁言%d", [[info valueForKey:@"ban_all"] boolValue]);
  NSLog(@"是否当前用户被禁言%d", [[info valueForKey:@"ban"] boolValue]);
} onFailure:^(NSString * _Nonnull errMessage) {
  NSLog(@"查询出错")
}];

Android:

chatService.getChatDetail(new Callback<GetTopicInfoRsp>() {
    @Override
    public void onSuccess(GetTopicInfoRsp data) {
        String message = "查询结果" +
                "\n点赞数: " + data.likeCount +
                "\n评论数: " + data.commentCount +
                "\n禁言: " + data.mute +
                "\n全员禁言: " + data.muteAll;
        Logger.i(TAG, message);
    }

    @Override
    public void onError(String errorMsg) {
        Logger.e(TAG, "查询失败, " + errorMsg);
    }
});

Web:

chatService.getChatDetail().then((detail) => {})

Windows:

auto room_ptr = alibaba::meta_space::MetaSpace::GetInstance()->GetRoomInstance(room_id);
std::shared_ptr<IChat> chat_plugin = std::dynamic_pointer_cast<IChat>(room_ptr->GetPlugin(PluginChat));
chat_plugin->GetTopicInfo([](const alibaba::chat::GetTopicInfoRsp& rsp) {
}, [](const alibaba::dps::DPSError& err) {
});
  • 本页导读 (1)
文档反馈