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