mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: live qa
Closes #464 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -2,7 +2,6 @@ enum LiveQuality {
|
|||||||
dolby,
|
dolby,
|
||||||
super4K,
|
super4K,
|
||||||
origin,
|
origin,
|
||||||
veryHigh,
|
|
||||||
bluRay,
|
bluRay,
|
||||||
superHD,
|
superHD,
|
||||||
smooth,
|
smooth,
|
||||||
@@ -37,6 +36,7 @@ extension VideoQualityDesc on LiveQuality {
|
|||||||
'原画',
|
'原画',
|
||||||
'蓝光',
|
'蓝光',
|
||||||
'超清',
|
'超清',
|
||||||
|
'高清',
|
||||||
'流畅',
|
'流畅',
|
||||||
];
|
];
|
||||||
get description => _descList[index];
|
get description => _descList[index];
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/tcp/live.dart';
|
|||||||
import 'package:PiliPlus/utils/danmaku.dart';
|
import 'package:PiliPlus/utils/danmaku.dart';
|
||||||
import 'package:PiliPlus/utils/storage.dart';
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||||
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -32,7 +33,7 @@ class LiveRoomController extends GetxController {
|
|||||||
DanmakuController? controller;
|
DanmakuController? controller;
|
||||||
bool showDanmaku = true;
|
bool showDanmaku = true;
|
||||||
|
|
||||||
late int currentQn = 10000;
|
int? currentQn;
|
||||||
late List<Map> acceptQnList = <Map>[];
|
late List<Map> acceptQnList = <Map>[];
|
||||||
RxString currentQnDesc = ''.obs;
|
RxString currentQnDesc = ''.obs;
|
||||||
|
|
||||||
@@ -64,6 +65,13 @@ class LiveRoomController extends GetxController {
|
|||||||
final RxBool isPortrait = false.obs;
|
final RxBool isPortrait = false.obs;
|
||||||
|
|
||||||
Future queryLiveInfo() async {
|
Future queryLiveInfo() async {
|
||||||
|
if (currentQn == null) {
|
||||||
|
await Connectivity().checkConnectivity().then((res) {
|
||||||
|
currentQn = res.contains(ConnectivityResult.wifi)
|
||||||
|
? GStorage.liveQuality
|
||||||
|
: GStorage.liveQualityCellular;
|
||||||
|
});
|
||||||
|
}
|
||||||
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
|
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
isPortrait.value = res['data'].isPortrait ?? false;
|
isPortrait.value = res['data'].isPortrait ?? false;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import 'package:PiliPlus/models/common/super_resolution_type.dart';
|
|||||||
import 'package:PiliPlus/models/common/theme_type.dart';
|
import 'package:PiliPlus/models/common/theme_type.dart';
|
||||||
import 'package:PiliPlus/models/common/up_panel_position.dart';
|
import 'package:PiliPlus/models/common/up_panel_position.dart';
|
||||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||||
|
import 'package:PiliPlus/models/live/quality.dart';
|
||||||
import 'package:PiliPlus/models/video/play/CDN.dart';
|
import 'package:PiliPlus/models/video/play/CDN.dart';
|
||||||
import 'package:PiliPlus/models/video/play/quality.dart';
|
import 'package:PiliPlus/models/video/play/quality.dart';
|
||||||
import 'package:PiliPlus/models/video/play/subtitle.dart';
|
import 'package:PiliPlus/models/video/play/subtitle.dart';
|
||||||
@@ -1098,6 +1099,57 @@ List<SettingsModel> get videoSettings => [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SettingsModel(
|
||||||
|
settingsType: SettingsType.normal,
|
||||||
|
title: '直播默认画质',
|
||||||
|
leading: const Icon(Icons.video_settings_outlined),
|
||||||
|
getSubtitle: () =>
|
||||||
|
'当前画质:${LiveQualityCode.fromCode(GStorage.liveQuality)!.description!}',
|
||||||
|
onTap: (setState) async {
|
||||||
|
int? result = await showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return SelectDialog<int>(
|
||||||
|
title: '直播默认画质',
|
||||||
|
value: GStorage.liveQuality,
|
||||||
|
values: LiveQuality.values.map((e) {
|
||||||
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
await GStorage.setting.put(SettingBoxKey.liveQuality, result);
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsModel(
|
||||||
|
settingsType: SettingsType.normal,
|
||||||
|
title: '蜂窝网络直播默认画质',
|
||||||
|
leading: const Icon(Icons.video_settings_outlined),
|
||||||
|
getSubtitle: () =>
|
||||||
|
'当前画质:${LiveQualityCode.fromCode(GStorage.liveQualityCellular)!.description!}',
|
||||||
|
onTap: (setState) async {
|
||||||
|
int? result = await showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return SelectDialog<int>(
|
||||||
|
title: '直播默认画质',
|
||||||
|
value: GStorage.liveQualityCellular,
|
||||||
|
values: LiveQuality.values.map((e) {
|
||||||
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
await GStorage.setting
|
||||||
|
.put(SettingBoxKey.liveQualityCellular, result);
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
SettingsModel(
|
SettingsModel(
|
||||||
settingsType: SettingsType.normal,
|
settingsType: SettingsType.normal,
|
||||||
title: '首选解码格式',
|
title: '首选解码格式',
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import 'package:PiliPlus/models/common/sponsor_block/skip_type.dart';
|
|||||||
import 'package:PiliPlus/models/common/tab_type.dart';
|
import 'package:PiliPlus/models/common/tab_type.dart';
|
||||||
import 'package:PiliPlus/models/common/theme_type.dart';
|
import 'package:PiliPlus/models/common/theme_type.dart';
|
||||||
import 'package:PiliPlus/models/common/up_panel_position.dart';
|
import 'package:PiliPlus/models/common/up_panel_position.dart';
|
||||||
|
import 'package:PiliPlus/models/live/quality.dart';
|
||||||
import 'package:PiliPlus/models/user/danmaku_rule.dart';
|
import 'package:PiliPlus/models/user/danmaku_rule.dart';
|
||||||
import 'package:PiliPlus/models/user/danmaku_rule_adapter.dart';
|
import 'package:PiliPlus/models/user/danmaku_rule_adapter.dart';
|
||||||
import 'package:PiliPlus/models/video/play/CDN.dart';
|
import 'package:PiliPlus/models/video/play/CDN.dart';
|
||||||
@@ -432,6 +433,13 @@ class GStorage {
|
|||||||
static int get retryDelay =>
|
static int get retryDelay =>
|
||||||
GStorage.setting.get(SettingBoxKey.retryDelay, defaultValue: 500);
|
GStorage.setting.get(SettingBoxKey.retryDelay, defaultValue: 500);
|
||||||
|
|
||||||
|
static int get liveQuality => GStorage.setting
|
||||||
|
.get(SettingBoxKey.liveQuality, defaultValue: LiveQuality.origin.code);
|
||||||
|
|
||||||
|
static int get liveQualityCellular =>
|
||||||
|
GStorage.setting.get(SettingBoxKey.liveQualityCellular,
|
||||||
|
defaultValue: LiveQuality.superHD.code);
|
||||||
|
|
||||||
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
||||||
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
|
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
|
||||||
|
|
||||||
@@ -710,6 +718,8 @@ class SettingBoxKey {
|
|||||||
enableSlideVolumeBrightness = 'enableSlideVolumeBrightness',
|
enableSlideVolumeBrightness = 'enableSlideVolumeBrightness',
|
||||||
retryCount = 'retryCount',
|
retryCount = 'retryCount',
|
||||||
retryDelay = 'retryDelay',
|
retryDelay = 'retryDelay',
|
||||||
|
liveQuality = 'liveQuality',
|
||||||
|
liveQualityCellular = 'liveQualityCellular',
|
||||||
|
|
||||||
// Sponsor Block
|
// Sponsor Block
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
|
|||||||
Reference in New Issue
Block a user