I have a single video and I want to repeat the video forever; however, I want the video to repeat before it has completely ended. Unfortunately, the event MediaEnded fires only when the video has finished the video. I am looking for some kind a event like ending, or play, or something like that to do this operation.
string VideoFileLocation = sVideoLocation + @"\video\";
DirectoryInfo df = new DirectoryInfo(VideoFileLocation);
media_Figura1.Source = new Uri(VideoFileLocation + @"\Figuras_loop.mov");
media_Figura1.LoadedBehavior = MediaState.Manual;
if (df.Exists)
{
media_Figura1.Play();
}
else
{
System.Windows.Forms.MessageBox.Show("No se puede cargar el video loop (Figura1)", "Casino Krown");
}
private void media_Figura1_MediaEnded(object sender, RoutedEventArgs e)
{
media_Figura1.UnloadedBehavior = MediaState.Manual;
if (bLoop_1Figura)
{
TimeSpan ts = new TimeSpan(0, 0, 0, 0, 0);
media_Figura1.Position = ts;
}
}
I also would like to leave the last frame of the video visible when it ends instead of the default black screen. Is this possible?
for mor easily solution, you could have 2 videos, 2 mediaElements, and, when the first videoEnded, repeat both mediaElementes media files, and, you can usea a bool variable for determinate how video can play it all second video and stop the first video.
you can use this solution and read the comment of video.