mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
@@ -48,6 +48,7 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
private bool _hasVideo;
|
||||
private bool _isPlaying;
|
||||
private bool _wasPlaying;
|
||||
private bool _shouldLoop;
|
||||
|
||||
public ViewerPanel(ContextObject context)
|
||||
{
|
||||
@@ -70,6 +71,7 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
mediaElement.MediaFailed += MediaFailed;
|
||||
|
||||
buttonPlayPause.Click += TogglePlayPause;
|
||||
buttonLoop.Click += ToggleShouldLoop;
|
||||
buttonTime.Click += (sender, e) => buttonTime.Tag = (string) buttonTime.Tag == "Time" ? "Length" : "Time";
|
||||
buttonMute.Click += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
|
||||
volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
||||
@@ -109,6 +111,23 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldLoop
|
||||
{
|
||||
get => _shouldLoop;
|
||||
private set
|
||||
{
|
||||
if (value == _shouldLoop) return;
|
||||
_shouldLoop = value;
|
||||
OnPropertyChanged();
|
||||
if (!IsPlaying)
|
||||
{
|
||||
IsPlaying = true;
|
||||
|
||||
mediaElement.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BitmapSource CoverArt
|
||||
{
|
||||
get => _coverArt;
|
||||
@@ -169,10 +188,19 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
if (mediaElement == null)
|
||||
return;
|
||||
|
||||
IsPlaying = false;
|
||||
|
||||
mediaElement.MediaPosition = 0;
|
||||
mediaElement.Pause();
|
||||
if (ShouldLoop)
|
||||
{
|
||||
IsPlaying = true;
|
||||
|
||||
mediaElement.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
IsPlaying = false;
|
||||
|
||||
mediaElement.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowViedoControlContainer(object sender, MouseEventArgs e)
|
||||
@@ -266,6 +294,11 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
mediaElement.Play();
|
||||
}
|
||||
|
||||
private void ToggleShouldLoop(object sender, EventArgs e)
|
||||
{
|
||||
ShouldLoop = !ShouldLoop;
|
||||
}
|
||||
|
||||
public void LoadAndPlay(string path, MediaInfo.MediaInfo info)
|
||||
{
|
||||
UpdateMeta(path, info);
|
||||
|
Reference in New Issue
Block a user