Problem with stopping video on back press in UWP

I have a UWP app with NavigationView that handles the backstack in different frames. The back press is handled in my MainPage.xaml by the function:

private bool On_BackRequested()
        {
            if (contentFrame.CanGoBack)
            {
                contentFrame.GoBack();
                Debug.WriteLine(contentFrame.);
                return true;
            }
            return false;
        }

But the problem arises when there is a MediaPlayerElement playing videos in a frame. The back press is handled properly but the video doesn't stop playing (I know this because the audio from the video is still playing in the background).

How can I stop the video playback during the back press method? Can I access a certain function from the childframe to stop the video?

#xaml #windows

4 Likes2.05 GEEK