Playlists and Background Media (connected standy)

Topics: Windows 8 Xaml
Dec 9, 2013 at 1:18 AM
Edited Dec 9, 2013 at 1:26 AM
I have a couple of questions regarding capabilities and usage of the PlayList plugin of the Media Player framework.
  1. Does the Playlist plugin internally use the 'dual media element' hack as prescribed by Microsoft (support forums atleast)? (here are the links and Irrespective of the mechanism used, does the Playlist plugin help keeping Media streams alive in Connected Standby?
Asking because I've tried almost everything using a Media element and even this hack doesn't work when a Surface RT goes into connected standby. It works for the first song after connected standby and then goes kaput if you are playing Media from KnownMediaDevices like UPNP servers (this is because Windows has yanked the Network card from under you in Connected Standby).

So I guess the real question is, do I get this behavior for 'free' if I use the Playlist Plugin.
  1. Secondly, is there some guidance on how to use the Playlist Plugin if I wanted to setup the List at runtime. Most of the forum questions are kind of incompletely answered.
I have tried this - in a Blank Windows 8.1 app, I have the following XAML in MainPage.xaml:
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <PlayerFramework:MediaPlayer Background="Beige" Name="Player" HorizontalAlignment="Left" Height="768" Margin="294,0,0,0" VerticalAlignment="Top" Width="1072" AutoLoadPlugins="False" InteractiveActivationMode="All" />
        <Button Content="Select Files" HorizontalAlignment="Left" Margin="-3,-3,0,0" VerticalAlignment="Top" Height="85" Width="295" Click="Button_Click"/>
        <Button Content="Play" Name="Play" HorizontalAlignment="Left" Margin="-3,176,0,0" VerticalAlignment="Top" Height="147" Width="295" Click="Button_Click_1"/>
In the Code Behind I have the following:
public PlaylistPlugin PlPlugin { get; set; }
public MainPage()
    PlPlugin = new PlaylistPlugin();

private async void Button_Click(object sender, RoutedEventArgs e)
    FileOpenPicker filePicker = new FileOpenPicker();
    filePicker.ViewMode = PickerViewMode.Thumbnail;
    filePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
    filePicker.SettingsIdentifier = "picker1";
    filePicker.CommitButtonText = "Open Music Files";

    var files = await filePicker.PickMultipleFilesAsync();
    if (files.Count > 0)
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async () =>
            PlPlugin.Playlist = new ObservableCollection<PlaylistItem>();
            foreach (var item in files)
                var sourceStream = await item.OpenAsync(Windows.Storage.FileAccessMode.Read);
                PlPlugin.Playlist.Add(new PlaylistItem { SourceStream = sourceStream });
            Player.SetSource(PlPlugin.Playlist[0].SourceStream, "audio");

private void Button_Click_1(object sender, RoutedEventArgs e)
The Player plays the first song and then throws an Object Reference not set to instance of an object.

Basically I want to select a bunch of files using a File Picker and then play them sequentially.

In the above code I am trying to open all the selected files at once, that's a nasty implementation but that too doesn't seem to work. What am I doing wrong?
I am using the latest December 2013 build.

Thanks and Regards,