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

修复因查询P2P失败造成的播放问题 #1281

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,25 @@ private void CheckVideoP2PUrls()
// 剔除 P2P CDN URL
if (_mediaInformation.AudioSegments != null)
{
var filteredAudios = _mediaInformation.AudioSegments.Where(p => !p.BaseUrl.Contains("bilivideo.com"));
foreach (var item in filteredAudios)
var filteredAudios = _mediaInformation.AudioSegments.Where(p => !(p.BaseUrl?.Contains("bilivideo.com") ?? false));
if (filteredAudios.Any())
{
item.BaseUrl = item.BackupUrls.FirstOrDefault(p => p.Contains("bilivideo.com")) ?? item.BaseUrl;
foreach (var item in filteredAudios)
{
item.BaseUrl = item.BackupUrls?.FirstOrDefault(p => p?.Contains("bilivideo.com") ?? false) ?? item.BaseUrl;
}
}
}

if (_mediaInformation.VideoSegments != null)
{
var filteredAudios = _mediaInformation.VideoSegments.Where(p => !p.BaseUrl.Contains("bilivideo.com"));
foreach (var item in filteredAudios)
var filteredVideos = _mediaInformation.VideoSegments.Where(p => !(p.BaseUrl?.Contains("bilivideo.com") ?? false));
if (filteredVideos.Any())
{
item.BaseUrl = item.BackupUrls.FirstOrDefault(p => p.Contains("bilivideo.com")) ?? item.BaseUrl;
foreach (var item in filteredVideos)
{
item.BaseUrl = item.BackupUrls?.FirstOrDefault(p => p?.Contains("bilivideo.com") ?? false) ?? item.BaseUrl;
}
}
}
}
Expand Down