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
Future<void> didPopNext() async {
WidgetsBinding.instance.addObserver(this);
plPlayerController
..isLive = true
..danmakuController = _liveRoomController.danmakuController;
PlPlayerController.setPlayCallBack(plPlayerController.play);
plPlayerController.danmakuController =
_liveRoomController.danmakuController;
_liveRoomController.startLiveTimer();
if (plPlayerController.playerStatus.playing) {
if (plPlayerController.playerStatus.playing &&
plPlayerController.cid == null) {
_liveRoomController
..danmakuController?.resume()
..startLiveMsg();

View File

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

View File

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

View File

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