From 1844ea71eb28d0e8042f4392314180889c998075 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Sun, 7 May 2023 14:24:44 -0500 Subject: [PATCH] Ensure that PlayerInterop is always used on the UI thread --- ZuneImpl/Playback/PlayerInteropAudioService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ZuneImpl/Playback/PlayerInteropAudioService.cs b/ZuneImpl/Playback/PlayerInteropAudioService.cs index 7850471..c3b2ec2 100644 --- a/ZuneImpl/Playback/PlayerInteropAudioService.cs +++ b/ZuneImpl/Playback/PlayerInteropAudioService.cs @@ -91,8 +91,11 @@ namespace Microsoft.Zune.Playback private void PlaybackWrapper_UriSet(object sender, EventArgs e) { - _playbackWrapper.UriSet -= PlaybackWrapper_UriSet; - _playbackWrapper.Play(); + Iris.Application.DeferredInvoke(new Iris.DeferredInvokeHandler(delegate + { + _playbackWrapper.UriSet -= PlaybackWrapper_UriSet; + _playbackWrapper.Play(); + }), Iris.DeferredInvokePriority.Normal); } public async Task Preload(PlaybackItem sourceConfig, CancellationToken cancellationToken = default)