mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 侧边栏、动态重构,排行改为首页分区,平板、折叠屏、竖屏视频新适配,播放页可隐藏黑边、截图、点踩,弹幕粗细调整,默认关闭后台播放,弹窗接受返回
This commit is contained in:
@@ -243,6 +243,7 @@ class PlPlayerController {
|
||||
late double opacityVal;
|
||||
late double fontSizeVal;
|
||||
late double strokeWidth;
|
||||
late int fontWeight;
|
||||
late double danmakuDurationVal;
|
||||
late List<double> speedsList;
|
||||
double? defaultDuration;
|
||||
@@ -286,12 +287,10 @@ class PlPlayerController {
|
||||
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
||||
danmakuWeight.value =
|
||||
setting.get(SettingBoxKey.danmakuWeight, defaultValue: 0);
|
||||
blockTypes =
|
||||
setting.get(SettingBoxKey.danmakuBlockType, defaultValue: []);
|
||||
blockTypes = setting.get(SettingBoxKey.danmakuBlockType, defaultValue: []);
|
||||
showArea = setting.get(SettingBoxKey.danmakuShowArea, defaultValue: 0.5);
|
||||
// 不透明度
|
||||
opacityVal =
|
||||
setting.get(SettingBoxKey.danmakuOpacity, defaultValue: 1.0);
|
||||
opacityVal = setting.get(SettingBoxKey.danmakuOpacity, defaultValue: 1.0);
|
||||
// 字体大小
|
||||
fontSizeVal =
|
||||
setting.get(SettingBoxKey.danmakuFontScale, defaultValue: 1.0);
|
||||
@@ -300,6 +299,8 @@ class PlPlayerController {
|
||||
setting.get(SettingBoxKey.danmakuDuration, defaultValue: 4.0);
|
||||
// 描边粗细
|
||||
strokeWidth = setting.get(SettingBoxKey.strokeWidth, defaultValue: 1.5);
|
||||
// 弹幕字体粗细
|
||||
fontWeight = setting.get(SettingBoxKey.fontWeight, defaultValue: 5);
|
||||
playRepeat = PlayRepeat.values.toList().firstWhere(
|
||||
(e) =>
|
||||
e.value ==
|
||||
@@ -312,7 +313,7 @@ class PlPlayerController {
|
||||
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
||||
// 后台播放
|
||||
_continuePlayInBackground.value =
|
||||
setting.get(SettingBoxKey.continuePlayInBackground, defaultValue: true);
|
||||
setting.get(SettingBoxKey.continuePlayInBackground, defaultValue: false);
|
||||
if (!enableAutoLongPressSpeed) {
|
||||
_longPressSpeed.value = videoStorage
|
||||
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);
|
||||
@@ -356,7 +357,7 @@ class PlPlayerController {
|
||||
double speed = 1.0,
|
||||
// 硬件加速
|
||||
bool enableHA = true,
|
||||
String? hwdec,
|
||||
String? hwdec,
|
||||
double? width,
|
||||
double? height,
|
||||
Duration? duration,
|
||||
@@ -458,7 +459,6 @@ class PlPlayerController {
|
||||
bufferSize: bufferSize,
|
||||
),
|
||||
);
|
||||
|
||||
var pp = player.platform as NativePlayer;
|
||||
// 解除倍速限制
|
||||
await pp.setProperty("af", "scaletempo2=max-speed=8");
|
||||
@@ -515,7 +515,7 @@ class PlPlayerController {
|
||||
configuration: VideoControllerConfiguration(
|
||||
enableHardwareAcceleration: enableHA,
|
||||
androidAttachSurfaceAfterVideoParameters: false,
|
||||
hwdec: hwdec,
|
||||
hwdec: enableHA ? hwdec: null,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -991,8 +991,7 @@ class PlPlayerController {
|
||||
|
||||
/// 设置后台播放
|
||||
Future<void> setBackgroundPlay(bool val) async {
|
||||
_continuePlayInBackground.value = val;
|
||||
setting.put(SettingBoxKey.continuePlayInBackground, val);
|
||||
setting.put(SettingBoxKey.enableBackgroundPlay, val);
|
||||
videoPlayerServiceHandler.revalidateSetting();
|
||||
}
|
||||
|
||||
@@ -1150,6 +1149,7 @@ class PlPlayerController {
|
||||
setting.put(SettingBoxKey.danmakuFontScale, fontSizeVal);
|
||||
setting.put(SettingBoxKey.danmakuDuration, danmakuDurationVal);
|
||||
setting.put(SettingBoxKey.strokeWidth, strokeWidth);
|
||||
setting.put(SettingBoxKey.fontWeight, fontWeight);
|
||||
}
|
||||
|
||||
Future<void> dispose({String type = 'single'}) async {
|
||||
@@ -1161,6 +1161,7 @@ class PlPlayerController {
|
||||
return;
|
||||
}
|
||||
_playerCount.value = 0;
|
||||
pause();
|
||||
try {
|
||||
_timer?.cancel();
|
||||
_timerForVolume?.cancel();
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPalaX/pages/video/detail/introduction/controller.dart';
|
||||
import 'package:PiliPalaX/utils/id_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -17,6 +18,7 @@ import 'package:PiliPalaX/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
import 'package:PiliPalaX/plugin/pl_player/utils.dart';
|
||||
import 'package:PiliPalaX/utils/feed_back.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:saver_gallery/saver_gallery.dart';
|
||||
import 'package:screen_brightness/screen_brightness.dart';
|
||||
|
||||
import '../../common/widgets/audio_video_progress_bar.dart';
|
||||
@@ -330,8 +332,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
episodes.addAll(pages);
|
||||
changeFucCall = videoIntroController!.changeSeasonOrbangu;
|
||||
} else if (isBangumi) {
|
||||
episodes.addAll(bangumiIntroController!.bangumiDetail.value.episodes!);
|
||||
changeFucCall = bangumiIntroController!.changeSeasonOrbangu;
|
||||
episodes.addAll(bangumiIntroController!
|
||||
.bangumiDetail.value.episodes!);
|
||||
changeFucCall =
|
||||
bangumiIntroController!.changeSeasonOrbangu;
|
||||
}
|
||||
ListSheet(
|
||||
episodes: episodes,
|
||||
@@ -500,11 +504,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode: !_.continuePlayInBackground.value,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
subtitleViewConfiguration: const SubtitleViewConfiguration(
|
||||
style: subTitleStyle,
|
||||
padding: EdgeInsets.all(24.0),
|
||||
textScaleFactor: 1.0,
|
||||
),
|
||||
// 字幕尺寸调节
|
||||
subtitleViewConfiguration: SubtitleViewConfiguration(
|
||||
style: subTitleStyle,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
textScaleFactor: MediaQuery.textScaleFactorOf(context)),
|
||||
fit: _.videoFit.value,
|
||||
),
|
||||
),
|
||||
@@ -848,36 +852,32 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
|
||||
// 头部、底部控制条
|
||||
SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Obx(
|
||||
() => Column(
|
||||
children: [
|
||||
if (widget.headerControl != null || _.headerControl != null)
|
||||
ClipRect(
|
||||
child: AppBarAni(
|
||||
controller: animationController,
|
||||
visible: !_.controlsLock.value && _.showControls.value,
|
||||
position: 'top',
|
||||
child: widget.headerControl ?? _.headerControl!,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Obx(
|
||||
() => Column(
|
||||
children: [
|
||||
if (widget.headerControl != null || _.headerControl != null)
|
||||
ClipRect(
|
||||
child: AppBarAni(
|
||||
controller: animationController,
|
||||
visible: !_.controlsLock.value && _.showControls.value,
|
||||
position: 'bottom',
|
||||
child: widget.bottomControl ??
|
||||
BottomControl(
|
||||
controller: widget.controller,
|
||||
buildBottomControl: buildBottomControl(),
|
||||
),
|
||||
position: 'top',
|
||||
child: widget.headerControl ?? _.headerControl!,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
ClipRect(
|
||||
child: AppBarAni(
|
||||
controller: animationController,
|
||||
visible: !_.controlsLock.value && _.showControls.value,
|
||||
position: 'bottom',
|
||||
child: widget.bottomControl ??
|
||||
BottomControl(
|
||||
controller: widget.controller,
|
||||
buildBottomControl: buildBottomControl(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -981,7 +981,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: FractionalTranslation(
|
||||
translation: const Offset(1, 0.0),
|
||||
translation: const Offset(1, -0.4),
|
||||
child: Visibility(
|
||||
visible: _.showControls.value,
|
||||
child: ComBtn(
|
||||
@@ -1000,6 +1000,42 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 截图
|
||||
Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: FractionalTranslation(
|
||||
translation: const Offset(-1, -0.4),
|
||||
child: Visibility(
|
||||
visible: _.showControls.value && _.isFullScreen.value,
|
||||
child: ComBtn(
|
||||
tooltip: '截图',
|
||||
icon: const Icon(
|
||||
Icons.photo_camera,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () => {
|
||||
_.videoPlayerController
|
||||
?.screenshot(format: 'image/png')
|
||||
.then((value) {
|
||||
if (value != null) {
|
||||
SmartDialog.showToast('截图成功');
|
||||
String _name = DateTime.now().toString();
|
||||
SaverGallery.saveImage(value,
|
||||
name: _name,
|
||||
androidRelativePath: "Pictures/Screenshots",
|
||||
androidExistNotSave: false);
|
||||
SmartDialog.showToast('$_name.png已保存到相册/截图');
|
||||
}
|
||||
})
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
//
|
||||
Obx(() {
|
||||
if (_.dataStatus.loading || _.isBuffering.value) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class AppBarAni extends StatelessWidget implements PreferredSizeWidget {
|
||||
tileMode: TileMode.mirror,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
child: SafeArea(child: child),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user