UWP application executing sequences of videos in MediaElement coming from a Liststring

0

I'm using Media Element in an application UWP to run a sequence of videos, how do I do when one video ends the other runs in sequence?

In the code below when the first video of List<string> videos10 ends the other one of the sequence does not run

My idea is to make the function SequenciaDeVideosNoArquivoTexto(); receive a sequence of video names from a text file.

So with the text file I will have total control of the video sequence that I will constantly change.

    public MainPage()
    {
        this.InitializeComponent();

        SequenciaDeVideosNoArquivoTexto();
    }


    private void SequenciaDeVideosNoArquivoTexto()
    {
        //A LIST ABAIXO FAREI PEGAR AS INFORMAÇÕES DO ARQUIVO TEXTO
        List<string> videos10 = new List<string>();
        videos10.Add("Call Farma");
        videos10.Add("Dia Mundial");
        videos10.Add("Dolex Nueva");
        videos10.Add("Mori Farma");

        foreach (var item in videos10)
        {
            LoadMediaFromString("ms-appx:///Videos/" + item + ".mp4");
        }
    }


    private void LoadMediaFromString(string path)
    {
        try
        {
            Uri pathUri = new Uri(path);
            mediaPlayer.Source = pathUri;
        }
        catch (Exception ex)
        {

            if(ex is FormatException)
            {

            }

            throw;
        }
    }
    
asked by anonymous 03.01.2018 / 02:07

1 answer

0

You should use the MediaPlaybackList(); object, add your videos to that playlist, and then assign it as the source of your player.

Reference

    
03.01.2018 / 14:06