File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
simple_live_app/lib/modules/live_room Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ class LiveRoomController extends PlayerController with WidgetsBindingObserver {
406406 currentLineInfo.value = "线路${currentLineIndex + 1 }" ;
407407 //重置错误次数
408408 mediaErrorRetryCount = 0 ;
409- setPlayer ();
409+ initPlaylist ();
410410 }
411411
412412 void changePlayLine (int index) {
@@ -416,25 +416,33 @@ class LiveRoomController extends PlayerController with WidgetsBindingObserver {
416416 setPlayer ();
417417 }
418418
419- void setPlayer () async {
419+ void initPlaylist () async {
420420 currentLineInfo.value = "线路${currentLineIndex + 1 }" ;
421421 errorMsg.value = "" ;
422422
423- var playurl = playUrls[currentLineIndex];
424- if (AppSettingsController .instance.playerForceHttps.value) {
425- playurl = playurl.replaceAll ("http://" , "https://" );
426- }
423+ final mediaList = playUrls.map ((url) {
424+ var finalUrl = url;
425+ if (AppSettingsController .instance.playerForceHttps.value) {
426+ finalUrl = finalUrl.replaceAll ("http://" , "https://" );
427+ }
428+ return Media (finalUrl, httpHeaders: playHeaders);
429+ }).toList ();
427430
428431 // 初始化播放器并设置 ao 参数
429432 await initializePlayer ();
430433
431434 await player.open (
432- Media (
433- playurl,
434- httpHeaders: playHeaders,
435- ),
435+ Playlist (
436+ mediaList
437+ )
436438 );
437- Log .d ("播放链接\r\n :$playurl " );
439+ }
440+
441+ void setPlayer () async {
442+ currentLineInfo.value = "线路${currentLineIndex + 1 }" ;
443+ errorMsg.value = "" ;
444+
445+ await player.jump (currentLineIndex);
438446 }
439447
440448 @override
You can’t perform that action at this time.
0 commit comments