diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/NowPlayingBar.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/NowPlayingBar.xaml index 0422b50..9d7c737 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/NowPlayingBar.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/NowPlayingBar.xaml @@ -4,6 +4,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dev="using:DevWinUI" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/GSMTCService/GSMTCService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/GSMTCService/GSMTCService.cs index 8dfa8e0..7e1fe74 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/GSMTCService/GSMTCService.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/GSMTCService/GSMTCService.cs @@ -198,7 +198,7 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService private void MediaManager_OnAnyTimelinePropertyChanged(MediaManager.MediaSession? mediaSession, GlobalSystemMediaTransportControlsSessionTimelineProperties? timelineProperties) { - _dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () => + _dispatcherQueue.TryEnqueue(() => { if (!_mediaManager.IsStarted) return; if (mediaSession == null) @@ -230,7 +230,7 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService private void MediaManager_OnAnyPlaybackStateChanged(MediaManager.MediaSession? mediaSession, GlobalSystemMediaTransportControlsSessionPlaybackInfo? playbackInfo) { - _dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, (() => + _dispatcherQueue.TryEnqueue(() => { if (!_mediaManager.IsStarted) return; if (mediaSession == null) @@ -264,14 +264,14 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService { _scrobbleStopwatch.Stop(); } - })); + }); } private void MediaManager_OnAnyMediaPropertyChanged(MediaManager.MediaSession? mediaSession, GlobalSystemMediaTransportControlsSessionMediaProperties? mediaProperties) { _onMediaPropsChangedTimer?.Debounce(() => { - _dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, async () => + _dispatcherQueue.TryEnqueue(async () => { if (!_mediaManager.IsStarted) return; if (mediaSession == null) @@ -419,13 +419,13 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService } } - private void MediaManager_OnAnySessionOpened(MediaManager.MediaSession mediaSession) + private async void MediaManager_OnAnySessionOpened(MediaManager.MediaSession mediaSession) { if (!_mediaManager.IsStarted) return; if (mediaSession == null) return; RecordMediaSourceProviderInfo(mediaSession); - SendFocusedMessagesAsync().ConfigureAwait(false); + await SendFocusedMessagesAsync(); } private MediaManager.MediaSession? GetCurrentSession() diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs index b7ae0d0..e5eedc2 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs @@ -180,7 +180,11 @@ namespace BetterLyrics.WinUI3.Views var settings = ViewModel.AppSettings.MusicGallerySettings; if (settings.AutoPlay) { - _ = _smtcService.PlayTrackAtAsync(settings.PlayQueueIndex); + Task.Run(async () => + { + await Task.Delay(1000); + _ = _smtcService.PlayTrackAtAsync(settings.PlayQueueIndex); + }); } }