mod: 提前关闭封面、点击小电视强制尝试播放

This commit is contained in:
orz12
2024-06-12 18:34:07 +08:00
parent cf725e39d4
commit 2035ae90f3
4 changed files with 29 additions and 8 deletions

View File

@@ -101,6 +101,8 @@ class PlPlayerController {
int _cid = 0;
int _heartDuration = 0;
bool _enableHeart = true;
late DataSource dataSource;
final RxList<Map<String, String>> _vttSubtitles = <Map<String, String>>[].obs;
final RxInt _vttSubtitlesIndex = 0.obs;
@@ -411,6 +413,7 @@ class PlPlayerController {
bool enableHeart = true,
}) async {
try {
this.dataSource = dataSource;
_autoPlay = autoplay;
_looping = looping;
// 初始化视频倍速
@@ -595,6 +598,16 @@ class PlPlayerController {
return player;
}
Future refreshPlayer() async {
await _videoPlayerController?.open(
Media(
dataSource.videoSource!,
httpHeaders: dataSource.httpHeaders,
),
play: true,
);
}
// 开始播放
Future _initializePlayer({
Duration seekTo = Duration.zero,
@@ -1102,6 +1115,8 @@ class PlPlayerController {
Future<void> triggerFullScreen({bool status = true}) async {
FullScreenMode mode = FullScreenModeCode.fromCode(
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
bool removeSafeArea = setting.get(SettingBoxKey.videoPlayerRemoveSafeArea,
defaultValue: false);
if (!isFullScreen.value && status) {
// StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE);
hideStatusBar();
@@ -1124,7 +1139,7 @@ class PlPlayerController {
}
} else if (isFullScreen.value && !status) {
// StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
showStatusBar();
if (!removeSafeArea) showStatusBar();
toggleFullScreen(false);
if (mode == FullScreenMode.none) {
return;

View File

@@ -1043,7 +1043,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
Obx(() {
if (_.dataStatus.loading || _.isBuffering.value) {
return Center(
child: Container(
child: GestureDetector(
onTap: () {
_.refreshPlayer();
},
child:
Container(
padding: const EdgeInsets.all(30),
decoration: const BoxDecoration(
shape: BoxShape.circle,
@@ -1057,7 +1062,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
semanticLabel: "加载中",
),
),
);
));
} else {
return const SizedBox();
}