diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs index 81f2c5e..98066c7 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs @@ -21,6 +21,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.CompilerServices; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -110,7 +111,27 @@ namespace QuickLook.Plugin.VideoViewer try { CoverArt = null; - mediaElement?.Dispose(); + if (mediaElement.IsOpening) + { + void DelayedDisposeEvent(object sender, PropertyChangedEventArgs propertyChangedEventArgs) + { + var me = (Unosquare.FFME.MediaElement) sender; + + if (propertyChangedEventArgs.PropertyName != nameof(me.IsPlaying)) + return; + if (me.IsPlaying != true) + return; + + me.PropertyChanged -= DelayedDisposeEvent; + me.IsMuted = true; + Task.Delay(200).ContinueWith(t => me.Dispose()); + } + + mediaElement.PropertyChanged += DelayedDisposeEvent; + } + else + mediaElement.Dispose(); + mediaElement = null; } catch (Exception e) diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.common.dll b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.common.dll index ba41780..18a6b95 100644 Binary files a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.common.dll and b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.common.dll differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.win.dll b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.win.dll index 197ef17..ded9ef7 100644 Binary files a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.win.dll and b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ffme/ffme.win.dll differ