mod: 播放速度调节优化 issues #201
This commit is contained in:
@ -197,12 +197,20 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
for (var i in speedsList) ...[
|
for (var i in speedsList) ...[
|
||||||
if (i == currentSpeed) ...[
|
if (i == currentSpeed) ...[
|
||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: () => {setState(() => currentSpeed = i)},
|
onPressed: () async {
|
||||||
|
// setState(() => currentSpeed = i),
|
||||||
|
await widget.controller!.setPlaybackSpeed(i);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
},
|
||||||
child: Text(i.toString()),
|
child: Text(i.toString()),
|
||||||
),
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
onPressed: () => {setState(() => currentSpeed = i)},
|
onPressed: () async {
|
||||||
|
// setState(() => currentSpeed = i),
|
||||||
|
await widget.controller!.setPlaybackSpeed(i);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
},
|
||||||
child: Text(i.toString()),
|
child: Text(i.toString()),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@ -220,10 +228,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await SmartDialog.dismiss();
|
await widget.controller!.setDefaultSpeed();
|
||||||
widget.controller!.setPlaybackSpeed(currentSpeed);
|
SmartDialog.dismiss();
|
||||||
},
|
},
|
||||||
child: const Text('确定'),
|
child: const Text('默认速度'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -585,7 +585,17 @@ class PlPlayerController {
|
|||||||
danmakuController!.updateOption(updatedOption);
|
danmakuController!.updateOption(updatedOption);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
// fix 长按倍速后放开不恢复
|
// fix 长按倍速后放开不恢复
|
||||||
// _playbackSpeed.value = speed;
|
if (!doubleSpeedStatus.value) {
|
||||||
|
_playbackSpeed.value = speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 还原默认速度
|
||||||
|
Future<void> setDefaultSpeed() async {
|
||||||
|
double speed =
|
||||||
|
videoStorage.get(VideoBoxKey.playSpeedDefault, defaultValue: 1.0);
|
||||||
|
await _videoPlayerController?.setRate(speed);
|
||||||
|
_playbackSpeed.value = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 设置倍速
|
/// 设置倍速
|
||||||
@ -796,6 +806,7 @@ class PlPlayerController {
|
|||||||
if (val) {
|
if (val) {
|
||||||
setPlaybackSpeed(longPressSpeed);
|
setPlaybackSpeed(longPressSpeed);
|
||||||
} else {
|
} else {
|
||||||
|
print(playbackSpeed);
|
||||||
setPlaybackSpeed(playbackSpeed);
|
setPlaybackSpeed(playbackSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user