I have an array of 4 songs and i have to play that 4 song in a loop on a image in winUi 3
desktop application. I have played one song on a image and below is my code
mediaPlayer = new MediaPlayer();
mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("www.example.com"));
mediaPlayer.IsLoopingEnabled = true;
mediaPlayer.Play();
But now i have to play 4 song as a playlist. Can anyone help me out
CodePudding user response:
You need to use MediaPlaybackList and MediaPlaybackListItem:
mediaPlayer = new MediaPlayer();
MediaPlaybackList mPlaybackList = new();
mPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("www.example.com")));
mediaPlayer.Source = mPlaybackList;
mediaPlayer.Play();