mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 单个循环失效、继续播放时控件跳跃、冗余参数移除、typo修正
This commit is contained in:
@@ -53,7 +53,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
final Box<dynamic> setting = GStrorage.setting;
|
final Box<dynamic> setting = GStrorage.setting;
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
// 自动退出全屏
|
// 自动退出全屏
|
||||||
late bool autoExitFullcreen;
|
late bool autoExitFullscreen;
|
||||||
late bool autoPlayEnable;
|
late bool autoPlayEnable;
|
||||||
late bool horizontalScreen;
|
late bool horizontalScreen;
|
||||||
late bool enableVerticalExpand;
|
late bool enableVerticalExpand;
|
||||||
@@ -94,7 +94,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoPlayerServiceHandler.onVideoDetailChange(
|
videoPlayerServiceHandler.onVideoDetailChange(
|
||||||
bangumiIntroController.bangumiDetail.value, p0);
|
bangumiIntroController.bangumiDetail.value, p0);
|
||||||
});
|
});
|
||||||
autoExitFullcreen =
|
autoExitFullscreen =
|
||||||
setting.get(SettingBoxKey.enableAutoExit, defaultValue: true);
|
setting.get(SettingBoxKey.enableAutoExit, defaultValue: true);
|
||||||
horizontalScreen =
|
horizontalScreen =
|
||||||
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
||||||
@@ -174,16 +174,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
/// 单个循环
|
/// 单个循环
|
||||||
if (plPlayerController!.playRepeat == PlayRepeat.singleCycle) {
|
if (plPlayerController!.playRepeat == PlayRepeat.singleCycle) {
|
||||||
notExitFlag = true;
|
notExitFlag = true;
|
||||||
plPlayerController!.seekTo(Duration.zero);
|
plPlayerController!.play(repeat: true);
|
||||||
plPlayerController!.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 结束播放退出全屏
|
// 结束播放退出全屏
|
||||||
if (!notExitFlag && autoExitFullcreen) {
|
if (!notExitFlag && autoExitFullscreen) {
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
// 播放完展示控制栏
|
// 播放完展示控制栏
|
||||||
if (videoDetailController.floating != null) {
|
if (videoDetailController.floating != null && !notExitFlag) {
|
||||||
PiPStatus currentStatus =
|
PiPStatus currentStatus =
|
||||||
await videoDetailController.floating!.pipStatus;
|
await videoDetailController.floating!.pipStatus;
|
||||||
if (currentStatus == PiPStatus.disabled) {
|
if (currentStatus == PiPStatus.disabled) {
|
||||||
@@ -311,7 +310,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoDetailController.isFirstTime = false;
|
videoDetailController.isFirstTime = false;
|
||||||
final bool autoplay = autoPlayEnable;
|
final bool autoplay = autoPlayEnable;
|
||||||
videoDetailController.autoPlay.value =
|
videoDetailController.autoPlay.value =
|
||||||
!videoDetailController.isShowCover.value;
|
!videoDetailController.isShowCover.value;
|
||||||
await videoDetailController.playerInit(autoplay: autoplay);
|
await videoDetailController.playerInit(autoplay: autoplay);
|
||||||
|
|
||||||
/// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回
|
/// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回
|
||||||
|
|||||||
@@ -289,9 +289,9 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> playIfExists(
|
static Future<void> playIfExists(
|
||||||
{bool repeat = false, bool hideControls = true, dynamic duration}) async {
|
{bool repeat = false, bool hideControls = true}) async {
|
||||||
await _instance?.play(
|
await _instance?.play(
|
||||||
repeat: repeat, hideControls: hideControls, duration: duration);
|
repeat: repeat, hideControls: hideControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to get PlayerStatus
|
// try to get PlayerStatus
|
||||||
@@ -610,8 +610,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 开始播放
|
// 开始播放
|
||||||
Future _initializePlayer({
|
Future _initializePlayer({
|
||||||
Duration seekTo = Duration.zero,
|
Duration seekTo = Duration.zero
|
||||||
Duration? duration,
|
|
||||||
}) async {
|
}) async {
|
||||||
if (_instance == null) return;
|
if (_instance == null) return;
|
||||||
// 设置倍速
|
// 设置倍速
|
||||||
@@ -636,7 +635,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 自动播放
|
// 自动播放
|
||||||
if (_autoPlay) {
|
if (_autoPlay) {
|
||||||
await playIfExists(duration: duration);
|
await playIfExists();
|
||||||
// await play(duration: duration);
|
// await play(duration: duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -831,20 +830,16 @@ class PlPlayerController {
|
|||||||
/// 播放视频
|
/// 播放视频
|
||||||
/// TODO _duration.value丢失
|
/// TODO _duration.value丢失
|
||||||
Future<void> play(
|
Future<void> play(
|
||||||
{bool repeat = false, bool hideControls = true, dynamic duration}) async {
|
{bool repeat = false, bool hideControls = true}) async {
|
||||||
if (_playerCount.value == 0) return;
|
if (_playerCount.value == 0) return;
|
||||||
// 播放时自动隐藏控制条
|
// 播放时自动隐藏控制条
|
||||||
controls = !hideControls;
|
controls = !hideControls;
|
||||||
// repeat为true,将从头播放
|
// repeat为true,将从头播放
|
||||||
if (repeat) {
|
if (repeat) {
|
||||||
await seekTo(Duration.zero);
|
// await seekTo(Duration.zero);
|
||||||
|
await seekTo(Duration.zero, type: "slider");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 临时fix _duration.value丢失
|
|
||||||
if (duration != null) {
|
|
||||||
_duration.value = duration;
|
|
||||||
updateDurationSecond();
|
|
||||||
}
|
|
||||||
await _videoPlayerController?.play();
|
await _videoPlayerController?.play();
|
||||||
|
|
||||||
await getCurrentVolume();
|
await getCurrentVolume();
|
||||||
|
|||||||
Reference in New Issue
Block a user