mod: 默认直播画质设置

This commit is contained in:
guozhigq
2024-03-13 23:12:34 +08:00
parent 98aaca286b
commit da2bbeedff
5 changed files with 62 additions and 31 deletions

View File

@ -27,7 +27,8 @@ class LiveRoomController extends GetxController {
@override
void onInit() {
super.onInit();
currentQn = 10000;
currentQn = setting.get(SettingBoxKey.defaultLiveQa,
defaultValue: LiveQuality.values.last.code);
roomId = int.parse(Get.parameters['roomid']!);
if (Get.arguments != null) {
liveItem = Get.arguments['liveItem'];
@ -62,7 +63,6 @@ class LiveRoomController extends GetxController {
}
Future queryLiveInfo() async {
/// TODO 默认获取预设质量的直播资源
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
if (res['status']) {
List<CodecItem> codec =

View File

@ -85,6 +85,30 @@ class _BottomControlState extends State<BottomControl> {
// ),
// ),
// const SizedBox(width: 4),
SizedBox(
width: 30,
child: PopupMenuButton<int>(
padding: EdgeInsets.zero,
onSelected: (value) {
widget.liveRoomCtr!.changeQn(value);
},
child: Obx(
() => Text(
widget.liveRoomCtr!.currentQnDesc.value,
style: const TextStyle(color: Colors.white, fontSize: 13),
),
),
itemBuilder: (BuildContext context) {
return widget.liveRoomCtr!.acceptQnList.map((e) {
return PopupMenuItem<int>(
value: e['code'],
child: Text(e['desc']),
);
}).toList();
},
),
),
const SizedBox(width: 10),
if (Platform.isAndroid) ...[
SizedBox(
width: 34,
@ -112,32 +136,8 @@ class _BottomControlState extends State<BottomControl> {
),
),
),
const SizedBox(width: 4),
const SizedBox(width: 10),
],
SizedBox(
width: 30,
child: PopupMenuButton<int>(
padding: EdgeInsets.zero,
onSelected: (value) {
widget.liveRoomCtr!.changeQn(value);
},
child: Obx(
() => Text(
widget.liveRoomCtr!.currentQnDesc.value,
style: const TextStyle(color: Colors.white, fontSize: 13),
),
),
itemBuilder: (BuildContext context) {
return widget.liveRoomCtr!.acceptQnList.map((e) {
return PopupMenuItem<int>(
value: e['code'],
child: Text(e['desc']),
);
}).toList();
},
),
),
const SizedBox(width: 10),
ComBtn(
icon: const Icon(
Icons.fullscreen,