MediaPlayerElement with Source bound to a MediaPlaybackList shows buffering at startup. How can i fix that?

Andreas LGH 21 Reputation points
2021-07-06T17:57:26.623+00:00

The MediaPlayerElement is linked to a MediaPlaybackList which is still empty when the app starts. As a result, the TransportControls are not displayed in the MediaPlayerElement but only the buffering display. That's rather ugly. Does anyone have a tip how can I change that?

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. AryaDing-MSFT 2,841 Reputation points
    2021-07-08T08:40:49.797+00:00

    Hi,

    Welcome to Microsoft Q&A!

    I can reproduce your issue, this behavior is by design. The MediaPlayerElement control needs to be initialized before use, so the buffering will display for a short time. If you want to improve it, please submit your feature requirement to the Windows Feedback Hub app that is Windows built-in app.


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Andreas LGH 21 Reputation points
    2021-07-07T09:53:28.85+00:00
    The binding is in XAML:
    
    <MediaPlayerElement Grid.Row="0" 
                                x:Uid="mediaPlayer" 
                                x:Name="mediaPlayer"
                                AutoPlay="False"
                                AreTransportControlsEnabled="True" 
                                VerticalContentAlignment="Stretch" 
                                HorizontalContentAlignment="Stretch" 
                                AllowDrop="True" 
                                Opacity="1"
                                Stretch="UniformToFill"
                                Source="{x:Bind MediaPlaylistElement.MediaPlaybackItemsList, Mode=OneWay}">
                <MediaPlayerElement.TransportControls>
                    <MediaTransportControls x:Name="StandardTransportControls" 
                                            IsNextTrackButtonVisible="True" 
                                            IsPreviousTrackButtonVisible="True" 
                                            IsSkipBackwardButtonVisible="True" 
                                            IsSkipBackwardEnabled="True" 
                                            IsSkipForwardButtonVisible="True" 
                                            IsSkipForwardEnabled="True"
                                            IsPlaybackRateButtonVisible="True" 
                                            IsPlaybackRateEnabled="True">
                    </MediaTransportControls>
                </MediaPlayerElement.TransportControls>
            </MediaPlayerElement>
    

  2. Andreas LGH 21 Reputation points
    2021-07-08T10:32:25.617+00:00

    Thank you for your answer. I have solved it.
    I have removed the Source binding in XAML and Check the Source before adding files to the PlaybackList.

    public void CheckMediaPlayerElementSource()
            {
                if (MediaHelper.MediaPlayerElementReference.Source == null || 
                    MediaHelper.MediaPlayerElementReference.Source != MediaPlaybackItemsList)
                    MediaHelper.MediaPlayerElementReference.Source = MediaPlaybackItemsList;
            }
    
    0 comments No comments