mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-13 19:19:10 +00:00
async Vlc disposal
This commit is contained in:
@@ -19,6 +19,7 @@ using System;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Meta.Vlc;
|
using Meta.Vlc;
|
||||||
@@ -34,13 +35,13 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChanged
|
public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private readonly ContextObject _context;
|
private readonly ContextObject _context;
|
||||||
|
|
||||||
private string _coverArt;
|
private string _coverArt;
|
||||||
private bool _hasAudio;
|
private bool _hasAudio;
|
||||||
private bool _hasEnded;
|
private bool _hasEnded;
|
||||||
private bool _hasVideo;
|
private bool _hasVideo;
|
||||||
private bool _isMuted;
|
private bool _isMuted;
|
||||||
private bool _isPlaying;
|
private bool _isPlaying;
|
||||||
|
|
||||||
private bool _wasPlaying;
|
private bool _wasPlaying;
|
||||||
|
|
||||||
public ViewerPanel(ContextObject context)
|
public ViewerPanel(ContextObject context)
|
||||||
@@ -163,15 +164,16 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//if (mediaElement != null && !mediaElement.VlcMediaPlayer.CanPlay)
|
Task.Run(() =>
|
||||||
// Thread.Sleep(200);
|
{
|
||||||
mediaElement?.Dispose();
|
mediaElement?.Dispose();
|
||||||
|
mediaElement = null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(e);
|
Debug.WriteLine(e);
|
||||||
}
|
}
|
||||||
mediaElement = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
Reference in New Issue
Block a user