How to add new playlist and playback after MediaPlayer initialized?

Topics: Windows 8 Xaml
Aug 22, 2012 at 7:37 AM
Edited Aug 22, 2012 at 7:39 AM

1. I created new MediaPlayer without source by using XAML language.


<Grid Style="{StaticResource LayoutRootStyle}">
    <mmppf:MediaPlayer x:Name="player"/>



2. Add new source to PlaylistPlugin by using C#.

PlaylistPlugin plugin = new PlaylistPlugin();
plugin.Playlist = new ObservableCollection<PlaylistItem>(new[] { 
        new PlaylistItem() { Source = new Uri("") },             
        new PlaylistItem() { Source = new Uri("") }, });

It cannot playback automatically when added new playlist completely.

 The CurrentPlaylistItem cannot be replaced because MediaPlayer had been initialized.

 Could you share some sample code for changing the playlist dynamically?



Aug 23, 2012 at 10:58 PM

Hello, the code you pasted below does automatically start playing the first playlistitem. To prevent it from automatically starting, you can set plugin.AutoLoad = false then call plugin.GoToNextPlaylistItem() to start again.

Does this answer your question?