mod: 直播页面内容更新

This commit is contained in:
guozhigq
2024-02-07 22:23:29 +08:00
parent 4a5f4ca2ca
commit d258474a5a
9 changed files with 279 additions and 92 deletions

View File

@ -4,6 +4,8 @@ import 'package:pilipala/http/live.dart';
import 'package:pilipala/models/live/room_info.dart';
import 'package:pilipala/plugin/pl_player/index.dart';
import '../../models/live/room_info_h5.dart';
class LiveRoomController extends GetxController {
String cover = '';
late int roomId;
@ -21,6 +23,7 @@ class LiveRoomController extends GetxController {
// controlsStyle: ControlsStyle.live,
// enabledButtons: const EnabledButtons(pip: true),
// );
Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs;
@override
void onInit() {
@ -37,10 +40,11 @@ class LiveRoomController extends GetxController {
}
}
queryLiveInfo();
queryLiveInfoH5();
}
playerInit(source) {
plPlayerController.setDataSource(
playerInit(source) async {
await plPlayerController.setDataSource(
DataSource(
videoSource: source,
audioSource: null,
@ -66,7 +70,8 @@ class LiveRoomController extends GetxController {
String videoUrl = (item.urlInfo?.first.host)! +
item.baseUrl! +
item.urlInfo!.first.extra!;
playerInit(videoUrl);
await playerInit(videoUrl);
return res;
}
}
@ -80,4 +85,12 @@ class LiveRoomController extends GetxController {
volumeOff.value = true;
}
}
Future queryLiveInfoH5() async {
var res = await LiveHttp.liveRoomInfoH5(roomId: roomId);
if (res['status']) {
roomInfoH5.value = res['data'];
}
return res;
}
}