diff --git a/lib/http/video.dart b/lib/http/video.dart index 09249abd1..e56ce23c7 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -739,18 +739,23 @@ class VideoHttp { } // 视频播放进度 - static Future heartBeat({bvid, cid, progress, realtime}) async { + static Future heartBeat({ + bvid, + cid, + progress, + epid, + seasonId, + subType, + }) async { await Request().post(Api.heartBeat, queryParameters: { // 'aid': aid, 'bvid': bvid, 'cid': cid, - // 'epid': '', - // 'sid': '', - // 'mid': '', + if (epid != null) 'epid': epid, + if (seasonId != null) 'sid': seasonId, + if (epid != null) 'type': 4, + if (subType != null) 'sub_type': subType, 'played_time': progress, - // 'realtime': realtime, - // 'type': '', - // 'sub_type': '', 'csrf': await Request.getCsrf(), }); } diff --git a/lib/pages/bangumi/introduction/controller.dart b/lib/pages/bangumi/introduction/controller.dart index 7467a31ef..cfefc5d08 100644 --- a/lib/pages/bangumi/introduction/controller.dart +++ b/lib/pages/bangumi/introduction/controller.dart @@ -373,7 +373,8 @@ class BangumiIntroController extends CommonController { Future changeSeasonOrbangu(epId, bvid, cid, aid, cover) async { // 重新获取视频资源 VideoDetailController videoDetailCtr = - Get.find(tag: Get.arguments['heroTag']); + Get.find(tag: Get.arguments['heroTag']) + ..epId = epId; this.epId = epId; this.bvid = bvid; videoDetailCtr.bvid = bvid; diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index 025fa421b..9437178f6 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -255,6 +255,10 @@ class VideoDetailController extends GetxController _ => -1, }; + late dynamic epId = Get.parameters['epId']; + late dynamic seasonId = Get.parameters['seasonId']; + late dynamic subType = Get.parameters['type']; + @override void onInit() { super.onInit(); @@ -1042,6 +1046,9 @@ class VideoDetailController extends GetxController cid: cid.value, enableHeart: enableHeart, autoplay: autoplay ?? autoPlay.value, + epid: videoType == SearchType.media_bangumi ? epId : null, + seasonId: videoType == SearchType.media_bangumi ? seasonId : null, + subType: videoType == SearchType.media_bangumi ? subType : null, ); _initSkip(); diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 1d5c325de..5234fac33 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -328,6 +328,15 @@ class _VideoDetailPageState extends State isManual: true, bvid: videoDetailController.bvid, cid: videoDetailController.cid.value, + epid: videoDetailController.videoType == SearchType.media_bangumi + ? videoDetailController.epId + : null, + seasonId: videoDetailController.videoType == SearchType.media_bangumi + ? videoDetailController.seasonId + : null, + subType: videoDetailController.videoType == SearchType.media_bangumi + ? videoDetailController.subType + : null, ); } diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index c8636320f..4ffae7ab7 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -92,6 +92,9 @@ class PlPlayerController { // 记录历史记录 String _bvid = ''; int _cid = 0; + dynamic _epid; + dynamic _seasonId; + dynamic _subType; int _heartDuration = 0; bool _enableHeart = true; @@ -458,6 +461,9 @@ class PlPlayerController { int cid = 0, // 历史记录开关 bool enableHeart = true, + dynamic epid, + dynamic seasonId, + dynamic subType, }) async { try { this.dataSource = dataSource; @@ -476,6 +482,9 @@ class PlPlayerController { _direction.value = direction ?? 'horizontal'; _bvid = bvid; _cid = cid; + _epid = epid; + _seasonId = seasonId; + _subType = subType; _enableHeart = enableHeart; if (_videoPlayerController != null && @@ -1267,6 +1276,9 @@ class PlPlayerController { bool isManual = false, dynamic bvid, dynamic cid, + dynamic epid, + dynamic seasonId, + dynamic subType, }) async { if (!_enableHeart || MineController.anonymity.value || progress == 0) { return; @@ -1287,6 +1299,9 @@ class PlPlayerController { bvid: bvid ?? _bvid, cid: cid ?? _cid, progress: isComplete ? -1 : progress, + epid: epid ?? _epid, + seasonId: seasonId ?? _seasonId, + subType: subType ?? _subType, ); return; } @@ -1297,6 +1312,9 @@ class PlPlayerController { bvid: bvid ?? _bvid, cid: cid ?? _cid, progress: progress, + epid: epid ?? _epid, + seasonId: seasonId ?? _seasonId, + subType: subType ?? _subType, ); } } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index f52061389..fc2bae2d9 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -410,7 +410,7 @@ class Utils { dynamic pic = episode?.cover; dynamic heroTag = Utils.makeHeroTag(cid); Utils.toDupNamed( - '/video?bvid=$bvid&cid=$cid&seasonId=${result['data'].seasonId}&epId=${episode?.epId}', + '/video?bvid=$bvid&cid=$cid&seasonId=${result['data'].seasonId}&epId=${episode?.epId}&type=${result['data'].type}', arguments: { 'pic': pic, 'heroTag': heroTag,