Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-04 10:20:14 +08:00
parent a000e2262c
commit 4973176868
4 changed files with 18 additions and 17 deletions

View File

@@ -88,11 +88,13 @@ class _LiveRoomPageState extends State<LiveRoomPage>
@override @override
Future<void> didPopNext() async { Future<void> didPopNext() async {
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
plPlayerController
..isLive = true
..danmakuController = _liveRoomController.danmakuController;
PlPlayerController.setPlayCallBack(plPlayerController.play); PlPlayerController.setPlayCallBack(plPlayerController.play);
plPlayerController.danmakuController =
_liveRoomController.danmakuController;
_liveRoomController.startLiveTimer(); _liveRoomController.startLiveTimer();
if (plPlayerController.playerStatus.playing) { if (plPlayerController.playerStatus.playing &&
plPlayerController.cid == null) {
_liveRoomController _liveRoomController
..danmakuController?.resume() ..danmakuController?.resume()
..startLiveMsg(); ..startLiveMsg();

View File

@@ -415,6 +415,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
plPlayerController?.isLive = false;
if (videoDetailController.plPlayerController.playerStatus.status.value == if (videoDetailController.plPlayerController.playerStatus.status.value ==
PlayerStatus.playing && PlayerStatus.playing &&
videoDetailController.playerStatus != PlayerStatus.playing) { videoDetailController.playerStatus != PlayerStatus.playing) {

View File

@@ -106,7 +106,7 @@ class PlPlayerController {
final RxBool _controlsLock = false.obs; final RxBool _controlsLock = false.obs;
final RxBool _isFullScreen = false.obs; final RxBool _isFullScreen = false.obs;
// 默认投稿视频格式 // 默认投稿视频格式
bool _isLive = false; bool isLive = false;
bool _isVertical = false; bool _isVertical = false;
@@ -130,7 +130,7 @@ class PlPlayerController {
// 记录历史记录 // 记录历史记录
int? _aid; int? _aid;
String? _bvid; String? _bvid;
int? _cid; int? cid;
int? _epid; int? _epid;
int? _seasonId; int? _seasonId;
int? _pgcType; int? _pgcType;
@@ -152,7 +152,6 @@ class PlPlayerController {
// final Durations durations; // final Durations durations;
String get bvid => _bvid!; String get bvid => _bvid!;
int get cid => _cid!;
/// 数据加载监听 /// 数据加载监听
Stream<DataStatus> get onDataStatusChanged => dataStatus.status.stream; Stream<DataStatus> get onDataStatusChanged => dataStatus.status.stream;
@@ -249,9 +248,6 @@ class PlPlayerController {
/// 全屏方向 /// 全屏方向
bool get isVertical => _isVertical; bool get isVertical => _isVertical;
///
bool get isLive => _isLive;
/// 弹幕开关 /// 弹幕开关
late final RxBool enableShowDanmaku = Pref.enableShowDanmaku.obs; late final RxBool enableShowDanmaku = Pref.enableShowDanmaku.obs;
late final RxBool enableShowLiveDanmaku = Pref.enableShowLiveDanmaku.obs; late final RxBool enableShowLiveDanmaku = Pref.enableShowLiveDanmaku.obs;
@@ -574,7 +570,7 @@ class PlPlayerController {
// 如果实例尚未创建,则创建一个新实例 // 如果实例尚未创建,则创建一个新实例
_instance ??= PlPlayerController._(); _instance ??= PlPlayerController._();
_instance! _instance!
.._isLive = isLive ..isLive = isLive
.._playerCount += 1; .._playerCount += 1;
return _instance!; return _instance!;
} }
@@ -607,7 +603,7 @@ class PlPlayerController {
Volume? volume, Volume? volume,
}) async { }) async {
try { try {
_isLive = isLive; this.isLive = isLive;
_videoType = videoType ?? VideoType.ugc; _videoType = videoType ?? VideoType.ugc;
this.width = width; this.width = width;
this.height = height; this.height = height;
@@ -622,7 +618,7 @@ class PlPlayerController {
_isVertical = isVertical ?? false; _isVertical = isVertical ?? false;
_aid = aid; _aid = aid;
_bvid = bvid; _bvid = bvid;
_cid = cid; this.cid = cid;
_epid = epid; _epid = epid;
_seasonId = seasonId; _seasonId = seasonId;
_pgcType = pgcType; _pgcType = pgcType;
@@ -1615,7 +1611,7 @@ class PlPlayerController {
await VideoHttp.heartBeat( await VideoHttp.heartBeat(
aid: aid ?? _aid, aid: aid ?? _aid,
bvid: bvid ?? _bvid, bvid: bvid ?? _bvid,
cid: cid ?? _cid, cid: cid ?? this.cid,
progress: isComplete ? -1 : progress, progress: isComplete ? -1 : progress,
epid: epid ?? _epid, epid: epid ?? _epid,
seasonId: seasonId ?? _seasonId, seasonId: seasonId ?? _seasonId,
@@ -1630,7 +1626,7 @@ class PlPlayerController {
await VideoHttp.heartBeat( await VideoHttp.heartBeat(
aid: aid ?? _aid, aid: aid ?? _aid,
bvid: bvid ?? _bvid, bvid: bvid ?? _bvid,
cid: cid ?? _cid, cid: cid ?? this.cid,
progress: progress, progress: progress,
epid: epid ?? _epid, epid: epid ?? _epid,
seasonId: seasonId ?? _seasonId, seasonId: seasonId ?? _seasonId,
@@ -1680,7 +1676,9 @@ class PlPlayerController {
if (!isCloseAll && _playerCount > 1) { if (!isCloseAll && _playerCount > 1) {
_playerCount -= 1; _playerCount -= 1;
_heartDuration = 0; _heartDuration = 0;
if (!Get.previousRoute.startsWith('/video')) { final previousRoute = Get.previousRoute;
if (!previousRoute.startsWith('/video') &&
!previousRoute.startsWith('/liveRoom')) {
pause(); pause();
} }
return; return;
@@ -1782,7 +1780,7 @@ class PlPlayerController {
queryParameters: { queryParameters: {
// 'aid': IdUtils.bv2av(_bvid), // 'aid': IdUtils.bv2av(_bvid),
'bvid': _bvid, 'bvid': _bvid,
'cid': _cid, 'cid': cid,
'index': 1, 'index': 1,
}, },
options: Options( options: Options(

View File

@@ -440,7 +440,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
return; return;
} }
int? index; int? index;
int currentCid = plPlayerController.cid; int currentCid = plPlayerController.cid!;
String bvid = plPlayerController.bvid; String bvid = plPlayerController.bvid;
List episodes = []; List episodes = [];
if (isSeason) { if (isSeason) {