Merge branch 'main' into fix

This commit is contained in:
guozhigq
2023-12-22 00:43:36 +08:00
7 changed files with 40 additions and 54 deletions

View File

@ -63,6 +63,7 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
minSdkVersion 19
multiDexEnabled true
}
signingConfigs {

View File

@ -34,7 +34,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
late double showArea;
late double opacityVal;
late double fontSizeVal;
late double danmakuSpeedVal;
late double danmakuDurationVal;
@override
void initState() {
@ -68,7 +68,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
showArea = playerController.showArea;
opacityVal = playerController.opacityVal;
fontSizeVal = playerController.fontSizeVal;
danmakuSpeedVal = playerController.danmakuSpeedVal;
danmakuDurationVal = playerController.danmakuDurationVal;
}
// 播放器状态监听
@ -156,7 +156,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, box) {
double initDuration = box.maxWidth / 12;
// double initDuration = box.maxWidth / 12;
return Obx(
() => AnimatedOpacity(
opacity: playerController.isOpenDanmu.value ? 1 : 0,
@ -172,8 +172,9 @@ class _PlDanmakuState extends State<PlDanmaku> {
hideTop: blockTypes.contains(5),
hideScroll: blockTypes.contains(2),
hideBottom: blockTypes.contains(4),
duration: initDuration /
(danmakuSpeedVal * widget.playerController.playbackSpeed),
duration: danmakuDurationVal / widget.playerController.playbackSpeed,
// initDuration /
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
),
statusChanged: (isPlaying) {},
),

View File

@ -244,7 +244,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
}
Widget childWhenDisabled = SafeArea(
top: MediaQuery.of(context).orientation == Orientation.portrait,
bottom: MediaQuery.of(context).orientation == Orientation.portrait,
bottom: MediaQuery.of(context).orientation == Orientation.portrait
&& plPlayerController!.isFullScreen.value,
left: !plPlayerController!.isFullScreen.value,
right: !plPlayerController!.isFullScreen.value,
child: Stack(
@ -432,7 +433,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
// },
/// 不收回
pinnedHeaderSliverHeightBuilder: () {
return pinnedHeaderHeight;
return plPlayerController!.isFullScreen.value ?
MediaQuery.of(context).size.height: pinnedHeaderHeight;
},
onlyOneScrollInBody: true,
body: Container(

View File

@ -585,7 +585,7 @@ class _HeaderControlState extends State<HeaderControl> {
// 字体大小
double fontSizeVal = widget.controller!.fontSizeVal;
// 弹幕速度
double danmakuSpeedVal = widget.controller!.danmakuSpeedVal;
double danmakuDurationVal = widget.controller!.danmakuDurationVal;
DanmakuController danmakuController = widget.controller!.danmakuController!;
await showModalBottomSheet(
@ -755,7 +755,7 @@ class _HeaderControlState extends State<HeaderControl> {
),
),
),
Text('弹幕时长 ${danmakuSpeedVal.toString()}'),
Text('弹幕时长 ${danmakuDurationVal.toString()}'),
Padding(
padding: const EdgeInsets.only(
top: 0,
@ -773,20 +773,21 @@ class _HeaderControlState extends State<HeaderControl> {
enabledThumbRadius: 6.0),
),
child: Slider(
min: 1,
max: 8,
value: danmakuSpeedVal,
divisions: 14,
label: danmakuSpeedVal.toString(),
min: 2,
max: 16,
value: danmakuDurationVal,
divisions: 28,
label: danmakuDurationVal.toString(),
onChanged: (double val) {
danmakuSpeedVal = val;
widget.controller!.danmakuSpeedVal = danmakuSpeedVal;
danmakuDurationVal = val;
widget.controller!.danmakuDurationVal = danmakuDurationVal;
setState(() {});
try {
DanmakuOption currentOption =
danmakuController.option;
DanmakuOption updatedOption =
currentOption.copyWith(duration: val);
currentOption.copyWith(duration:
val/widget.controller!.playbackSpeed);
danmakuController.updateOption(updatedOption);
} catch (_) {}
},

View File

@ -221,7 +221,7 @@ class PlPlayerController {
late double showArea;
late double opacityVal;
late double fontSizeVal;
late double danmakuSpeedVal;
late double danmakuDurationVal;
late List speedsList;
// 缓存
double? defaultDuration;
@ -268,9 +268,9 @@ class PlPlayerController {
// 字体大小
fontSizeVal =
localCache.get(LocalCacheKey.danmakuFontScale, defaultValue: 1.0);
// 弹幕速度
danmakuSpeedVal =
localCache.get(LocalCacheKey.danmakuSpeed, defaultValue: 4.0);
// 弹幕时间
danmakuDurationVal =
localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0);
playRepeat = PlayRepeat.values.toList().firstWhere(
(e) =>
e.value ==
@ -937,32 +937,13 @@ class PlPlayerController {
if (!isFullScreen.value && status) {
/// 按照视频宽高比决定全屏方向
toggleFullScreen(true);
switch (mode) {
case FullScreenMode.auto:
if (direction.value == 'horizontal') {
/// 进入全屏
await enterFullScreen();
// 横屏
await landScape();
} else {
// 竖屏
await verticalScreen();
}
break;
case FullScreenMode.vertical:
/// 进入全屏
await enterFullScreen();
// 竖屏
await verticalScreen();
break;
case FullScreenMode.horizontal:
/// 进入全屏
await enterFullScreen();
// 横屏
await landScape();
break;
/// 进入全屏
await enterFullScreen();
if(mode == FullScreenMode.vertical ||
(mode == FullScreenMode.auto && direction.value == 'vertical')) {
await verticalScreen();
} else {
await landScape();
}
// bool isValid =
@ -1097,7 +1078,7 @@ class PlPlayerController {
localCache.put(LocalCacheKey.danmakuShowArea, showArea);
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);
localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal);
localCache.put(LocalCacheKey.danmakuSpeed, danmakuSpeedVal);
localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal);
var pp = _videoPlayerController!.platform as NativePlayer;
await pp.setProperty('audio-files', '');

View File

@ -26,8 +26,8 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
return Container(
color: Colors.transparent,
height: 85,
padding: const EdgeInsets.only(left: 14, right: 14),
height: 90,
padding: const EdgeInsets.only(left: 18, right: 18),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
@ -50,8 +50,8 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
bufferedBarColor: colorTheme.withOpacity(0.4),
timeLabelLocation: TimeLabelLocation.none,
thumbColor: colorTheme,
barHeight: 3.0,
thumbRadius: 5.5,
barHeight: 3.5,
thumbRadius: 7,
onDragStart: (duration) {
feedBack();
_.onChangedSliderStart();

View File

@ -154,12 +154,12 @@ class LocalCacheKey {
static const String wbiKeys = 'wbiKeys';
static const String timeStamp = 'timeStamp';
// 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕速度
// 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕时间
static const String danmakuBlockType = 'danmakuBlockType';
static const String danmakuShowArea = 'danmakuShowArea';
static const String danmakuOpacity = 'danmakuOpacity';
static const String danmakuFontScale = 'danmakuFontScale';
static const String danmakuSpeed = 'danmakuSpeed';
static const String danmakuDuration = 'danmakuDuration';
// 代理host port
static const String systemProxyHost = 'systemProxyHost';