diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml index 5b1e0ba..1268db0 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml @@ -7,6 +7,7 @@ xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer" xmlns:ffmpeg="clr-namespace:Unosquare.FFmpegMediaElement;assembly=Unosquare.FFmpegMediaElement" mc:Ignorable="d" + Background="#B2454545" d:DesignHeight="449.167" d:DesignWidth="767"> @@ -94,6 +95,10 @@ Visibility="{Binding IsMuted, ElementName=mediaElement, Converter={StaticResource BooleanToVisibilityHiddenConverter}}" /> + + + + @@ -109,10 +114,14 @@ - + + + + + diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs index 1e6cd0c..3249247 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs @@ -44,6 +44,8 @@ namespace QuickLook.Plugin.VideoViewer //}; buttonMute.MouseLeftButtonUp += (sender, e) => mediaElement.IsMuted = !mediaElement.IsMuted; buttonStop.MouseLeftButtonUp += (sender, e) => mediaElement.Stop(); + buttonBackward.MouseLeftButtonUp += (sender, e) => SeekBackward(); + buttonForward.MouseLeftButtonUp += (sender, e) => SeekForward(); mediaElement.MediaErrored += ShowErrorNotification; mediaElement.MediaFailed += ShowErrorNotification; @@ -55,6 +57,24 @@ namespace QuickLook.Plugin.VideoViewer mediaElement = null; } + private void SeekBackward() + { + var pos = Convert.ToDouble(mediaElement.Position); + var len = mediaElement.NaturalDuration; + var delta = TimeSpan.FromSeconds(15).TotalSeconds; + + mediaElement.Position = Convert.ToDecimal(pos - delta < 0 ? 0 : pos - delta); + } + + private void SeekForward() + { + var pos = Convert.ToDouble(mediaElement.Position); + var len = mediaElement.NaturalDuration; + var delta = TimeSpan.FromSeconds(15).TotalSeconds; + + mediaElement.Position = Convert.ToDecimal(pos + delta > len ? len : pos + delta); + } + private void TogglePlayPause(object sender, MouseButtonEventArgs e) { if (mediaElement.IsPlaying)