Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

add long press fast forward

Predidit7ac92d0edf98
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 9f1fe1e4..a4306782 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -56,6 +56,7 @@ class _PlayerItemState extends State<PlayerItem>
bool showPosition = false;
bool showBrightness = false;
bool showVolume = false;
+ bool showPlaySpeed = false;
// 弹幕
final _danmuKey = GlobalKey();
@@ -599,6 +600,20 @@ class _PlayerItemState extends State<PlayerItem>
playerController.play();
}
},
+ onLongPressStart: (_) {
+ setState(() {
+ showPlaySpeed = true;
+ });
+ playerController.setPlaybackSpeed(
+ playerController.playerSpeed * 2.5);
+ },
+ onLongPressEnd: (_) {
+ setState(() {
+ showPlaySpeed = false;
+ });
+ playerController.setPlaybackSpeed(
+ playerController.playerSpeed / 2.5);
+ },
child: Container(
color: Colors.transparent,
width: double.infinity,
@@ -747,6 +762,40 @@ class _PlayerItemState extends State<PlayerItem>
],
)
: Container()),
+ // 顶部播放速度条
+ Positioned(
+ top: 25,
+ child: showPlaySpeed
+ ? Wrap(
+ alignment: WrapAlignment.center,
+ children: <Widget>[
+ Container(
+ padding:
+ const EdgeInsets.all(8.0),
+ decoration: BoxDecoration(
+ color: Colors.black
+ .withOpacity(0.5),
+ borderRadius:
+ BorderRadius.circular(
+ 8.0), // 圆角
+ ),
+ child: const Row(
+ children: <Widget>[
+ Icon(
+ Icons.fast_forward,
+ color: Colors.white),
+ Text(
+ ' 倍速播放',
+ style: TextStyle(
+ color: Colors.white,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ )
+ : Container()),
// 亮度条
Positioned(
top: 25,