mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 08:36:17 +08:00
opt live room
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -103,17 +103,20 @@ class LiveHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future liveRoomInfo({roomId, qn}) async {
|
static Future liveRoomInfo({roomId, qn}) async {
|
||||||
var res = await Request().get(Api.liveRoomInfo, queryParameters: {
|
var res = await Request().get(
|
||||||
'room_id': roomId,
|
Api.liveRoomInfo,
|
||||||
'protocol': '0, 1',
|
queryParameters: {
|
||||||
'format': '0, 1, 2',
|
'room_id': roomId,
|
||||||
'codec': '0, 1',
|
'protocol': '0, 1',
|
||||||
'qn': qn,
|
'format': '0, 1, 2',
|
||||||
'platform': 'web',
|
'codec': '0, 1',
|
||||||
'ptype': 8,
|
'qn': qn,
|
||||||
'dolby': 5,
|
'platform': 'web',
|
||||||
'panorama': 1,
|
'ptype': 8,
|
||||||
});
|
'dolby': 5,
|
||||||
|
'panorama': 1,
|
||||||
|
},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': RoomInfoModel.fromJson(res.data['data'])};
|
return {'status': true, 'data': RoomInfoModel.fromJson(res.data['data'])};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ class RoomInfoModel {
|
|||||||
roomId = json['room_id'];
|
roomId = json['room_id'];
|
||||||
liveStatus = json['live_status'];
|
liveStatus = json['live_status'];
|
||||||
liveTime = json['live_time'];
|
liveTime = json['live_time'];
|
||||||
playurlInfo = PlayurlInfo.fromJson(json['playurl_info']);
|
playurlInfo = json['playurl_info'] == null
|
||||||
|
? null
|
||||||
|
: PlayurlInfo.fromJson(json['playurl_info']);
|
||||||
isPortrait = json['is_portrait'];
|
isPortrait = json['is_portrait'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,7 +30,8 @@ class PlayurlInfo {
|
|||||||
Playurl? playurl;
|
Playurl? playurl;
|
||||||
|
|
||||||
PlayurlInfo.fromJson(Map<String, dynamic> json) {
|
PlayurlInfo.fromJson(Map<String, dynamic> json) {
|
||||||
playurl = Playurl.fromJson(json['playurl']);
|
playurl =
|
||||||
|
json['playurl'] == null ? null : Playurl.fromJson(json['playurl']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,29 @@ class LiveRoomController extends GetxController {
|
|||||||
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
|
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
RoomInfoModel data = res['data'];
|
RoomInfoModel data = res['data'];
|
||||||
|
if (data.liveStatus != 1) {
|
||||||
|
Get.dialog(
|
||||||
|
AlertDialog(
|
||||||
|
title: const Text('当前直播间未开播'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: Get.back,
|
||||||
|
child: Text(
|
||||||
|
'关闭',
|
||||||
|
style: TextStyle(color: Get.theme.colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Get
|
||||||
|
..back()
|
||||||
|
..back(),
|
||||||
|
child: const Text('退出'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
isPortrait.value = data.isPortrait ?? false;
|
isPortrait.value = data.isPortrait ?? false;
|
||||||
List<CodecItem> codec =
|
List<CodecItem> codec =
|
||||||
data.playurlInfo!.playurl!.stream!.first.format!.first.codec!;
|
data.playurlInfo!.playurl!.stream!.first.format!.first.codec!;
|
||||||
|
|||||||
Reference in New Issue
Block a user