fix: 统一弹幕时间计算方式,speed改为duration
This commit is contained in:
@ -63,6 +63,7 @@ android {
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
minSdkVersion 19
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
@ -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) {},
|
||||
),
|
||||
|
@ -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,14 +773,14 @@ 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 =
|
||||
|
@ -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 ==
|
||||
@ -1097,7 +1097,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', '');
|
||||
|
@ -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';
|
||||
|
Reference in New Issue
Block a user