improve handling video pop

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-28 18:23:29 +08:00
parent 2b7f8af060
commit 0e2c0db456
5 changed files with 17 additions and 26 deletions

View File

@@ -32,7 +32,7 @@ class MineController extends CommonDataController<FavFolderData, FavFolderData>
// 用户状态 动态、关注、粉丝 // 用户状态 动态、关注、粉丝
final Rx<UserStat> userStat = const UserStat().obs; final Rx<UserStat> userStat = const UserStat().obs;
Rx<ThemeType> themeType = Pref.themeType.obs; final Rx<ThemeType> themeType = Pref.themeType.obs;
ThemeType get nextThemeType => ThemeType get nextThemeType =>
ThemeType.values[(themeType.value.index + 1) % ThemeType.values.length]; ThemeType.values[(themeType.value.index + 1) % ThemeType.values.length];

View File

@@ -90,7 +90,7 @@ class _SavePanelState extends State<SavePanel> {
final currentRoute = Get.currentRoute; final currentRoute = Get.currentRoute;
late final hasRoot = reply.hasRoot(); late final hasRoot = reply.hasRoot();
if (currentRoute.startsWith('/video')) { if (currentRoute == '/videoV') {
final rootId = hasRoot ? reply.root : reply.id; final rootId = hasRoot ? reply.root : reply.id;
uri = uri =

View File

@@ -78,7 +78,7 @@ class _ReplyPageState extends CommonRichTextPubPageState<ReplyPage> {
} }
late final darkVideoPage = late final darkVideoPage =
Get.currentRoute.startsWith('/video') && Pref.darkVideoPage; Get.currentRoute == '/videoV' && Pref.darkVideoPage;
late ThemeData themeData; late ThemeData themeData;
@override @override

View File

@@ -330,13 +330,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
tag: videoDetailController.heroTag, tag: videoDetailController.heroTag,
); );
if (!Get.previousRoute.startsWith('/video')) {
if (Platform.isAndroid && !videoDetailController.setSystemBrightness) {
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
}
PlPlayerController.setPlayCallBack(null);
}
if (!videoDetailController.isFileSource) { if (!videoDetailController.isFileSource) {
if (videoDetailController.isUgc) { if (videoDetailController.isUgc) {
ugcIntroController ugcIntroController

View File

@@ -57,6 +57,7 @@ import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart'; import 'package:media_kit_video/media_kit_video.dart';
import 'package:native_device_orientation/native_device_orientation.dart'; import 'package:native_device_orientation/native_device_orientation.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:screen_brightness_platform_interface/screen_brightness_platform_interface.dart';
import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:window_manager/window_manager.dart'; import 'package:window_manager/window_manager.dart';
@@ -281,10 +282,6 @@ class PlPlayerController with BlockConfigMixin {
return _isVideoPage(routing.current); return _isVideoPage(routing.current);
} }
static bool get _isPreviousVideoPage {
return _isVideoPage(Get.previousRoute);
}
static bool _isVideoPage(String routeName) { static bool _isVideoPage(String routeName) {
return routeName == '/videoV' || routeName == '/liveRoom'; return routeName == '/videoV' || routeName == '/liveRoom';
} }
@@ -301,12 +298,6 @@ class PlPlayerController with BlockConfigMixin {
} }
} }
void _disableAutoEnterPipIfNeeded() {
if (!_isPreviousVideoPage) {
_disableAutoEnterPip();
}
}
void _disableAutoEnterPip() { void _disableAutoEnterPip() {
if (_shouldSetPip) { if (_shouldSetPip) {
Utils.channel.invokeMethod('setPipAutoEnterEnabled', { Utils.channel.invokeMethod('setPipAutoEnterEnabled', {
@@ -1636,10 +1627,6 @@ class PlPlayerController with BlockConfigMixin {
if (!_isCloseAll && _playerCount > 1) { if (!_isCloseAll && _playerCount > 1) {
_playerCount -= 1; _playerCount -= 1;
_heartDuration = 0; _heartDuration = 0;
// called after pop
if (!_isCurrVideoPage) {
pause();
}
return; return;
} }
@@ -1798,11 +1785,22 @@ class PlPlayerController with BlockConfigMixin {
void onPopInvokedWithResult(bool didPop, Object? result) { void onPopInvokedWithResult(bool didPop, Object? result) {
if (didPop) { if (didPop) {
if (Platform.isAndroid) { if (playerStatus.isPlaying) {
_disableAutoEnterPipIfNeeded(); pause();
} }
setPlayCallBack(null);
if (Platform.isAndroid && _playerCount <= 1) {
_disableAutoEnterPip();
if (!setSystemBrightness) {
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
}
}
return; return;
} }
if (controlsLock.value) { if (controlsLock.value) {
onLockControl(false); onLockControl(false);
return; return;