feat: prefetch live room danmu (#4)

This commit is contained in:
PuerNya
2024-11-19 00:24:56 +08:00
committed by GitHub
parent a0c54ced96
commit 19377e8e70
4 changed files with 52 additions and 9 deletions

View File

@@ -289,6 +289,11 @@ class Api {
static const String liveRoomInfoH5 =
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getH5InfoByRoom';
// 直播间弹幕预获取
// roomid roomId
static const String liveRoomDmPrefetch =
'${HttpString.liveBaseUrl}/xlive/web-room/v1/dM/gethistory';
//直播间弹幕密钥获取接口
static const String liveRoomDmToken =
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getDanmuInfo';

View File

@@ -111,6 +111,21 @@ class LiveHttp {
}
}
static Future liveRoomDanmaPrefetch({roomId}) async {
var res = await Request().get(Api.liveRoomDmPrefetch, data: {
'roomid': roomId,
});
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']['room']};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
static Future liveRoomGetDanmakuToken({roomId}) async {
var res = await Request().get(Api.liveRoomDmToken, data: {
'id': roomId,