Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
修复重复进入直播间无法播放的问题 (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richasy authored Sep 25, 2021
1 parent 427cebd commit 859ed02
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,37 +145,34 @@ private async Task LoadPgcDetailAsync(int episodeId, int seasonId = 0, bool isRe
await ChangePgcEpisodeAsync(id);
}

private async Task LoadLiveDetailAsync(int roomId, bool isRefresh)
private async Task LoadLiveDetailAsync(int roomId)
{
if (_liveDetail == null || RoomId != roomId.ToString() || isRefresh)
{
Reset();
IsLive = true;
IsDetailLoading = true;
IsShowReply = false;
RoomId = roomId.ToString();
Reset();
IsLive = true;
IsDetailLoading = true;
IsShowReply = false;
RoomId = roomId.ToString();

try
{
var detail = await Controller.GetLiveRoomDetailAsync(roomId);
_liveDetail = detail;
}
catch (Exception ex)
{
IsDetailError = true;
DetailErrorText = _resourceToolkit.GetLocaleString(LanguageNames.RequestLiveFailed) + $"\n{ex.Message}";
IsDetailLoading = false;
return;
}

InitializeLiveDetail();
try
{
var detail = await Controller.GetLiveRoomDetailAsync(roomId);
_liveDetail = detail;
}
catch (Exception ex)
{
IsDetailError = true;
DetailErrorText = _resourceToolkit.GetLocaleString(LanguageNames.RequestLiveFailed) + $"\n{ex.Message}";
IsDetailLoading = false;

await InitializeUserRelationAsync();
await Controller.ConnectToLiveRoomAsync(roomId);
await ChangeLiveQualityAsync(4);
await Controller.SendLiveHeartBeatAsync();
return;
}

InitializeLiveDetail();
IsDetailLoading = false;

await InitializeUserRelationAsync();
await Controller.ConnectToLiveRoomAsync(roomId);
await ChangeLiveQualityAsync(4);
await Controller.SendLiveHeartBeatAsync();
}

private void InitializeVideoDetail()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public async Task LoadAsync(object vm, bool isRefresh = false)
await LoadPgcDetailAsync(Convert.ToInt32(videoId), seasonId, isRefresh);
break;
case VideoType.Live:
await LoadLiveDetailAsync(Convert.ToInt32(videoId), isRefresh);
await LoadLiveDetailAsync(Convert.ToInt32(videoId));
break;
default:
break;
Expand Down

0 comments on commit 859ed02

Please sign in to comment.