diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 19be9280..3708cdb4 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -311,10 +311,10 @@ class PlPlayerController { textScaleFactor: MediaQuery.textScalerOf(Get.context!).scale(1), ); - late Function getPlayerKey; + Function? getPlayerKey; void updateSubtitleStyle() { - getPlayerKey().currentState?.update( + getPlayerKey?.call()?.currentState?.update( subtitleViewConfiguration: subtitleViewConfiguration, ); } diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 0fbecb7e..bb1412c1 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -161,6 +161,7 @@ class _PLVideoPlayerState extends State @override void initState() { super.initState(); + plPlayerController.getPlayerKey = () => key; animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 100)); videoController = plPlayerController.videoController!; @@ -169,7 +170,6 @@ class _PLVideoPlayerState extends State plPlayerController.headerControl = widget.headerControl; plPlayerController.bottomControl = widget.bottomControl; plPlayerController.danmuWidget = widget.danmuWidget; - plPlayerController.getPlayerKey = () => key; defaultBtmProgressBehavior = GStorage.setting.get( SettingBoxKey.btmProgressBehavior, defaultValue: BtmProgressBehavior.values.first.code);