fix: 返回上页停止播放

This commit is contained in:
guozhigq
2023-08-15 21:29:05 +08:00
parent eb38dfc313
commit 4948587941
2 changed files with 8 additions and 2 deletions

View File

@ -76,7 +76,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
videoDetailController.isShowCover.value = false;
videoDetailController.loopHeartBeat();
} else {
if (videoDetailController.timer != null) {
videoDetailController.timer!.cancel();
}
// 播放完成停止 or 切换下一个
if (status == PlayerStatus.completed) {
// 当只有1p或多p未打开自动播放时播放完成还原进度条展示控制栏
@ -98,6 +100,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
@override
void dispose() {
plPlayerController!.pause();
plPlayerController!.dispose();
if (videoDetailController.timer != null) {
videoDetailController.timer!.cancel();

View File

@ -540,7 +540,10 @@ class PlPlayerController {
/// 音量
Future<void> getCurrentVolume() async {
// mac try...catch
try {
_currentVolume.value = await VolumeController().getVolume();
} catch (_) {}
}
Future<void> setVolume(double volumeNew,