From 49485879410302bc426fadc9d68566dd4825ae8f Mon Sep 17 00:00:00 2001 From: guozhigq Date: Tue, 15 Aug 2023 21:29:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=94=E5=9B=9E=E4=B8=8A=E9=A1=B5?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 5 ++++- lib/plugin/pl_player/controller.dart | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index c4d06c21..2aefbfb1 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -76,7 +76,9 @@ class _VideoDetailPageState extends State videoDetailController.isShowCover.value = false; videoDetailController.loopHeartBeat(); } else { - videoDetailController.timer!.cancel(); + if (videoDetailController.timer != null) { + videoDetailController.timer!.cancel(); + } // 播放完成停止 or 切换下一个 if (status == PlayerStatus.completed) { // 当只有1p或多p未打开自动播放时,播放完成还原进度条,展示控制栏 @@ -98,6 +100,7 @@ class _VideoDetailPageState extends State @override void dispose() { + plPlayerController!.pause(); plPlayerController!.dispose(); if (videoDetailController.timer != null) { videoDetailController.timer!.cancel(); diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 4bbf42ef..5e6a4f15 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -540,7 +540,10 @@ class PlPlayerController { /// 音量 Future getCurrentVolume() async { - _currentVolume.value = await VolumeController().getVolume(); + // mac try...catch + try { + _currentVolume.value = await VolumeController().getVolume(); + } catch (_) {} } Future setVolume(double volumeNew,