一時停止/再生モードになっているときに再生/一時停止アイコンをビデオに表示したい。そのアイコンは数秒後に消えるはずです。フェードアウト/フェードインアニメーションを適用する最善の方法は何ですか?メディア要素の再生/一時停止アイコンをフェードアウトする - uwp
<MediaElement Name="videoMediaElement" AreTransportControlsEnabled="True" Stretch="Fill" PointerPressed="videoMediaElement_PointerPressed" MediaOpened="videoMediaElement_MediaOpened" CurrentStateChanged="Media_State_Changed" >
<MediaElement.TransportControls>
<MediaTransportControls Background="Red" Foreground="White" IsStopButtonVisible="True" IsStopEnabled="True" IsTextScaleFactorEnabled="True" IsPlaybackRateEnabled="True" IsPlaybackRateButtonVisible="True" IsFastForwardButtonVisible="True" IsFastForwardEnabled="True" IsFastRewindButtonVisible="True" IsFastRewindEnabled="True" />
</MediaElement.TransportControls>
</MediaElement>
<Image x:Name="icon_play" Source="Assets/icon_play.png" Visibility="Collapsed" Opacity="0.5" HorizontalAlignment="Center" Height="100px" Width="100"/>
<Image x:Name="icon_pause" Source="Assets/icon_pause.png" Visibility="Collapsed" Opacity="0.5" HorizontalAlignment="Center" Height="100px" Width="100"/>
private void Media_State_Changed(object sender, RoutedEventArgs args)
{
if (videoMediaElement.CurrentState == MediaElementState.Paused)
{
icon_play.Visibility = Visibility.Visible;
icon_pause.Visibility = Visibility.Collapsed;
}
else if (videoMediaElement.CurrentState == MediaElementState.Playing)
{
icon_pause.Visibility = Visibility.Visible;
icon_play.Visibility = Visibility.Collapsed;
}
}