mod: 默认直播画质设置
This commit is contained in:
@ -2,7 +2,6 @@ enum LiveQuality {
|
||||
dolby,
|
||||
super4K,
|
||||
origin,
|
||||
veryHigh,
|
||||
bluRay,
|
||||
superHD,
|
||||
smooth,
|
||||
@ -37,6 +36,7 @@ extension VideoQualityDesc on LiveQuality {
|
||||
'原画',
|
||||
'蓝光',
|
||||
'超清',
|
||||
'高清',
|
||||
'流畅',
|
||||
];
|
||||
get description => _descList[index];
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import 'package:pilipala/services/service_locator.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
import '../../models/live/quality.dart';
|
||||
import 'widgets/switch_item.dart';
|
||||
|
||||
class PlaySetting extends StatefulWidget {
|
||||
@ -21,6 +22,7 @@ class PlaySetting extends StatefulWidget {
|
||||
class _PlaySettingState extends State<PlaySetting> {
|
||||
Box setting = GStrorage.setting;
|
||||
late dynamic defaultVideoQa;
|
||||
late dynamic defaultLiveQa;
|
||||
late dynamic defaultAudioQa;
|
||||
late dynamic defaultDecode;
|
||||
late int defaultFullScreenMode;
|
||||
@ -31,6 +33,8 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
super.initState();
|
||||
defaultVideoQa = setting.get(SettingBoxKey.defaultVideoQa,
|
||||
defaultValue: VideoQuality.values.last.code);
|
||||
defaultLiveQa = setting.get(SettingBoxKey.defaultLiveQa,
|
||||
defaultValue: LiveQuality.values.last.code);
|
||||
defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
||||
defaultValue: AudioQuality.values.last.code);
|
||||
defaultDecode = setting.get(SettingBoxKey.defaultDecode,
|
||||
@ -148,9 +152,9 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认画质', style: titleStyle),
|
||||
title: Text('默认视频画质', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'当前画质${VideoQualityCode.fromCode(defaultVideoQa)!.description!}',
|
||||
'当前默认画质${VideoQualityCode.fromCode(defaultVideoQa)!.description!}',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
onTap: () async {
|
||||
@ -158,7 +162,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<int>(
|
||||
title: '默认画质',
|
||||
title: '默认视频画质',
|
||||
value: defaultVideoQa,
|
||||
values: VideoQuality.values.reversed.map((e) {
|
||||
return {'title': e.description, 'value': e.code};
|
||||
@ -172,6 +176,32 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认直播画质', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'当前默认画质${LiveQualityCode.fromCode(defaultLiveQa)!.description!}',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
onTap: () async {
|
||||
int? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<int>(
|
||||
title: '默认直播画质',
|
||||
value: defaultLiveQa,
|
||||
values: LiveQuality.values.reversed.map((e) {
|
||||
return {'title': e.description, 'value': e.code};
|
||||
}).toList());
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
defaultLiveQa = result;
|
||||
setting.put(SettingBoxKey.defaultLiveQa, result);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认音质', style: titleStyle),
|
||||
|
||||
@ -77,6 +77,7 @@ class SettingBoxKey {
|
||||
autoUpgradeEnable = 'autoUpgradeEnable',
|
||||
feedBackEnable = 'feedBackEnable',
|
||||
defaultVideoQa = 'defaultVideoQa',
|
||||
defaultLiveQa = 'defaultLiveQa',
|
||||
defaultAudioQa = 'defaultAudioQa',
|
||||
autoPlayEnable = 'autoPlayEnable',
|
||||
fullScreenMode = 'fullScreenMode',
|
||||
|
||||
Reference in New Issue
Block a user