I just started playing around with windows 8 development and I'm trying to figure out how to make a video whose source is from a url pop to full screen from either a button press or by double clicking on the area where the video is playing. Any idea on how to do that? As a followup, i'd also have to be able to minimize it back to it's normal playing window. Any ideas on how to do this using xaml C#?
Asked
Active
Viewed 2,588 times
2 Answers
2
The player framework has a boolean property called IsFullScreen to manage the fullscreen state. However, you need to do the work yourself to hide extra elements on the page and/or resize the mediaplayer. The recommended approach is to set this property and handle the IsFullScreenChanged event. For example:
<Grid Style="{StaticResource LayoutRootStyle}" x:Name="LayoutRoot">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="LeftPanel" Background="Red" Width="40"/>
<mmppf:MediaPlayer x:Name="player" Grid.Column="1" IsFullScreenVisible="True" Source="http://smf.blob.core.windows.net/samples/videos/wildlife.mp4"/>
</Grid>
public MainPage()
{
this.InitializeComponent();
player.DoubleTapped += player_DoubleTapped;
player.IsFullScreenChanged += player_IsFullScreenChanged;
}
void player_IsFullScreenChanged(object sender, RoutedPropertyChangedEventArgs<bool> e)
{
LeftPanel.Visibility = e.NewValue ? Visibility.Collapsed : Visibility.Visible;
}
void player_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
player.IsFullScreen = !player.IsFullScreen;
}
Note: there is also a property on MediaPlayer call IsFullScreenVisible that you can set to true to show the fullscreen toggle button in the default control strip.

Tim Greenfield
- 567
- 5
- 9
1
I used this code for fullWindow. It works but in full window it uses default transportcontrols
private void MediaPlayer_IsFullScreenChanged(object sender, Windows.UI.Xaml.RoutedPropertyChangedEventArgs<bool> e)
{
Microsoft.PlayerFramework.MediaPlayer mp = (sender as Microsoft.PlayerFramework.MediaPlayer);
mp.IsFullWindow = !mp.IsFullWindow;
}

canbax
- 3,432
- 1
- 27
- 44