show fullscreen qa btn

Closes #1081

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-22 15:12:58 +08:00
parent 272cfcb829
commit 4d3a74f2e0
10 changed files with 138 additions and 64 deletions

View File

@@ -107,9 +107,7 @@ List<SettingsModel> get videoSettings => [
return SelectDialog<int>(
title: '默认画质',
value: Pref.defaultVideoQa,
values: VideoQuality.values.reversed
.map((e) => (e.code, e.desc))
.toList(),
values: VideoQuality.values.map((e) => (e.code, e.desc)).toList(),
);
},
);
@@ -132,9 +130,7 @@ List<SettingsModel> get videoSettings => [
return SelectDialog<int>(
title: '蜂窝网络画质',
value: Pref.defaultVideoQaCellular,
values: VideoQuality.values.reversed
.map((e) => (e.code, e.desc))
.toList(),
values: VideoQuality.values.map((e) => (e.code, e.desc)).toList(),
);
},
);
@@ -160,9 +156,7 @@ List<SettingsModel> get videoSettings => [
return SelectDialog<int>(
title: '默认音质',
value: Pref.defaultAudioQa,
values: AudioQuality.values.reversed
.map((e) => (e.code, e.desc))
.toList(),
values: AudioQuality.values.map((e) => (e.code, e.desc)).toList(),
);
},
);
@@ -185,9 +179,7 @@ List<SettingsModel> get videoSettings => [
return SelectDialog<int>(
title: '蜂窝网络音质',
value: Pref.defaultAudioQaCellular,
values: AudioQuality.values.reversed
.map((e) => (e.code, e.desc))
.toList(),
values: AudioQuality.values.map((e) => (e.code, e.desc)).toList(),
);
},
);

View File

@@ -98,7 +98,7 @@ class VideoDetailController extends GetxController
final Rx<LoadingState> videoState = LoadingState.loading().obs;
/// 播放器配置 画质 音质 解码格式
late VideoQuality currentVideoQa;
late Rx<VideoQuality> currentVideoQa;
AudioQuality? currentAudioQa;
late VideoDecodeFormatType currentDecodeFormats;
// 是否开始自动播放 存在多p的情况下第二p需要为true
@@ -1004,7 +1004,7 @@ class VideoDetailController extends GetxController
/// 根据currentVideoQa和currentDecodeFormats 重新设置videoUrl
List<VideoItem> videoList = data.dash!.video!
.where((i) => i.id == currentVideoQa.code)
.where((i) => i.id == currentVideoQa.value.code)
.toList();
final List<String> supportDecodeFormats = videoList
@@ -1036,7 +1036,7 @@ class VideoDetailController extends GetxController
orElse: () => videoList.first,
);
} else {
if (currentVideoQa == VideoQuality.dolbyVision) {
if (currentVideoQa.value == VideoQuality.dolbyVision) {
currentDecodeFormats = VideoDecodeFormatTypeExt.fromString(
videoList.first.codecs!,
)!;
@@ -1203,7 +1203,7 @@ class VideoDetailController extends GetxController
);
setVideoHeight();
currentDecodeFormats = VideoDecodeFormatTypeExt.fromString('avc1')!;
currentVideoQa = VideoQuality.fromCode(data.quality!);
currentVideoQa = Rx(VideoQuality.fromCode(data.quality!));
if (autoPlay.value || plPlayerController.preInitPlayer) {
await playerInit();
}
@@ -1236,7 +1236,7 @@ class VideoDetailController extends GetxController
numbers,
);
}
currentVideoQa = VideoQuality.fromCode(resVideoQa);
currentVideoQa = Rx(VideoQuality.fromCode(resVideoQa));
/// 取出符合当前画质的videoList
final List<VideoItem> videosList = allVideosList

View File

@@ -740,17 +740,9 @@ class ReplyItemGrpc extends StatelessWidget {
final ctr = Get.find<VideoDetailController>(
tag: getTag?.call() ?? Get.arguments['heroTag'],
);
int duration = ctr.data.timeLength!;
List<int> split = matchStr
.split(':')
.reversed
.map((item) => int.parse(item))
.toList();
int seek = 0;
for (int i = 0; i < split.length; i++) {
seek += split[i] * pow(60, i).toInt();
}
isValid = seek * 1000 <= duration;
isValid =
ctr.data.timeLength! * 1000 <=
DurationUtil.parseDuration(matchStr);
} catch (e) {
if (kDebugMode) debugPrint('failed to validate: $e');
}

View File

@@ -361,7 +361,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
leading: const Icon(Icons.play_circle_outline, size: 20),
title: const Text('选择画质', style: titleStyle),
subtitle: Text(
'当前画质 ${videoDetailCtr.currentVideoQa.desc}',
'当前画质 ${videoDetailCtr.currentVideoQa.value.desc}',
style: subTitleStyle,
),
),
@@ -604,7 +604,7 @@ class HeaderControlState extends TripleState<HeaderControl> {
return;
}
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
final VideoQuality currentVideoQa = videoDetailCtr.currentVideoQa;
final VideoQuality currentVideoQa = videoDetailCtr.currentVideoQa.value;
/// 总质量分类
final int totalQaSam = videoFormat.length;
@@ -663,10 +663,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
}
Get.back();
final int quality = item.quality!;
final newQa = VideoQuality.fromCode(quality);
videoDetailCtr
..currentVideoQa = VideoQuality.fromCode(quality)
..currentVideoQa.value = newQa
..updatePlayer();
SmartDialog.showToast("画质已变为:${newQa.desc}");
// update
if (!plPlayerController.tempPlayerConf) {
final res = await Connectivity().checkConnectivity();
@@ -682,9 +685,6 @@ class HeaderControlState extends TripleState<HeaderControl> {
);
}
}
SmartDialog.showToast(
"画质已变为:${VideoQuality.fromCode(quality).desc}",
);
},
// 可能包含会员解锁画质
enabled: index >= totalQaSam - userfulQaSam,
@@ -740,10 +740,13 @@ class HeaderControlState extends TripleState<HeaderControl> {
}
Get.back();
final int quality = i.id!;
final newQa = AudioQuality.fromCode(quality);
videoDetailCtr
..currentAudioQa = AudioQuality.fromCode(quality)
..currentAudioQa = newQa
..updatePlayer();
SmartDialog.showToast("音质已变为:${newQa.desc}");
// update
if (!plPlayerController.tempPlayerConf) {
final res = await Connectivity().checkConnectivity();
@@ -759,9 +762,6 @@ class HeaderControlState extends TripleState<HeaderControl> {
);
}
}
SmartDialog.showToast(
"音质已变为:${AudioQuality.fromCode(quality).desc}",
);
},
contentPadding: const EdgeInsets.only(left: 20, right: 20),
title: Text(i.quality),