From be46c5528b639c8ae8e8970eef74532a48362799 Mon Sep 17 00:00:00 2001 From: Richasy Date: Thu, 23 Jan 2025 21:54:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20AOT=20=E9=81=97=E7=95=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=88=E6=90=9C=E7=B4=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20/=20=E5=8E=9F=E7=94=9F=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=99=A8=E5=B4=A9=E6=BA=83=EF=BC=89=20(#986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复 AOT 残留问题 * 修复原生播放器崩溃的问题 --- src/Desktop/BiliCopilot.UI/BiliCopilot.UI.csproj | 2 +- .../BiliCopilot.UI/Controls/Core/Player/NativePlayer.cs | 9 ++++++++- .../Controls/Core/Player/PlayerResources.xaml | 8 +------- .../Controls/Search/UserSectionDetailControl.xaml | 2 +- .../NativePlayerViewModel.Overrides.cs | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Desktop/BiliCopilot.UI/BiliCopilot.UI.csproj b/src/Desktop/BiliCopilot.UI/BiliCopilot.UI.csproj index b97a9e07..5b59341c 100644 --- a/src/Desktop/BiliCopilot.UI/BiliCopilot.UI.csproj +++ b/src/Desktop/BiliCopilot.UI/BiliCopilot.UI.csproj @@ -1645,7 +1645,7 @@ False False - False + True True Assets\logo.ico diff --git a/src/Desktop/BiliCopilot.UI/Controls/Core/Player/NativePlayer.cs b/src/Desktop/BiliCopilot.UI/Controls/Core/Player/NativePlayer.cs index 3e030f83..fc23ab47 100644 --- a/src/Desktop/BiliCopilot.UI/Controls/Core/Player/NativePlayer.cs +++ b/src/Desktop/BiliCopilot.UI/Controls/Core/Player/NativePlayer.cs @@ -30,7 +30,14 @@ protected async override void OnControlLoaded() /// protected override void OnApplyTemplate() - => _playerElement = (MediaPlayerElement)GetTemplateChild("PlayerElement"); + { + var rootGrid = GetTemplateChild("RootGrid") as Grid; + _playerElement = new MediaPlayerElement(); + _playerElement.HorizontalAlignment = HorizontalAlignment.Stretch; + _playerElement.VerticalAlignment = VerticalAlignment.Stretch; + _playerElement.AreTransportControlsEnabled = false; + rootGrid.Children.Add(_playerElement); + } /// protected override async void OnViewModelChanged(NativePlayerViewModel? oldValue, NativePlayerViewModel? newValue) diff --git a/src/Desktop/BiliCopilot.UI/Controls/Core/Player/PlayerResources.xaml b/src/Desktop/BiliCopilot.UI/Controls/Core/Player/PlayerResources.xaml index ff2dfb7e..6cad752c 100644 --- a/src/Desktop/BiliCopilot.UI/Controls/Core/Player/PlayerResources.xaml +++ b/src/Desktop/BiliCopilot.UI/Controls/Core/Player/PlayerResources.xaml @@ -91,13 +91,7 @@ - - - + diff --git a/src/Desktop/BiliCopilot.UI/Controls/Search/UserSectionDetailControl.xaml b/src/Desktop/BiliCopilot.UI/Controls/Search/UserSectionDetailControl.xaml index 121dce2b..9617801a 100644 --- a/src/Desktop/BiliCopilot.UI/Controls/Search/UserSectionDetailControl.xaml +++ b/src/Desktop/BiliCopilot.UI/Controls/Search/UserSectionDetailControl.xaml @@ -18,7 +18,7 @@ - + diff --git a/src/Desktop/BiliCopilot.UI/ViewModels/Core/NativePlayerViewModel/NativePlayerViewModel.Overrides.cs b/src/Desktop/BiliCopilot.UI/ViewModels/Core/NativePlayerViewModel/NativePlayerViewModel.Overrides.cs index fc8c5a45..36a2a61a 100644 --- a/src/Desktop/BiliCopilot.UI/ViewModels/Core/NativePlayerViewModel/NativePlayerViewModel.Overrides.cs +++ b/src/Desktop/BiliCopilot.UI/ViewModels/Core/NativePlayerViewModel/NativePlayerViewModel.Overrides.cs @@ -140,7 +140,7 @@ protected override async Task OnLoadPlayDataAsync() await LoadDashVideoSourceAsync(); } - _element.SetMediaPlayer(Player); + _element?.SetMediaPlayer(Player); } ///