@@ -23,9 +23,9 @@ class LivePlayController extends StateController with GetSingleTickerProviderSta
2323 final String site;
2424 final StopWatchTimer _stopWatchTimer = StopWatchTimer (mode: StopWatchMode .countDown);
2525
26- late Site currentSite = Sites . of (site) ;
26+ late Site currentSite;
2727
28- late LiveDanmaku liveDanmaku = Sites . of (site).liveSite. getDanmaku () ;
28+ late LiveDanmaku liveDanmaku;
2929
3030 PlayerInstanceState playerState = PlayerInstanceState ();
3131
@@ -51,13 +51,13 @@ class LivePlayController extends StateController with GetSingleTickerProviderSta
5151 RxList <LivePlayQuality > qualites = RxList <LivePlayQuality >();
5252
5353 /// 当前清晰度
54- final currentQuality = 0. obs;
54+ final RxInt currentQuality = 0. obs;
5555
5656 /// 线路数据
5757 RxList <String > playUrls = RxList <String >();
5858
5959 /// 当前线路
60- final currentLineIndex = 0. obs;
60+ final RxInt currentLineIndex = 0. obs;
6161
6262 var closeTimes = 240. obs;
6363
@@ -104,6 +104,8 @@ class LivePlayController extends StateController with GetSingleTickerProviderSta
104104 void onInit () {
105105 super .onInit ();
106106 detail.value = room;
107+ currentSite = Sites .of (site);
108+ liveDanmaku = Sites .of (site).liveSite.getDanmaku ();
107109 onInitPlayerState ();
108110 EmojiManager ().preload (site);
109111 debounce (closeTimeFlag, (callback) {
@@ -150,15 +152,16 @@ class LivePlayController extends StateController with GetSingleTickerProviderSta
150152 int line = 0 ,
151153 bool isReCalculate = true ,
152154 }) async {
153- SwitchableGlobalPlayer ().dispose ();
154155 var liveRoom = await currentSite.liveSite.getRoomDetail (
155156 roomId: detail.value! .roomId! ,
156157 platform: detail.value! .platform! ,
157158 );
158159 if (currentSite.id == Sites .iptvSite) {
159160 liveRoom = liveRoom.copyWith (title: detail.value! .title! , nick: detail.value! .nick! );
160161 }
162+
161163 handleCurrentLineAndQuality (reloadDataType: reloadDataType, line: line, isReCalculate: isReCalculate);
164+ detail.value = null ;
162165 detail.value = liveRoom;
163166 if (liveRoom.liveStatus == LiveStatus .unknown) {
164167 if (Get .currentRoute == '/live_play' ) {
@@ -286,12 +289,14 @@ class LivePlayController extends StateController with GetSingleTickerProviderSta
286289 success.value = false ;
287290 return ;
288291 }
292+
289293 qualites.value = playQualites;
290294 if (! hasUseDefaultResolution) {
291295 String userPrefer = settings.preferResolution.value;
292296 List <String > availableQualities = playQualites.map ((e) => e.quality).toList ();
293297 int matchedIndex = availableQualities.indexOf (userPrefer);
294298 // 尝试直接匹配用户偏好的分辨率
299+ log (matchedIndex.toString (), name: "get_play_qualities_error" );
295300 if (matchedIndex != - 1 ) {
296301 currentQuality.value = matchedIndex;
297302 hasUseDefaultResolution = true ;
@@ -311,7 +316,7 @@ class LivePlayController extends StateController with GetSingleTickerProviderSta
311316
312317 getPlayUrl ();
313318 } catch (e) {
314- SmartDialog .showToast ("无法读取视频信息 ,请重新获取" );
319+ SmartDialog .showToast ("读取视频信息失败 ,请重新获取" );
315320 success.value = false ;
316321 }
317322 }
0 commit comments