Reputation: 108
I write an YouTube client for UWP platform and now I'm stuck on fullscreen mode. I've written own video player based on MediaElement
with .
And when I go to fullscreen I get this
So in that case I need to show in fullscreen mode the whole video player control. But I don't know how exactly I supposed to do this. I've already tried this:
private async void fullscreen_Click(object sender, RoutedEventArgs e)
{
if (!fullScreen)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
(Window.Current.Content as Frame).Content = this;
}
else
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
(Window.Current.Content as Frame).Content = mainPageBackup;
}
}
Upvotes: 0
Views: 836
Reputation: 108
Actually there's a one simple solution. Thanks to Alamakanambra's comment (below the question). I just hide everything that I don't need when I go to fullscreen.
I've created an event and get MainPage
and VideoPage
subscribed to it.
public event EventHandler SetFullscreen;
private async void fullscreen_Click(object sender, RoutedEventArgs e)
{
SetFullscreen.Invoke(this, null);
if (!fullScreen)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
(Window.Current.Content as Frame).Content = this;
}
else
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
(Window.Current.Content as Frame).Content = mainPageBackup;
}
}
Upvotes: 0
Reputation: 12465
Set the IsFullWindow property to true;
private void OnFullScreenButtonClick(object sender, EventArgs e)
{
videoSource.IsFullWindow = true;
}
Upvotes: 1