UWP AutoNext Function

Viewed 103

I'm trying to Get a Auto Next method i've tried using a Index Counter but I think I misunderstand how to properly set a list using the FilePicker

The code for the FilePicker is following :

public async void pick_Click_1(object sender, RoutedEventArgs e)
    {

        List<StorageFile> fileList = new List<StorageFile>();

        var fop = new FileOpenPicker();
        fop.FileTypeFilter.Add(".mp3");
        fop.FileTypeFilter.Add(".mp4");
        fop.FileTypeFilter.Add(".avi");
        fop.FileTypeFilter.Add(".wmv");
        fop.ViewMode = PickerViewMode.List;

        pickedFileList = await fop.PickMultipleFilesAsync();
        // add the picked files to our existing list
        fileList.AddRange(pickedFileList);

        foreach (StorageFile file in pickedFileList)
        {
            Playlist.Items.Add(file);

            var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
            videoMediaElement.SetSource(stream, file.ContentType);
        }
        videoMediaElement.Play();

The Current method i have for switching tracks|Videos

        private async void itemclicked(object sender, ItemClickEventArgs e)
    {
        var file = e.ClickedItem as StorageFile;
        if (file != null)
        {
            var stream = await file.OpenReadAsync();
            videoMediaElement.SetSource(stream, file.ContentType);
        }
    }

Empty Event im trying to use to do this.

  private void Element_MediaEnded(object sender, RoutedEventArgs e)
    {



    }

I've looked threw all the Microsoft Sample's. Issue Being They use the Mediaplayerelement += Mediaplayer And im using the MediaElement

The Answers Im looking for Can be A Resolution to my problem or assisting me in better understanding how to globally set the source of the mediaplayer using the Current or new list from the picker, Im new to all this and trying to grasp everything better Thank you!

1 Answers

I ended up taking Tousee's advice to seem's he's my mentor at this stage, I used the MediaplayerElement and mediaPLaybacklist's which made life Easier. And almost instantly fixed my problem.

Related