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

Commit

Permalink
在视频加载后去除封面
Browse files Browse the repository at this point in the history
  • Loading branch information
Richasy committed Jan 17, 2021
1 parent 2f2ef6f commit c899dd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion BiliBili-UWP/BiliBili-UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<AppxPackageDir>D:\Package\BiliBili\</AppxPackageDir>
<GenerateTestArtifacts>False</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>x86|x64|arm|arm64</AppxBundlePlatforms>
<AppxBundlePlatforms>arm64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
<PackageCertificateThumbprint>19DE3251AB16B9B0D867892B047B3BB7FF135FF9</PackageCertificateThumbprint>
Expand Down
12 changes: 7 additions & 5 deletions BiliBili-UWP/Components/Controls/VideoPlayer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ public async Task RefreshVideoSource(int partId, int progress = 0, bool needRefr
VideoMTC.IsInit = true;
if (_player.AutoPlay)
Resume();
//mediaElement.PosterSource = null;
}
else
ErrorContainer.Visibility = Visibility.Visible;
Expand Down Expand Up @@ -607,6 +608,7 @@ public async Task RefreshVideoSource(Episode part, bool isRefresh = false, int p
VideoMTC.IsInit = true;
if (_player.AutoPlay)
Resume();
mediaElement.PosterSource = null;
}
else
{
Expand Down Expand Up @@ -1119,7 +1121,7 @@ private async Task<MediaSource> HandleDashSource()
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")))
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)
Expand Down Expand Up @@ -1576,12 +1578,12 @@ public bool AutoLoop

// Using a DependencyProperty as the backing store for AutoLoop. This enables animation, styling, binding, etc...
public static readonly DependencyProperty AutoLoopProperty =
DependencyProperty.Register("AutoLoop", typeof(bool), typeof(VideoPlayer), new PropertyMetadata(false,new PropertyChangedCallback(AutoLoop_Changed)));
DependencyProperty.Register("AutoLoop", typeof(bool), typeof(VideoPlayer), new PropertyMetadata(false, new PropertyChangedCallback(AutoLoop_Changed)));

private static void AutoLoop_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var instance = d as VideoPlayer;
if(instance._player!=null)
if (instance._player != null)
instance._player.IsLoopingEnabled = (bool)e.NewValue;
}

Expand Down Expand Up @@ -1625,7 +1627,7 @@ private void DefaultTimer_Tick(object sender, object e)
//弹幕加载
if (DanmakuControls == null)
return;
if (mediaElement.MediaPlayer!=null && 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 Expand Up @@ -1731,7 +1733,7 @@ private void FontInit()
public async void ResetDanmakuStatus()
{
bool isShow = AppTool.GetBoolSetting(Settings.IsDanmakuOpen);
if (isShow && DanmakuControls!=null)
if (isShow && DanmakuControls != null)
{
DanmakuControls.Width = 100;
await Task.Delay(100);
Expand Down

0 comments on commit c899dd0

Please sign in to comment.