The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
[UWP] Transport controls are hidden. Why ? RRS feed

  • Question

  • I have MediaPlayerElement to play video.

    But TransportControls are hidden at all. Or it is visible sometimes. But then hidden. And if I click on video it doens' apper again.

    My Code.

    Xaml

    <Page
        x:Class="VideoThumbnail.VideoPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:VideoThumbnail"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
       
        <Grid Background="Black">
            <MediaPlayerElement x:Name="MediaElement" AreTransportControlsEnabled="True"></MediaPlayerElement>
            <TextBlock>Video</TextBlock>
        </Grid>
    </Page>

    C#

    protected async override void OnNavigatedTo(NavigationEventArgs e)
            {
                var video = e.Parameter as Video;
                var file = await StorageFile.GetFileFromPathAsync(video.FilePath);
                this.MediaElement.Source = MediaSource.CreateFromStorageFile(file);
                //this.MediaElement.MediaPlayer.Source = MediaSource.CreateFromStorageFile(file);
                //this.MediaElement.MediaPlayer.Source = MediaSource.CreateFromStorageFile(file);
                //this.MediaElement.AreTransportControlsEnabled = true;
                //this.MediaElement.AutoPlay = true;
                this.MediaElement.MediaPlayer.Play();
                //this.MediaElement.TransportControls.IsPlaybackRateButtonVisible = true;
                //this.MediaElement.TransportControls.IsVolumeButtonVisible = true;
            }




    • Edited by SmartWhy Monday, December 5, 2016 1:55 PM
    • Edited by Jayden Gu Tuesday, December 6, 2016 2:29 AM title tag
    Monday, December 5, 2016 1:54 PM

Answers

  • Hi SmartWhy,

    It seems it is caused by the TextBlock. It is covered on the MediaPlayerElement that when we move the mouse the TransportControls will not show.

    So you be should able to set value to the Height or Width of the TextBlock. If we do not set Height or Width, it will fill the Grid. 


    Best Regards,

    Jayden Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by SmartWhy Tuesday, December 6, 2016 10:34 AM
    Tuesday, December 6, 2016 2:29 AM

All replies

  • Hi SmartWhy,

    It seems it is caused by the TextBlock. It is covered on the MediaPlayerElement that when we move the mouse the TransportControls will not show.

    So you be should able to set value to the Height or Width of the TextBlock. If we do not set Height or Width, it will fill the Grid. 


    Best Regards,

    Jayden Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by SmartWhy Tuesday, December 6, 2016 10:34 AM
    Tuesday, December 6, 2016 2:29 AM
  • So stupid bug.

    I spent 3 days on it.

    Thanks !

    Tuesday, December 6, 2016 10:35 AM