feat: 直播弹幕发送

This commit is contained in:
guozhigq
2024-08-22 20:24:21 +08:00
parent b3e55be43c
commit f7ff6d7aa8
3 changed files with 142 additions and 75 deletions

View File

@ -84,4 +84,37 @@ class LiveHttp {
};
}
}
// 发送弹幕
static Future sendDanmaku({roomId, msg}) async {
var res = await Request().post(Api.sendLiveMsg, queryParameters: {
'bubble': 0,
'msg': msg,
'color': 16777215, // 颜色
'mode': 1, // 模式
'room_type': 0,
'jumpfrom': 71001, // 直播间来源
'reply_mid': 0,
'reply_attr': 0,
'replay_dmid': '',
'statistics': {"appId": 100, "platform": 5},
'fontsize': 25, // 字体大小
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
'roomid': roomId,
'csrf': await Request.getCsrf(),
'csrf_token': await Request.getCsrf(),
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
}