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() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
minSdkVersion 19 minSdkVersion 19
multiDexEnabled true
} }
signingConfigs { signingConfigs {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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