mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
fix: replay
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -125,8 +125,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 双击播放、暂停
|
// 双击播放、暂停
|
||||||
void onDoubleTapCenter() {
|
void onDoubleTapCenter() async {
|
||||||
plPlayerController.videoPlayerController!.playOrPause();
|
if (plPlayerController.videoPlayerController!.state.completed) {
|
||||||
|
await plPlayerController.videoPlayerController!.seek(Duration.zero);
|
||||||
|
plPlayerController.videoPlayerController!.play();
|
||||||
|
} else {
|
||||||
|
plPlayerController.videoPlayerController!.playOrPause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doubleTapFuc(String type) {
|
void doubleTapFuc(String type) {
|
||||||
@@ -283,7 +288,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
/// 播放暂停
|
/// 播放暂停
|
||||||
BottomControlType.playOrPause: PlayOrPauseButton(
|
BottomControlType.playOrPause: PlayOrPauseButton(
|
||||||
controller: plPlayerController,
|
plPlayerController: plPlayerController,
|
||||||
),
|
),
|
||||||
|
|
||||||
/// 下一集
|
/// 下一集
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import 'package:PiliPlus/plugin/pl_player/index.dart';
|
|||||||
class PlayOrPauseButton extends StatefulWidget {
|
class PlayOrPauseButton extends StatefulWidget {
|
||||||
final double? iconSize;
|
final double? iconSize;
|
||||||
final Color? iconColor;
|
final Color? iconColor;
|
||||||
final PlPlayerController? controller;
|
final PlPlayerController plPlayerController;
|
||||||
|
|
||||||
const PlayOrPauseButton({
|
const PlayOrPauseButton({
|
||||||
super.key,
|
super.key,
|
||||||
this.iconSize,
|
this.iconSize,
|
||||||
this.iconColor,
|
this.iconColor,
|
||||||
this.controller,
|
required this.plPlayerController,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,10 +28,12 @@ class PlayOrPauseButtonState extends State<PlayOrPauseButton>
|
|||||||
late Player player;
|
late Player player;
|
||||||
bool isOpacity = false;
|
bool isOpacity = false;
|
||||||
|
|
||||||
|
PlPlayerController get plPlayerController => widget.plPlayerController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
player = widget.controller!.videoPlayerController!;
|
player = plPlayerController.videoPlayerController!;
|
||||||
animation = AnimationController(
|
animation = AnimationController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
value: player.state.playing ? 1 : 0,
|
value: player.state.playing ? 1 : 0,
|
||||||
@@ -67,13 +69,20 @@ class PlayOrPauseButtonState extends State<PlayOrPauseButton>
|
|||||||
width: 42,
|
width: 42,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: player.playOrPause,
|
onTap: () async {
|
||||||
|
if (player.state.completed) {
|
||||||
|
await player.seek(Duration.zero);
|
||||||
|
player.play();
|
||||||
|
} else {
|
||||||
|
player.playOrPause();
|
||||||
|
}
|
||||||
|
},
|
||||||
// iconSize: widget.iconSize ?? _theme(context).buttonBarButtonSize,
|
// iconSize: widget.iconSize ?? _theme(context).buttonBarButtonSize,
|
||||||
// color: widget.iconColor ?? _theme(context).buttonBarButtonColor,
|
// color: widget.iconColor ?? _theme(context).buttonBarButtonColor,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: AnimatedIcon(
|
child: AnimatedIcon(
|
||||||
semanticLabel:
|
semanticLabel:
|
||||||
widget.controller!.videoPlayerController!.state.playing
|
plPlayerController.videoPlayerController!.state.playing
|
||||||
? '暂停'
|
? '暂停'
|
||||||
: '播放',
|
: '播放',
|
||||||
progress: animation,
|
progress: animation,
|
||||||
|
|||||||
Reference in New Issue
Block a user