The WPF MediaElement displays both videos and images. This seems nice, because I want to show a playlist containing both videos and images.
In the MediaEnded event handler, I change the source, which then triggers the playback of the next video.
<MediaElement Name="Player" Source="{Binding MediaSource}" MediaEnded="Player_MediaEnded" />
private void Player_MediaEnded(object sender, RoutedEventArgs e)
{
MediaSource = "the_next_file.jpg";
}
But... When setting the Source to an image file, this image is always displayed for 5 seconds.
Question
I want to define the number of seconds that image is visible. But there does not seem to be a way to do that.
Whatever I do... images are always displayed for 5 seconds
Have you tried setting the MediaClock when an image is the source so that you can control how long it's displayed?
See https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.mediaelement.clock?view=windowsdesktop-7.0#system-windows-controls-mediaelement-clock