mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
@@ -32,11 +32,12 @@ import 'package:PiliPlus/plugin/pl_player/models/video_fit_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart' show PageUtils;
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
@@ -105,7 +106,7 @@ class PlPlayerController {
|
||||
|
||||
/// 音量控制条
|
||||
final RxDouble volume = RxDouble(
|
||||
Utils.isDesktop ? Pref.desktopVolume : 1.0,
|
||||
PlatformUtils.isDesktop ? Pref.desktopVolume : 1.0,
|
||||
);
|
||||
final setSystemBrightness = Pref.setSystemBrightness;
|
||||
|
||||
@@ -223,7 +224,7 @@ class PlPlayerController {
|
||||
late final bool autoPiP = Pref.autoPiP;
|
||||
bool get isPipMode =>
|
||||
(Platform.isAndroid && Floating().isPipMode) ||
|
||||
(Utils.isDesktop && isDesktopPip);
|
||||
(PlatformUtils.isDesktop && isDesktopPip);
|
||||
late bool isDesktopPip = false;
|
||||
late Rect _lastWindowBounds;
|
||||
|
||||
@@ -320,7 +321,7 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
/// 弹幕权重
|
||||
late final enableTapDm = Utils.isMobile && Pref.enableTapDm;
|
||||
late final enableTapDm = PlatformUtils.isMobile && Pref.enableTapDm;
|
||||
late int danmakuWeight = Pref.danmakuWeight;
|
||||
late RuleFilter filters = Pref.danmakuFilterRule;
|
||||
// 关联弹幕控制器
|
||||
@@ -402,7 +403,7 @@ class PlPlayerController {
|
||||
|
||||
late final bool tempPlayerConf = Pref.tempPlayerConf;
|
||||
|
||||
late int? cacheVideoQa = Utils.isMobile ? null : Pref.defaultVideoQa;
|
||||
late int? cacheVideoQa = PlatformUtils.isMobile ? null : Pref.defaultVideoQa;
|
||||
late int cacheAudioQa = Pref.defaultAudioQa;
|
||||
bool enableHeart = true;
|
||||
|
||||
@@ -797,7 +798,7 @@ class PlPlayerController {
|
||||
);
|
||||
final pp = player.platform!;
|
||||
if (_videoPlayerController == null) {
|
||||
if (Utils.isDesktop) {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
pp.setVolume(this.volume.value * 100);
|
||||
}
|
||||
if (isAnim) {
|
||||
@@ -1339,7 +1340,7 @@ class PlPlayerController {
|
||||
if (this.volume.value != volume) {
|
||||
this.volume.value = volume;
|
||||
try {
|
||||
if (Utils.isDesktop) {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
_videoPlayerController!.setVolume(volume * 100);
|
||||
} else {
|
||||
FlutterVolumeController.updateShowSystemUI(false);
|
||||
@@ -1355,7 +1356,7 @@ class PlPlayerController {
|
||||
volumeTimer = Timer(const Duration(milliseconds: 200), () {
|
||||
volumeIndicator.value = false;
|
||||
volumeInterceptEventStream.value = false;
|
||||
if (Utils.isDesktop) {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
setting.put(SettingBoxKey.desktopVolume, volume.toPrecision(3));
|
||||
}
|
||||
});
|
||||
@@ -1548,7 +1549,7 @@ class PlPlayerController {
|
||||
this.isManualFS = isManualFS;
|
||||
|
||||
if (status) {
|
||||
if (Utils.isMobile) {
|
||||
if (PlatformUtils.isMobile) {
|
||||
hideStatusBar();
|
||||
if (mode == FullScreenMode.none) {
|
||||
return;
|
||||
@@ -1570,7 +1571,7 @@ class PlPlayerController {
|
||||
await enterDesktopFullscreen(inAppFullScreen: inAppFullScreen);
|
||||
}
|
||||
} else {
|
||||
if (Utils.isMobile) {
|
||||
if (PlatformUtils.isMobile) {
|
||||
showStatusBar();
|
||||
if (mode == FullScreenMode.none) {
|
||||
return;
|
||||
@@ -1737,7 +1738,7 @@ class PlPlayerController {
|
||||
// playerStatus.close();
|
||||
// dataStatus.status.close();
|
||||
|
||||
if (Utils.isDesktop && isAlwaysOnTop.value) {
|
||||
if (PlatformUtils.isDesktop && isAlwaysOnTop.value) {
|
||||
windowManager.setAlwaysOnTop(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:auto_orientation/auto_orientation.dart';
|
||||
@@ -49,7 +50,7 @@ Future<void> verticalScreenForTwoSeconds() async {
|
||||
//全向
|
||||
bool allowRotateScreen = Pref.allowRotateScreen;
|
||||
Future<void> autoScreen() async {
|
||||
if (Utils.isMobile && allowRotateScreen) {
|
||||
if (PlatformUtils.isMobile && allowRotateScreen) {
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
// DeviceOrientation.portraitDown,
|
||||
|
||||
@@ -49,10 +49,11 @@ import 'package:PiliPlus/plugin/pl_player/widgets/forward_seek.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/widgets/mpv_convert_webp.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/widgets/play_pause_btn.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -185,7 +186,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
);
|
||||
videoController = plPlayerController.videoController!;
|
||||
|
||||
if (Utils.isMobile) {
|
||||
if (PlatformUtils.isMobile) {
|
||||
Future.microtask(() async {
|
||||
try {
|
||||
FlutterVolumeController.updateShowSystemUI(true);
|
||||
@@ -312,7 +313,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_listener?.cancel();
|
||||
_controlsListener?.cancel();
|
||||
animationController.dispose();
|
||||
if (Utils.isMobile) {
|
||||
if (PlatformUtils.isMobile) {
|
||||
FlutterVolumeController.removeListener();
|
||||
}
|
||||
transformationController.dispose();
|
||||
@@ -505,7 +506,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
videoDetailController.showVP.value =
|
||||
!videoDetailController.showVP.value;
|
||||
},
|
||||
onSecondaryTap: Utils.isMobile
|
||||
onSecondaryTap: PlatformUtils.isMobile
|
||||
? null
|
||||
: () => videoDetailController.showVP.value =
|
||||
!videoDetailController.showVP.value,
|
||||
@@ -981,7 +982,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final double tapPosition = details.localFocalPoint.dx;
|
||||
final double sectionWidth = maxWidth / 3;
|
||||
if (tapPosition < sectionWidth) {
|
||||
if (Utils.isDesktop ||
|
||||
if (PlatformUtils.isDesktop ||
|
||||
!plPlayerController.enableSlideVolumeBrightness) {
|
||||
return;
|
||||
}
|
||||
@@ -1182,7 +1183,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
void _onTapUp(TapUpDetails details) {
|
||||
switch (details.kind) {
|
||||
case ui.PointerDeviceKind.mouse when Utils.isDesktop:
|
||||
case ui.PointerDeviceKind.mouse when PlatformUtils.isDesktop:
|
||||
onTapDesktop();
|
||||
break;
|
||||
default:
|
||||
@@ -1218,7 +1219,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
void _onDoubleTapDown(TapDownDetails details) {
|
||||
switch (details.kind) {
|
||||
case ui.PointerDeviceKind.mouse when Utils.isDesktop:
|
||||
case ui.PointerDeviceKind.mouse when PlatformUtils.isDesktop:
|
||||
onDoubleTapDesktop();
|
||||
break;
|
||||
default:
|
||||
@@ -1244,7 +1245,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
StreamSubscription<bool>? _danmakuListener;
|
||||
|
||||
void _onPointerDown(PointerDownEvent event) {
|
||||
if (Utils.isDesktop) {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
final buttons = event.buttons;
|
||||
final isSecondaryBtn = buttons == kSecondaryMouseButton;
|
||||
if (isSecondaryBtn || buttons == kMiddleMouseButton) {
|
||||
@@ -1827,7 +1828,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
),
|
||||
),
|
||||
if (Utils.isMobile)
|
||||
if (PlatformUtils.isMobile)
|
||||
buildViewPointWidget(
|
||||
videoDetailController,
|
||||
plPlayerController,
|
||||
@@ -2049,7 +2050,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}),
|
||||
],
|
||||
);
|
||||
if (Utils.isDesktop) {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
return Obx(
|
||||
() => MouseRegion(
|
||||
cursor: !plPlayerController.showControls.value && isFullScreen
|
||||
@@ -2554,7 +2555,7 @@ Widget buildSeekPreviewWidget(
|
||||
|
||||
final double scale =
|
||||
plPlayerController.isFullScreen.value &&
|
||||
(Utils.isDesktop || !plPlayerController.isVertical)
|
||||
(PlatformUtils.isDesktop || !plPlayerController.isVertical)
|
||||
? 4
|
||||
: 3;
|
||||
double height = 27 * scale;
|
||||
|
||||
@@ -3,9 +3,9 @@ import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -79,7 +79,7 @@ class BottomControl extends StatelessWidget {
|
||||
onSeek: (e) => onSeek(e, max),
|
||||
);
|
||||
});
|
||||
if (Utils.isDesktop) {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: child,
|
||||
@@ -140,7 +140,7 @@ class BottomControl extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!Utils.isMobile)
|
||||
if (!PlatformUtils.isMobile)
|
||||
buildViewPointWidget(
|
||||
videoDetailController,
|
||||
controller,
|
||||
|
||||
Reference in New Issue
Block a user