opt: video: onreset

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-30 15:52:51 +08:00
parent e4fe91ef92
commit 1a327198f7
3 changed files with 27 additions and 13 deletions

View File

@@ -418,11 +418,7 @@ class BangumiIntroController extends CommonController {
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
..plPlayerController.pause()
..makeHeartBeat()
..playedTime = null
..videoUrl = null
..audioUrl = null
..vttSubtitlesIndex = null
..savedDanmaku = null
..onReset()
..epId = epId
..bvid = bvid
..cid.value = cid

View File

@@ -635,6 +635,9 @@ class VideoDetailController extends GetxController
Future _querySponsorBlock() async {
positionSubscription?.cancel();
videoLabel.value = '';
segmentList.clear();
_segmentProgressList = null;
dynamic result = await Request().get(
'${GStorage.blockServer}/api/skipSegments',
queryParameters: {
@@ -643,9 +646,6 @@ class VideoDetailController extends GetxController
},
options: _options,
);
videoLabel.value = '';
segmentList.clear();
_segmentProgressList = null;
_handleSBData(result);
}
@@ -1963,4 +1963,26 @@ class VideoDetailController extends GetxController
tabCtr.dispose();
super.onClose();
}
onReset() {
playedTime = null;
videoUrl = null;
audioUrl = null;
// danmaku
savedDanmaku = null;
// subtitle
vttSubtitlesIndex = null;
_vttSubtitles.clear();
// view point
viewPointList.clear();
// sponsor block
positionSubscription?.cancel();
videoLabel.value = '';
segmentList.clear();
_segmentProgressList = null;
}
}

View File

@@ -583,12 +583,8 @@ class VideoIntroController extends GetxController
final videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag)
..plPlayerController.pause()
..makeHeartBeat()
..playedTime = null
..videoUrl = null
..audioUrl = null
..updateMediaListHistory(aid)
..vttSubtitlesIndex = null
..savedDanmaku = null
..onReset()
..bvid = bvid
..oid.value = aid ?? IdUtils.bv2av(bvid)
..cid.value = cid