mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 播放控制条组件触控区域优化,新增画质音质修改后保存为默认
This commit is contained in:
@@ -133,7 +133,8 @@ class VideoDetailController extends GetxController
|
|||||||
// CDN优化
|
// CDN优化
|
||||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||||
// 预设的画质
|
// 预设的画质
|
||||||
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
|
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa,
|
||||||
|
defaultValue: VideoQuality.values.last.code);
|
||||||
// 预设的解码格式
|
// 预设的解码格式
|
||||||
cacheDecode = setting.get(SettingBoxKey.defaultDecode,
|
cacheDecode = setting.get(SettingBoxKey.defaultDecode,
|
||||||
defaultValue: VideoDecodeFormats.values.last.code);
|
defaultValue: VideoDecodeFormats.values.last.code);
|
||||||
@@ -194,19 +195,22 @@ class VideoDetailController extends GetxController
|
|||||||
flag += 4;
|
flag += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag == 1) {//currentDecodeFormats
|
if (flag == 1) {
|
||||||
|
//currentDecodeFormats
|
||||||
firstVideo = videoList.first;
|
firstVideo = videoList.first;
|
||||||
} else {
|
} else {
|
||||||
if (currentVideoQa == VideoQuality.dolbyVision) {
|
if (currentVideoQa == VideoQuality.dolbyVision) {
|
||||||
currentDecodeFormats =
|
currentDecodeFormats =
|
||||||
VideoDecodeFormatsCode.fromString(videoList.first.codecs!)!;
|
VideoDecodeFormatsCode.fromString(videoList.first.codecs!)!;
|
||||||
firstVideo = videoList.first;
|
firstVideo = videoList.first;
|
||||||
} else if (flag == 2 || flag == 6) {//defaultDecodeFormats
|
} else if (flag == 2 || flag == 6) {
|
||||||
|
//defaultDecodeFormats
|
||||||
currentDecodeFormats = defaultDecodeFormats;
|
currentDecodeFormats = defaultDecodeFormats;
|
||||||
firstVideo = videoList.firstWhere(
|
firstVideo = videoList.firstWhere(
|
||||||
(i) => i.codecs!.startsWith(defaultDecodeFormats.code),
|
(i) => i.codecs!.startsWith(defaultDecodeFormats.code),
|
||||||
);
|
);
|
||||||
} else if (flag == 4) {//secondDecodeFormats
|
} else if (flag == 4) {
|
||||||
|
//secondDecodeFormats
|
||||||
currentDecodeFormats = secondDecodeFormats;
|
currentDecodeFormats = secondDecodeFormats;
|
||||||
firstVideo = videoList.firstWhere(
|
firstVideo = videoList.firstWhere(
|
||||||
(i) => i.codecs!.startsWith(secondDecodeFormats.code),
|
(i) => i.codecs!.startsWith(secondDecodeFormats.code),
|
||||||
@@ -348,6 +352,7 @@ class VideoDetailController extends GetxController
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
SmartDialog.showToast('DecodeFormats error: $err');
|
SmartDialog.showToast('DecodeFormats error: $err');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 取出符合当前解码格式的videoItem
|
/// 取出符合当前解码格式的videoItem
|
||||||
try {
|
try {
|
||||||
firstVideo = videosList.firstWhere(
|
firstVideo = videosList.firstWhere(
|
||||||
|
|||||||
@@ -503,6 +503,15 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
final int quality = videoFormat[i].quality!;
|
final int quality = videoFormat[i].quality!;
|
||||||
widget.videoDetailCtr!.currentVideoQa =
|
widget.videoDetailCtr!.currentVideoQa =
|
||||||
VideoQualityCode.fromCode(quality)!;
|
VideoQualityCode.fromCode(quality)!;
|
||||||
|
String oldQualityDesc = VideoQualityCode.fromCode(
|
||||||
|
setting.get(SettingBoxKey.defaultVideoQa,
|
||||||
|
defaultValue:
|
||||||
|
VideoQuality.values.last.code))!
|
||||||
|
.description;
|
||||||
|
setting.put(
|
||||||
|
SettingBoxKey.defaultVideoQa, quality);
|
||||||
|
SmartDialog.showToast(
|
||||||
|
"默认画质由:$oldQualityDesc 变为:${VideoQualityCode.fromCode(quality)!.description}");
|
||||||
widget.videoDetailCtr!.updatePlayer();
|
widget.videoDetailCtr!.updatePlayer();
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
@@ -512,10 +521,6 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
contentPadding:
|
contentPadding:
|
||||||
const EdgeInsets.only(left: 20, right: 20),
|
const EdgeInsets.only(left: 20, right: 20),
|
||||||
title: Text(videoFormat[i].newDesc!),
|
title: Text(videoFormat[i].newDesc!),
|
||||||
subtitle: Text(
|
|
||||||
videoFormat[i].format!,
|
|
||||||
style: subTitleStyle,
|
|
||||||
),
|
|
||||||
trailing: currentVideoQa.code ==
|
trailing: currentVideoQa.code ==
|
||||||
videoFormat[i].quality
|
videoFormat[i].quality
|
||||||
? Icon(
|
? Icon(
|
||||||
@@ -523,7 +528,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
color:
|
color:
|
||||||
Theme.of(context).colorScheme.primary,
|
Theme.of(context).colorScheme.primary,
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: Text(
|
||||||
|
videoFormat[i].format!,
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@@ -574,6 +582,14 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
final int quality = i.id!;
|
final int quality = i.id!;
|
||||||
widget.videoDetailCtr!.currentAudioQa =
|
widget.videoDetailCtr!.currentAudioQa =
|
||||||
AudioQualityCode.fromCode(quality)!;
|
AudioQualityCode.fromCode(quality)!;
|
||||||
|
String oldQualityDesc = AudioQualityCode.fromCode(
|
||||||
|
setting.get(SettingBoxKey.defaultAudioQa,
|
||||||
|
defaultValue:
|
||||||
|
AudioQuality.values.last.code))!
|
||||||
|
.description;
|
||||||
|
setting.put(SettingBoxKey.defaultAudioQa, quality);
|
||||||
|
SmartDialog.showToast(
|
||||||
|
"默认音质由:$oldQualityDesc 变为:${AudioQualityCode.fromCode(quality)!.description}");
|
||||||
widget.videoDetailCtr!.updatePlayer();
|
widget.videoDetailCtr!.updatePlayer();
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
@@ -1034,33 +1050,34 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
primary: false,
|
primary: false,
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
titleSpacing: 14,
|
titleSpacing: 10,
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
// SizedBox(width: MediaQuery.of(context).padding.left,),
|
SizedBox(
|
||||||
ComBtn(
|
width: 42,
|
||||||
tooltip: '上一页',
|
height: 34,
|
||||||
icon: const Icon(
|
child: IconButton(
|
||||||
FontAwesomeIcons.arrowLeft,
|
tooltip: '上一页',
|
||||||
size: 15,
|
icon: const Icon(
|
||||||
color: Colors.white,
|
FontAwesomeIcons.arrowLeft,
|
||||||
),
|
size: 15,
|
||||||
fuc: () => <Set<void>>{
|
color: Colors.white,
|
||||||
if (widget.controller!.isFullScreen.value)
|
),
|
||||||
<void>{widget.controller!.triggerFullScreen(status: false)}
|
onPressed: () => <Set<void>>{
|
||||||
else
|
if (widget.controller!.isFullScreen.value)
|
||||||
<void>{
|
<void>{widget.controller!.triggerFullScreen(status: false)}
|
||||||
if (MediaQuery.of(context).orientation ==
|
else
|
||||||
Orientation.landscape &&
|
<void>{
|
||||||
!horizontalScreen)
|
if (MediaQuery.of(context).orientation ==
|
||||||
{
|
Orientation.landscape &&
|
||||||
verticalScreenForTwoSeconds(),
|
!horizontalScreen)
|
||||||
},
|
{
|
||||||
Get.back()
|
verticalScreenForTwoSeconds(),
|
||||||
}
|
},
|
||||||
},
|
Get.back()
|
||||||
),
|
}
|
||||||
SizedBox(width: buttonSpace),
|
},
|
||||||
|
)),
|
||||||
if ((videoIntroController.videoDetail.value.title != null) &&
|
if ((videoIntroController.videoDetail.value.title != null) &&
|
||||||
(isFullScreen ||
|
(isFullScreen ||
|
||||||
(!isFullScreen && isLandscape && !horizontalScreen))) ...[
|
(!isFullScreen && isLandscape && !horizontalScreen))) ...[
|
||||||
@@ -1069,7 +1086,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: isLandscape ? 400 : 150, maxHeight: 20),
|
maxWidth: isLandscape ? 400 : 140, maxHeight: 25),
|
||||||
child: Marquee(
|
child: Marquee(
|
||||||
text: videoIntroController.videoDetail.value.title!,
|
text: videoIntroController.videoDetail.value.title!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -1082,7 +1099,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
velocity: 40,
|
velocity: 40,
|
||||||
startAfter: const Duration(seconds: 1),
|
startAfter: const Duration(seconds: 1),
|
||||||
showFadingOnlyWhenScrolling: true,
|
showFadingOnlyWhenScrolling: true,
|
||||||
fadingEdgeStartFraction: 0.1,
|
fadingEdgeStartFraction: 0,
|
||||||
fadingEdgeEndFraction: 0.1,
|
fadingEdgeEndFraction: 0.1,
|
||||||
numberOfRounds: 1,
|
numberOfRounds: 1,
|
||||||
startPadding: 0,
|
startPadding: 0,
|
||||||
@@ -1097,28 +1114,31 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
'${videoIntroController.total.value}人正在看',
|
'${videoIntroController.total.value}人正在看',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 12,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
] else ...[
|
] else ...[
|
||||||
ComBtn(
|
SizedBox(
|
||||||
tooltip: '返回主页',
|
width: 42,
|
||||||
icon: const Icon(
|
height: 34,
|
||||||
FontAwesomeIcons.house,
|
child: IconButton(
|
||||||
size: 15,
|
tooltip: '返回主页',
|
||||||
color: Colors.white,
|
icon: const Icon(
|
||||||
),
|
FontAwesomeIcons.house,
|
||||||
fuc: () async {
|
size: 15,
|
||||||
// 销毁播放器实例
|
color: Colors.white,
|
||||||
// await widget.controller!.dispose(type: 'all');
|
),
|
||||||
if (mounted) {
|
onPressed: () async {
|
||||||
Navigator.popUntil(
|
// 销毁播放器实例
|
||||||
context, (Route<dynamic> route) => route.isFirst);
|
// await widget.controller!.dispose(type: 'all');
|
||||||
}
|
if (mounted) {
|
||||||
},
|
Navigator.popUntil(
|
||||||
),
|
context, (Route<dynamic> route) => route.isFirst);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// ComBtn(
|
// ComBtn(
|
||||||
@@ -1130,7 +1150,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
// fuc: () => _.screenshot(),
|
// fuc: () => _.screenshot(),
|
||||||
// ),
|
// ),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 42,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
tooltip: '发弹幕',
|
tooltip: '发弹幕',
|
||||||
@@ -1145,9 +1165,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 42,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => IconButton(
|
() => IconButton(
|
||||||
@@ -1158,7 +1177,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
_.isOpenDanmu.value = !_.isOpenDanmu.value;
|
_.isOpenDanmu.value = !_.isOpenDanmu.value;
|
||||||
SmartDialog.showToast(
|
SmartDialog.showToast(
|
||||||
_.isOpenDanmu.value ? '已临时开启弹幕' : '已临时关闭弹幕', displayTime: const Duration(seconds: 1));
|
_.isOpenDanmu.value ? '已临时开启弹幕' : '已临时关闭弹幕',
|
||||||
|
displayTime: const Duration(seconds: 1));
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
_.isOpenDanmu.value
|
_.isOpenDanmu.value
|
||||||
@@ -1170,10 +1190,9 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
if (Platform.isAndroid)
|
||||||
if (Platform.isAndroid) ...<Widget>[
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 42,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
tooltip: '画中画',
|
tooltip: '画中画',
|
||||||
@@ -1199,16 +1218,21 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(
|
||||||
],
|
width: 42,
|
||||||
ComBtn(
|
height: 34,
|
||||||
tooltip: '更多设置',
|
child: IconButton(
|
||||||
icon: const Icon(
|
tooltip: "更多设置",
|
||||||
Icons.more_vert_outlined,
|
style: ButtonStyle(
|
||||||
size: 18,
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
color: Colors.white,
|
),
|
||||||
|
onPressed: () => showSettingSheet(),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert_outlined,
|
||||||
|
size: 19,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
fuc: () => showSettingSheet(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
final _ = controller!;
|
final _ = controller!;
|
||||||
const textStyle = TextStyle(
|
const textStyle = TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 12,
|
fontSize: 11,
|
||||||
);
|
);
|
||||||
//阅读器限制
|
//阅读器限制
|
||||||
Timer? _accessibilityDebounce;
|
Timer? _accessibilityDebounce;
|
||||||
@@ -34,7 +34,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
height: 90,
|
height: 90,
|
||||||
padding: const EdgeInsets.only(left: 18, right: 18),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@@ -47,7 +47,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 7, right: 7, bottom: 6),
|
padding: const EdgeInsets.only(left: 10, right: 10, bottom: 7),
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
// label: '${(value / max * 100).round()}%',
|
// label: '${(value / max * 100).round()}%',
|
||||||
value: '${(value / max * 100).round()}%',
|
value: '${(value / max * 100).round()}%',
|
||||||
@@ -101,7 +101,6 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
controller: _,
|
controller: _,
|
||||||
)
|
)
|
||||||
: nil,
|
: nil,
|
||||||
const SizedBox(width: 4),
|
|
||||||
// 播放时间
|
// 播放时间
|
||||||
Obx(() {
|
Obx(() {
|
||||||
return Text(
|
return Text(
|
||||||
@@ -129,7 +128,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 45,
|
width: 42,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => _.toggleVideoFit(),
|
onPressed: () => _.toggleVideoFit(),
|
||||||
@@ -150,7 +149,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
width: 0,
|
width: 0,
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: 45,
|
width: 42,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: PopupMenuButton<Map<String, String>>(
|
child: PopupMenuButton<Map<String, String>>(
|
||||||
onSelected: (Map<String, String> value) {
|
onSelected: (Map<String, String> value) {
|
||||||
@@ -172,7 +171,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
}).toList();
|
}).toList();
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 45,
|
width: 42,
|
||||||
height: 30,
|
height: 30,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
@@ -186,7 +185,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 45,
|
width: 42,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: PopupMenuButton<double>(
|
child: PopupMenuButton<double>(
|
||||||
onSelected: (double value) {
|
onSelected: (double value) {
|
||||||
@@ -209,7 +208,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
}).toList();
|
}).toList();
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 45,
|
width: 42,
|
||||||
height: 30,
|
height: 30,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Obx(() => Text("${_.playbackSpeed}X",
|
child: Obx(() => Text("${_.playbackSpeed}X",
|
||||||
@@ -221,7 +220,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
// 全屏
|
// 全屏
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 45,
|
width: 42,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: Obx(() => ComBtn(
|
child: Obx(() => ComBtn(
|
||||||
tooltip: _.isFullScreen.value ? '退出全屏' : '全屏',
|
tooltip: _.isFullScreen.value ? '退出全屏' : '全屏',
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class PlayOrPauseButtonState extends State<PlayOrPauseButton>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 34,
|
width: 42,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
tooltip: widget.controller!.videoPlayerController!.state.playing
|
tooltip: widget.controller!.videoPlayerController!.state.playing
|
||||||
@@ -75,7 +75,7 @@ class PlayOrPauseButtonState extends State<PlayOrPauseButton>
|
|||||||
),
|
),
|
||||||
onPressed: player.playOrPause,
|
onPressed: player.playOrPause,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
iconSize: 20,
|
iconSize: 25,
|
||||||
// iconSize: widget.iconSize ?? _theme(context).buttonBarButtonSize,
|
// iconSize: widget.iconSize ?? _theme(context).buttonBarButtonSize,
|
||||||
// color: widget.iconColor ?? _theme(context).buttonBarButtonColor,
|
// color: widget.iconColor ?? _theme(context).buttonBarButtonColor,
|
||||||
icon: AnimatedIcon(
|
icon: AnimatedIcon(
|
||||||
|
|||||||
Reference in New Issue
Block a user