-
Notifications
You must be signed in to change notification settings - Fork 441
Open
Labels
approvedThis Proposal has been approved and is ready to be added to the ToolkitThis Proposal has been approved and is ready to be added to the ToolkitchampionA member of the .NET MAUI Toolkit core team has chosen to champion this featureA member of the .NET MAUI Toolkit core team has chosen to champion this featurepending documentationThis feature requires documentationThis feature requires documentationproposalA fully fleshed out proposal describing a new feature in syntactic and semantic detailA fully fleshed out proposal describing a new feature in syntactic and semantic detail📽️ MediaElementIssue/PR that has to do with MediaElementIssue/PR that has to do with MediaElement
Description
Feature name
VideoPlayer_FullScreenStatusChanged
Link to discussion
Progress tracker
- Android Implementation
- iOS Implementation
- MacCatalyst Implementation
- Windows Implementation
- Tizen Implementation
- Unit Tests
- Samples
- Documentation
Summary
API that allows developers to hook a media element event and know the full screen status.
Is it full screen or normal ?
Motivation
In Xamarin times, we already have something to control when the Full Screen status changed (first and third party) and now we have a very mature Media Element in MAUI is about time to start with this.
Detailed Design
/// <summary>
/// Backing store for the <see cref="FullScreenState"/> property.
/// </summary>
public static readonly BindableProperty FullScreenProperty =
BindableProperty.Create(nameof(FullScreenState), typeof(MediaElementScreenState), typeof(MediaElement),
MediaElementScreenState.Default, propertyChanged: OnFullScreenPropertyChanged);
Usage Syntax
public MediaElementPage(MediaElementViewModel viewModel, ILogger<MediaElementPage> logger) : base(viewModel)
{
InitializeComponent();
MediaElement.FullScreenStateChanged += MediaElement_FullScreenStateChanged;
}
void MediaElement_FullScreenStateChanged(object? sender, FullScreenStateChangedEventArgs e) =>
logger.LogInformation("FullScreen State Changed. Old State: {PreviousState}, New State: {NewState}", e.PreviousState, e.NewState);
Drawbacks
I don't see any reason to not do it :)
Alternatives
Before I migrate to MAUI MediaElement I was using Xamarin with Xamarians/MediaPlayer [https://github.com/Xamarians/MediaPlayer] , looks simple enough from a use perspective:
public partial class SegnalesEnVivoPage : ContentPage
{
InitializeComponent();
BindingContext = new SegnalesEnVivoViewModel();
VideoPlayer.FullScreenStatusChanged += VideoPlayer_FullScreenStatusChanged;
}
private void VideoPlayer_FullScreenStatusChanged(object sender, bool value)
{
NavigationPage.SetHasNavigationBar(this, !value);
Shell.SetNavBarIsVisible(this, !value);
frmInformation.IsVisible = !value;
frmBackground.IsVisible = !value;
frmPlayer.Margin = value ? new Thickness(0, 0, 0, 0) : new Thickness(10, 20, 10, 10);
VideoPlayer.HeightRequest = value ? deviceScreenHeight : 240;
InvalidateMeasure();
}
}
Unresolved Questions
Perhaps the above API is a good v1 if it works on all platforms?
And then we iterate on more functionality in later versions?
ne0rrmatrix and tiwahu
Metadata
Metadata
Assignees
Labels
approvedThis Proposal has been approved and is ready to be added to the ToolkitThis Proposal has been approved and is ready to be added to the ToolkitchampionA member of the .NET MAUI Toolkit core team has chosen to champion this featureA member of the .NET MAUI Toolkit core team has chosen to champion this featurepending documentationThis feature requires documentationThis feature requires documentationproposalA fully fleshed out proposal describing a new feature in syntactic and semantic detailA fully fleshed out proposal describing a new feature in syntactic and semantic detail📽️ MediaElementIssue/PR that has to do with MediaElementIssue/PR that has to do with MediaElement
Type
Projects
Status
Proposal Approved