update part media item

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-06 20:10:19 +08:00
parent 05119edacb
commit eb9f3cd21c
3 changed files with 23 additions and 6 deletions

View File

@@ -136,11 +136,7 @@ class LiveRoomController extends GetxController {
if (res['status']) { if (res['status']) {
RoomInfoH5Data data = res['data']; RoomInfoH5Data data = res['data'];
roomInfoH5.value = data; roomInfoH5.value = data;
videoPlayerServiceHandler.onVideoDetailChange( videoPlayerServiceHandler.onVideoDetailChange(data, roomId, heroTag);
data,
roomId,
heroTag,
);
} else { } else {
if (res['msg'] != null) { if (res['msg'] != null) {
_showDialog(res['msg']); _showDialog(res['msg']);

View File

@@ -90,7 +90,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
var res = await VideoHttp.videoIntro(bvid: bvid); var res = await VideoHttp.videoIntro(bvid: bvid);
if (res.isSuccess) { if (res.isSuccess) {
VideoDetailData data = res.data; VideoDetailData data = res.data;
videoPlayerServiceHandler.onVideoDetailChange(data, data.cid!, heroTag); videoPlayerServiceHandler.onVideoDetailChange(data, cid.value, heroTag);
if (videoDetail.value.ugcSeason?.id == data.ugcSeason?.id) { if (videoDetail.value.ugcSeason?.id == data.ugcSeason?.id) {
// keep reversed season // keep reversed season
data.ugcSeason = videoDetail.value.ugcSeason; data.ugcSeason = videoDetail.value.ugcSeason;
@@ -517,6 +517,17 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
hasLater.value = videoDetailCtr.sourceType == SourceType.watchLater; hasLater.value = videoDetailCtr.sourceType == SourceType.watchLater;
this.bvid = bvid; this.bvid = bvid;
queryVideoIntro(); queryVideoIntro();
} else {
if (episode is Part) {
final videoDetail = this.videoDetail.value;
videoPlayerServiceHandler.onVideoDetailChange(
episode,
cid,
heroTag,
artist: videoDetail.owner?.name,
cover: videoDetail.pic,
);
}
} }
this.cid.value = cid; this.cid.value = cid;

View File

@@ -1,6 +1,7 @@
import 'package:PiliPlus/models_new/live/live_room_info_h5/data.dart'; import 'package:PiliPlus/models_new/live/live_room_info_h5/data.dart';
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart'; import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
import 'package:PiliPlus/models_new/video/video_detail/data.dart'; import 'package:PiliPlus/models_new/video/video_detail/data.dart';
import 'package:PiliPlus/models_new/video/video_detail/page.dart';
import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart';
import 'package:PiliPlus/plugin/pl_player/models/play_status.dart'; import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
import 'package:PiliPlus/utils/storage_pref.dart'; import 'package:PiliPlus/utils/storage_pref.dart';
@@ -118,6 +119,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
int cid, int cid,
String herotag, { String herotag, {
String? artist, String? artist,
String? cover,
}) { }) {
if (!enableBackgroundPlay) return; if (!enableBackgroundPlay) return;
// if (kDebugMode) { // if (kDebugMode) {
@@ -168,6 +170,14 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
artUri: Uri.parse(data.roomInfo?.cover ?? ''), artUri: Uri.parse(data.roomInfo?.cover ?? ''),
isLive: true, isLive: true,
); );
} else if (data is Part) {
mediaItem = MediaItem(
id: id,
title: data.pagePart ?? '',
artist: artist,
duration: Duration(seconds: data.duration ?? 0),
artUri: Uri.parse(cover ?? ''),
);
} }
if (mediaItem == null) return; if (mediaItem == null) return;
// if (kDebugMode) debugPrint("exist: ${PlPlayerController.instanceExists()}"); // if (kDebugMode) debugPrint("exist: ${PlPlayerController.instanceExists()}");