mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: player key
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -243,6 +243,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
// 播放器状态监听
|
// 播放器状态监听
|
||||||
void playerListener(PlayerStatus? status) async {
|
void playerListener(PlayerStatus? status) async {
|
||||||
try {
|
try {
|
||||||
|
if (videoDetailController.scrollCtr.hasClients) {
|
||||||
bool isPlaying = status == PlayerStatus.playing;
|
bool isPlaying = status == PlayerStatus.playing;
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
if (videoDetailController.isExpanding.not &&
|
if (videoDetailController.isExpanding.not &&
|
||||||
@@ -263,6 +264,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
videoDetailController.scrollKey.currentState?.setState(() {});
|
videoDetailController.scrollKey.currentState?.setState(() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('handle playe status: $e');
|
debugPrint('handle playe status: $e');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,8 +289,6 @@ class PlPlayerController {
|
|||||||
// 播放顺序相关
|
// 播放顺序相关
|
||||||
PlayRepeat playRepeat = PlayRepeat.pause;
|
PlayRepeat playRepeat = PlayRepeat.pause;
|
||||||
|
|
||||||
GlobalKey<VideoState> key = GlobalKey<VideoState>();
|
|
||||||
|
|
||||||
TextStyle get subTitleStyle => TextStyle(
|
TextStyle get subTitleStyle => TextStyle(
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
fontSize:
|
fontSize:
|
||||||
@@ -313,8 +311,10 @@ class PlPlayerController {
|
|||||||
textScaleFactor: MediaQuery.textScalerOf(Get.context!).scale(1),
|
textScaleFactor: MediaQuery.textScalerOf(Get.context!).scale(1),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
late Function getPlayerKey;
|
||||||
|
|
||||||
void updateSubtitleStyle() {
|
void updateSubtitleStyle() {
|
||||||
key.currentState?.update(
|
getPlayerKey().currentState?.update(
|
||||||
subtitleViewConfiguration: subtitleViewConfiguration,
|
subtitleViewConfiguration: subtitleViewConfiguration,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
late BangumiIntroController? bangumiIntroController;
|
late BangumiIntroController? bangumiIntroController;
|
||||||
|
|
||||||
final GlobalKey _playerKey = GlobalKey();
|
final GlobalKey _playerKey = GlobalKey();
|
||||||
|
final GlobalKey<VideoState> key = GlobalKey<VideoState>();
|
||||||
|
|
||||||
final RxBool _mountSeekBackwardButton = false.obs;
|
final RxBool _mountSeekBackwardButton = false.obs;
|
||||||
final RxBool _mountSeekForwardButton = false.obs;
|
final RxBool _mountSeekForwardButton = false.obs;
|
||||||
@@ -160,7 +161,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
plPlayerController.key = GlobalKey<VideoState>();
|
|
||||||
animationController = AnimationController(
|
animationController = AnimationController(
|
||||||
vsync: this, duration: const Duration(milliseconds: 100));
|
vsync: this, duration: const Duration(milliseconds: 100));
|
||||||
videoController = plPlayerController.videoController!;
|
videoController = plPlayerController.videoController!;
|
||||||
@@ -169,6 +169,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
plPlayerController.headerControl = widget.headerControl;
|
plPlayerController.headerControl = widget.headerControl;
|
||||||
plPlayerController.bottomControl = widget.bottomControl;
|
plPlayerController.bottomControl = widget.bottomControl;
|
||||||
plPlayerController.danmuWidget = widget.danmuWidget;
|
plPlayerController.danmuWidget = widget.danmuWidget;
|
||||||
|
plPlayerController.getPlayerKey = () => key;
|
||||||
defaultBtmProgressBehavior = GStorage.setting.get(
|
defaultBtmProgressBehavior = GStorage.setting.get(
|
||||||
SettingBoxKey.btmProgressBehavior,
|
SettingBoxKey.btmProgressBehavior,
|
||||||
defaultValue: BtmProgressBehavior.values.first.code);
|
defaultValue: BtmProgressBehavior.values.first.code);
|
||||||
@@ -898,7 +899,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
flipY: plPlayerController.flipY.value,
|
flipY: plPlayerController.flipY.value,
|
||||||
child: Video(
|
child: Video(
|
||||||
fill: widget.fill ?? Colors.black,
|
fill: widget.fill ?? Colors.black,
|
||||||
key: plPlayerController.key,
|
key: key,
|
||||||
controller: videoController,
|
controller: videoController,
|
||||||
controls: NoVideoControls,
|
controls: NoVideoControls,
|
||||||
pauseUponEnteringBackgroundMode:
|
pauseUponEnteringBackgroundMode:
|
||||||
|
|||||||
Reference in New Issue
Block a user