提交 2abe3aa0 authored 作者: jungleiOS's avatar jungleiOS

ios 滑动亮度卡顿问题修复

上级 f424eed8
......@@ -218,9 +218,12 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
// 常亮
/// 常亮
Wakelock.toggle(enable: true);
/// 初始化亮度为系统亮度
ScreenBrightness().current.then((brightness) {
_brightness.value = brightness;
});
/// 倍数按钮标题
_speedTitle = widget.videoStyle.videoSpeedButtonStyle.title;
_initPlayer();
......@@ -805,10 +808,9 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
_volume.value = _controller.value.volume;
} else {
// 左侧垂直滑动 - 亮度调节
_brightness.value = await ScreenBrightness().current;
if (details.primaryDelta! > 0) {
//往下滑动
_brightness.value -= widget.playOptions.brightnessGestureUnit;
_brightness.value = _brightness.value - widget.playOptions.brightnessGestureUnit;
widget.onBrightness?.call(_brightness.value);
if (_brightness.value <= 0) {
_brightness.value = 0.0;
......@@ -817,7 +819,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
await ScreenBrightness().setScreenBrightness(_brightness.value);
} else {
//往上滑动
_brightness.value += widget.playOptions.brightnessGestureUnit;
_brightness.value = _brightness.value + widget.playOptions.brightnessGestureUnit;
widget.onBrightness?.call(_brightness.value);
if (_brightness.value >= 1) {
_brightness.value = 1.0;
......
import 'dart:io';
import 'package:gz_video_player/video_speed.dart';
/// 自定义播放参数
......@@ -11,13 +9,11 @@ class VideoPlayOptions {
this.seekSeconds = 15,
this.progressGestureUnit = 1000,
this.volumeGestureUnit = 0.005,
double? brightnessGestureUnit,
this.brightnessGestureUnit = 0.005,
this.autoplay = true,
this.allowScrubbing = true,
List<VideoSpeedItem>? speedList,
}) : brightnessGestureUnit =
brightnessGestureUnit ?? (Platform.isIOS ? 0.01 : 0.005),
speedList = speedList ??
}) : speedList = speedList ??
[
VideoSpeedItem(speed: 0.5, title: '0.5X'),
VideoSpeedItem(speed: 0.75, title: '0.75X'),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论