diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index 7b5b698f..802043c0 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -4,6 +4,7 @@ import 'dart:math'; import 'dart:ui'; import 'package:auto_orientation/auto_orientation.dart'; +import 'package:fl_pip/fl_pip.dart'; import 'package:flutter/services.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -311,15 +312,15 @@ class _VideoDetailPageState extends State autoplay: videoDetailController.autoPlay.value); videoDetailController.autoPlay.value = - !videoDetailController.isShowCover.value; + !videoDetailController.isShowCover.value; print("autoplay:${videoDetailController.autoPlay.value}"); if (videoDetailController.videoType == SearchType.video) { final videoIntroController = - Get.find(tag: Get.arguments['heroTag']); + Get.find(tag: Get.arguments['heroTag']); videoIntroController.videoDetail.refresh(); } else if (videoDetailController.videoType == SearchType.media_bangumi) { final bangumiIntroController = - Get.find(tag: Get.arguments['heroTag']); + Get.find(tag: Get.arguments['heroTag']); bangumiIntroController.bangumiDetail.refresh(); } @@ -558,6 +559,7 @@ class _VideoDetailPageState extends State children: [ // if (isShowing) plPlayer, plPlayer, + /// 关闭自动播放时 手动播放 if (!videoDetailController .autoPlay.value) ...[ @@ -688,6 +690,7 @@ class _VideoDetailPageState extends State child: Stack(children: [ // if (isShowing) plPlayer, plPlayer, + /// 关闭自动播放时 手动播放 if (!videoDetailController.autoPlay.value) ...[ Obx( @@ -781,6 +784,7 @@ class _VideoDetailPageState extends State child: Stack(children: [ // if (isShowing) plPlayer, plPlayer, + /// 关闭自动播放时 手动播放 if (!videoDetailController.autoPlay.value) ...[ Obx( @@ -875,6 +879,7 @@ class _VideoDetailPageState extends State children: [ // if (isShowing) plPlayer, plPlayer, + /// 关闭自动播放时 手动播放 if (!videoDetailController.autoPlay.value) ...[ Obx( @@ -974,6 +979,7 @@ class _VideoDetailPageState extends State children: [ // if (isShowing) plPlayer, plPlayer, + /// 关闭自动播放时 手动播放 if (!videoDetailController.autoPlay.value) ...[ Obx( @@ -1151,6 +1157,20 @@ class _VideoDetailPageState extends State ), ); Widget autoChoose(Widget childWhenDisabled) { + + return PiPBuilder(builder: (PiPStatusInfo? statusInfo) { + print("PiPStatusInfo${statusInfo?.status}"); + switch (statusInfo?.status) { + case PiPStatus.enabled: + return childWhenEnabled; + case PiPStatus.disabled: + return childWhenDisabled; + case PiPStatus.unavailable: + return childWhenDisabled; + case null: + return childWhenDisabled; + } + }); // if (Platform.isAndroid) { // return PiPSwitcher( // childWhenDisabled: childWhenDisabled, @@ -1158,7 +1178,7 @@ class _VideoDetailPageState extends State // floating: floating, // ); // } - return childWhenDisabled; + // return childWhenDisabled; } @override diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index b8b4adf9..125b7de2 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -1621,6 +1621,7 @@ class _HeaderControlState extends State { } print(widget.controller!.dataSource.videoSource); print(widget.controller!.dataSource.audioSource); + widget.controller!.controls = false; FlPiP().enable( ios: FlPiPiOSConfig( videoPath: @@ -1629,10 +1630,13 @@ class _HeaderControlState extends State { widget.controller!.dataSource.audioSource ?? "", packageName: null), android: FlPiPAndroidConfig( - aspectRatio: Rational( - widget.videoDetailCtr!.data.dash!.video!.first.width!, - widget.videoDetailCtr!.data.dash!.video!.first.height!, - ))); + aspectRatio: Rational( + widget.videoDetailCtr!.data.dash!.video!.first.width!, + widget + .videoDetailCtr!.data.dash!.video!.first.height!, + ), + // createNewEngine: true, + )); // bool canUsePiP = widget.floating != null && // await widget.floating!.isPipAvailable; // widget.controller!.hiddenControls(false);