Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
1. 添加了优先HEVC的设置项,修复此前部分新电影无法播放音频的问题
Browse files Browse the repository at this point in the history
2. 调整新动态通知的弹出顺序
  • Loading branch information
Richasy committed Aug 31, 2020
1 parent 4150f3f commit 55c26a0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion BiliBili-Lib/Tools/NotificationTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ namespace BiliBili_Lib.Tools
{
public class NotificationTool
{
public static void SendDynamicToast(List<NotificationModel> items)
public static async void SendDynamicToast(List<NotificationModel> items)
{
int index = 0;
foreach (var item in items)
{
if (index >= 2)
{
var overflow = GetOverflowToast("更多动态请在应用内查看");
await Task.Delay(500);
ShowToast(overflow, group: "Dynamic");
break;
}
Expand Down
5 changes: 4 additions & 1 deletion BiliBili-UWP/Components/Controls/VideoPlayer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,9 @@ private async Task<MediaSource> HandleDashSource()
if (video == null)
video = data.dash.video.OrderByDescending(p => p.id).FirstOrDefault(p => p.codecid == 7);
var audio = data.dash.audio?.FirstOrDefault();
// 遇到新的电影时,可能出现HEVC音频源,若系统未安装相应解码器,则会解码失败,没有声音
if (!isHevc && data.dash.audio.Any(p=>p.codecs.Contains("mp4a")))
audio = data.dash.audio.Where(p => p.codecs.Contains("mp4a")).FirstOrDefault();
MediaSource source = null;
if (isBangumi)
source = await _animeService.CreateMediaSourceAsync(video, audio);
Expand Down Expand Up @@ -1622,7 +1625,7 @@ private void DefaultTimer_Tick(object sender, object e)
//弹幕加载
if (DanmakuControls == null)
return;
if (mediaElement.MediaPlayer.PlaybackSession.PlaybackState == MediaPlaybackState.Playing && DanmakuList.Count > 0)
if (mediaElement.MediaPlayer!=null && mediaElement.MediaPlayer.PlaybackSession.PlaybackState == MediaPlaybackState.Playing && DanmakuList.Count > 0)
{
int nowDanmaNum = 0;
var currentPosition = mediaElement.MediaPlayer.PlaybackSession.Position.TotalSeconds;
Expand Down
4 changes: 2 additions & 2 deletions BiliBili-UWP/Others/Update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

更新说明:

1. 添加了优先4K的设置项,关闭时将不会主动切换到4K源,以避免部分设备无法播放
2. 修复了视频说明文本的一些显示问题
1. 添加了优先HEVC的设置项,修复此前部分新电影无法播放音频的问题
2. 调整新动态通知的弹出顺序

祝使用愉快,

Expand Down
2 changes: 2 additions & 0 deletions BiliBili-UWP/Pages-Share/Main/SettingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
</ComboBox>
<ToggleSwitch Style="{StaticResource BasicToggleSwitchStyle}" HeaderTemplate="{StaticResource TipHeaderStyle}"
Header="优先4K" x:Name="First4KSwitch" Toggled="First4KSwitch_Toggled" Margin="0,15,0,0"/>
<ToggleSwitch Style="{StaticResource BasicToggleSwitchStyle}" HeaderTemplate="{StaticResource TipHeaderStyle}"
Header="优先HEVC (需要额外的解码器)" x:Name="FirstHEVCSwitch" Toggled="FirstHEVCSwitch_Toggled" Margin="0,15,0,0"/>
<ToggleSwitch Style="{StaticResource BasicToggleSwitchStyle}" HeaderTemplate="{StaticResource TipHeaderStyle}"
Header="自动播放下一P" x:Name="AutoNextPartSwitch" Toggled="AutoNextPartSwitch_Toggled" Margin="0,15,0,0"/>
<ToggleSwitch Style="{StaticResource BasicToggleSwitchStyle}" HeaderTemplate="{StaticResource TipHeaderStyle}"
Expand Down
9 changes: 9 additions & 0 deletions BiliBili-UWP/Pages-Share/Main/SettingPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ protected async override void OnNavigatedTo(NavigationEventArgs e)
PlayerSkipStepBox.Value = playerSkipStep;
bool isFirst4K = AppTool.GetBoolSetting(Settings.IsFirst4K, false);
First4KSwitch.IsOn = isFirst4K;
bool isFirstHEVC = AppTool.GetBoolSetting(Settings.IsUseHevc, false);
FirstHEVCSwitch.IsOn = isFirstHEVC;
bool isShowDanmakuBarInFullWindow = AppTool.GetBoolSetting(Settings.IsShowDanmakuBarInFullWindow);
OpenDanmakuBarInFullWindowSwitch.IsOn = isShowDanmakuBarInFullWindow;
bool isShowDanmakuBarInCinema = AppTool.GetBoolSetting(Settings.IsShowDanmakuBarInCinema);
Expand Down Expand Up @@ -406,5 +408,12 @@ private void First4KSwitch_Toggled(object sender, RoutedEventArgs e)
return;
AppTool.WriteLocalSetting(Settings.IsFirst4K, First4KSwitch.IsOn.ToString());
}

private void FirstHEVCSwitch_Toggled(object sender, RoutedEventArgs e)
{
if (!_isInit)
return;
AppTool.WriteLocalSetting(Settings.IsUseHevc, FirstHEVCSwitch.IsOn.ToString());
}
}
}

0 comments on commit 55c26a0

Please sign in to comment.