mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 09:37:02 +08:00
check live playurl
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -76,7 +76,11 @@ abstract final class LiveHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future liveRoomInfo({roomId, qn, bool onlyAudio = false}) async {
|
||||
static Future<LoadingState<RoomPlayInfoData>> liveRoomInfo({
|
||||
roomId,
|
||||
qn,
|
||||
bool onlyAudio = false,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.liveRoomInfo,
|
||||
queryParameters: {
|
||||
@@ -93,12 +97,9 @@ abstract final class LiveHttp {
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': RoomPlayInfoData.fromJson(res.data['data']),
|
||||
};
|
||||
return Success(RoomPlayInfoData.fromJson(res.data['data']));
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import 'package:PiliPlus/models_new/live/live_danmaku/live_emote.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_dm_info/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_room_info_h5/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_room_play_info/codec.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_room_play_info/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_superchat/item.dart';
|
||||
import 'package:PiliPlus/pages/live_room/send_danmaku/view.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
@@ -135,12 +134,16 @@ class LiveRoomController extends GetxController {
|
||||
qn: currentQn,
|
||||
onlyAudio: plPlayerController.onlyPlayAudio.value,
|
||||
);
|
||||
if (res['status']) {
|
||||
RoomPlayInfoData data = res['data'];
|
||||
if (res.isSuccess) {
|
||||
final data = res.data;
|
||||
if (data.liveStatus != 1) {
|
||||
_showDialog('当前直播间未开播');
|
||||
return;
|
||||
}
|
||||
if (data.playurlInfo?.playurl == null) {
|
||||
_showDialog('无法获取播放地址');
|
||||
return;
|
||||
}
|
||||
if (data.roomId != null) {
|
||||
roomId = data.roomId!;
|
||||
}
|
||||
@@ -163,6 +166,8 @@ class LiveRoomController extends GetxController {
|
||||
videoUrl = VideoUtils.getCdnUrl(item);
|
||||
await playerInit();
|
||||
isLoaded.value = true;
|
||||
} else {
|
||||
_showDialog(res.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user