0
votes

At the moment, I am developing the play video app using UWP. And the media transport controls always auto disapear. And I am trying to prevent that disapearing problem, but no result.

Does anyone have any ideas? Thanks for your help.

2

2 Answers

0
votes

I have just found a solution:
Create a timer, after a time interval (100,200..etc), my app just only set the Position value of MediaElement again, then the media transport controls will continue on screen. Code example like this:

private void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        KeepTransportControlsVisibleTimer = new DispatcherTimer();
        KeepTransportControlsVisibleTimer.Interval = TimeSpan.FromMilliseconds(200);
        KeepTransportControlsVisibleTimer.Tick += KeepTransportControlsVisibleTimer_Tick;

        KeepTransportControlsVisibleTimer.Start();
    }

    private void KeepTransportControlsVisibleTimer_Tick(object sender, object e)
    {
        // just only set the Position value again
        MediaElementControl.Position = MediaElementControl.Position;
    }

If anyone have better solution, please share, thanks.

0
votes

Windows 10 Fall Creators Update (introduced v10.0.16299.0) introduce a simple way to manage this with one new property ShowAndHideAutomatically and two new methods Show() and Hide . You can find Microsoft reference here: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.mediatransportcontrols#Methods but for now your solution is the better....