Mute video by default

This commit is contained in:
Paddy Xu
2017-06-03 01:59:21 +03:00
parent 1bc193a3b6
commit 438781b7f7
2 changed files with 17 additions and 2 deletions

View File

@@ -24,7 +24,7 @@
Height="16" Width="16" Margin="5,5" Foreground="Gray"
Cursor="Hand" />
<StackPanel DockPanel.Dock="Right" HorizontalAlignment="Center" VerticalAlignment="Center"
Orientation="Horizontal" Margin="10,0,7,0">
Orientation="Horizontal" Margin="10,0,0,0">
<TextBlock FontSize="14"
Text="{Binding Position, ElementName=mediaElement,Converter={StaticResource DecimalToTimeSpanConverter}}" />
<TextBlock FontSize="14" Text=" / " />
@@ -36,7 +36,16 @@
Value="{Binding Position, ElementName=mediaElement}"
Maximum="{Binding NaturalDuration, ElementName=mediaElement, Mode=OneWay}" />
</DockPanel>
<ffmpeg:MediaElement x:Name="mediaElement" />
<Grid>
<ffmpeg:MediaElement x:Name="mediaElement" />
<Border x:Name="buttonMute" VerticalAlignment="Bottom" HorizontalAlignment="Right" Cursor="Hand" Margin="10,10" Width="100" Height="100">
<Border.Background>
<SolidColorBrush Color="Gray" Opacity="0.9"/>
</Border.Background>
<fa:ImageAwesome Icon="VolumeOff"
Height="60" Width="60" Foreground="White" />
</Border>
</Grid>
</DockPanel>
<Label x:Name="errorOverlay" Visibility="Collapsed" Background="#CCAAAAAA" VerticalContentAlignment="Center"
HorizontalContentAlignment="Center">

View File

@@ -22,6 +22,11 @@ namespace QuickLook.Plugin.VideoViewer
_context = context;
buttonPlayPause.MouseLeftButtonUp += TogglePlayPause;
buttonMute.MouseLeftButtonUp += (sender, e) =>
{
mediaElement.IsMuted = false;
buttonMute.Visibility = System.Windows.Visibility.Collapsed;
};
mediaElement.PropertyChanged += ChangePlayPauseButton;
mediaElement.MouseLeftButtonUp += TogglePlayPause;
@@ -67,6 +72,7 @@ namespace QuickLook.Plugin.VideoViewer
public void LoadAndPlay(string path)
{
mediaElement.Source = new Uri(path);
mediaElement.IsMuted = true;
mediaElement.Play();
}