Merge pull request #408 from orz12/opt-deep-router-danmaku

尝试优化视频导航有多层时弹幕所占资源
This commit is contained in:
guozhigq
2024-01-17 00:08:51 +08:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@ -125,7 +125,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: DanmakuView( child: DanmakuView(
createdController: (DanmakuController e) async { createdController: (DanmakuController e) async {
widget.playerController.danmakuController = _controller = e; playerController.danmakuController = _controller = e;
}, },
option: DanmakuOption( option: DanmakuOption(
fontSize: 15 * fontSizeVal, fontSize: 15 * fontSizeVal,
@ -135,7 +135,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
hideScroll: blockTypes.contains(2), hideScroll: blockTypes.contains(2),
hideBottom: blockTypes.contains(4), hideBottom: blockTypes.contains(4),
duration: duration:
danmakuDurationVal / widget.playerController.playbackSpeed, danmakuDurationVal / playerController.playbackSpeed,
// initDuration / // initDuration /
// (danmakuSpeedVal * widget.playerController.playbackSpeed), // (danmakuSpeedVal * widget.playerController.playbackSpeed),
), ),

View File

@ -213,6 +213,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
videoIntroController.isPaused = true; videoIntroController.isPaused = true;
plPlayerController!.removeStatusLister(playerListener); plPlayerController!.removeStatusLister(playerListener);
plPlayerController!.pause(); plPlayerController!.pause();
plPlayerController!.danmakuController?.pause();
plPlayerController!.danmakuController?.clear();
} }
super.didPushNext(); super.didPushNext();
} }