Merge branch 'fix-liveHistory'
This commit is contained in:
@ -588,4 +588,8 @@ class Api {
|
||||
|
||||
///
|
||||
static const String getViewInfo = '/x/article/viewinfo';
|
||||
|
||||
/// 直播间记录
|
||||
static const String liveRoomEntry =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
|
||||
}
|
||||
|
@ -142,4 +142,15 @@ class LiveHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 直播历史记录
|
||||
static Future liveRoomEntry({required int roomId}) async {
|
||||
await Request().post(Api.liveRoomEntry, queryParameters: {
|
||||
'room_id': roomId,
|
||||
'platform': 'pc',
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
'csrf': await Request.getCsrf(),
|
||||
'visit_id': '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ class LiveRoomController extends GetxController {
|
||||
autoplay: true,
|
||||
);
|
||||
plPlayerController.isOpenDanmu.value = danmakuSwitch.value;
|
||||
heartBeat();
|
||||
}
|
||||
|
||||
Future queryLiveInfo() async {
|
||||
@ -281,8 +282,20 @@ class LiveRoomController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
// 历史记录
|
||||
void heartBeat() {
|
||||
LiveHttp.liveRoomEntry(roomId: roomId);
|
||||
}
|
||||
|
||||
String encodeToBase64(String input) {
|
||||
List<int> bytes = utf8.encode(input);
|
||||
String base64Str = base64.encode(bytes);
|
||||
return base64Str;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
heartBeat();
|
||||
plSocket?.onClose();
|
||||
super.onClose();
|
||||
}
|
||||
|
Reference in New Issue
Block a user