question

AndreasLGH-6130 avatar image
0 Votes"
AndreasLGH-6130 asked AndreasLGH-6130 answered

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

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?

windows-uwp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AndreasLGH-6130 I noticed that you used “Source bound”, is MediaBinder the binding you mentioned? If it isn’t, could you please provide us code sample?

0 Votes 0 ·
AryaDing-MSFT avatar image
0 Votes"
AryaDing-MSFT answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasLGH-6130 avatar image
0 Votes"
AndreasLGH-6130 answered AndreasLGH-6130 published
 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>


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

 public MediaPlaybackList MediaPlaybackItemsList { get; private set; } = new MediaPlaybackList();
         #endregion
    
         #region ctor
         public MediaPlaylistElement()
         {
             InitializeComponent();
             MediaPlayerReference = MediaHelper.MediaPlayerElementReference;
             MediaPlaybackItemsList.CurrentItemChanged += OnMediaPlaybackListCurrentItemChanged;
             IsInitializing = false;
         }
         #endregion
0 Votes 0 ·
AndreasLGH-6130 avatar image
0 Votes"
AndreasLGH-6130 answered

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;
         }
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.