From 42bdc41f5789c8f26e6f96505267eebef7416a4b Mon Sep 17 00:00:00 2001 From: Rafael Rosa Date: Fri, 2 Jun 2023 13:05:54 -0300 Subject: [PATCH 1/3] chore: make it works (cherry picked from commit bc55d55a02c78458deb9e8f1c9470804884f78ff) --- .../Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs b/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs index ca344a87257a..58fa1b85762b 100644 --- a/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs +++ b/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs @@ -766,11 +766,12 @@ private void OnControlsBoundsChanged() _mediaPlayer is { } && XamlRoot?.Content is UIElement root) { + var marginBottom = XamlRoot.Size.Height - m_tpControlPanelGrid.LayoutSlot.Height - m_tpControlPanelGrid.RelativePosition.Y; var bounds = new Rect( 0, 0, m_tpControlPanelGrid.ActualWidth, - _isShowingControls ? m_tpControlPanelGrid.ActualHeight : 0 + _isShowingControls ? m_tpControlPanelGrid.ActualHeight + (marginBottom > 0 ? marginBottom : 0) : 0 ); var transportBounds = TransformToVisual(root).TransformBounds(bounds); From a4460e1c661aba1af67429a6d829fc44fee709cb Mon Sep 17 00:00:00 2001 From: Rafael Rosa Date: Fri, 2 Jun 2023 18:54:03 -0300 Subject: [PATCH 2/3] chore: fix for Height (cherry picked from commit 1680ff860b4c3d1242d71c0fbf3ec5bdf37e7a03) --- .../MediaTransportControls.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs b/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs index 58fa1b85762b..14d49f32c6e3 100644 --- a/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs +++ b/src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs @@ -766,18 +766,21 @@ private void OnControlsBoundsChanged() _mediaPlayer is { } && XamlRoot?.Content is UIElement root) { - var marginBottom = XamlRoot.Size.Height - m_tpControlPanelGrid.LayoutSlot.Height - m_tpControlPanelGrid.RelativePosition.Y; - var bounds = new Rect( - 0, - 0, - m_tpControlPanelGrid.ActualWidth, - _isShowingControls ? m_tpControlPanelGrid.ActualHeight + (marginBottom > 0 ? marginBottom : 0) : 0 - ); - var transportBounds = TransformToVisual(root).TransformBounds(bounds); - - _mediaPlayer.SetTransportControlBounds(transportBounds); + var slot = m_tpControlPanelGrid + .TransformToVisual(m_tpControlPanelGrid.Parent as UIElement) + .TransformBounds(m_tpControlPanelGrid.LayoutSlotWithMarginsAndAlignments); + slot.Height += m_tpControlPanelGrid.Padding.Top + + m_tpControlPanelGrid.Padding.Bottom + + Margin.Top + + Margin.Bottom; + if (!_isShowingControls) + { + slot.Height = 0; + } + _mediaPlayer.SetTransportControlBounds(slot); } } + private void OnPaneGridTapped(object sender, TappedRoutedEventArgs e) { if (ShowAndHideAutomatically) From b899040fb1a71207427d31f0faa43b40a467ecca Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Sat, 3 Jun 2023 10:40:19 -0400 Subject: [PATCH 3/3] fix(mpe): fix for macOS failure on not available player --- src/AddIns/Uno.UI.MediaPlayer.Skia.Gtk/VideoView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Uno.UI.MediaPlayer.Skia.Gtk/VideoView.cs b/src/AddIns/Uno.UI.MediaPlayer.Skia.Gtk/VideoView.cs index 845bafe9a5b6..1511497b4cd4 100644 --- a/src/AddIns/Uno.UI.MediaPlayer.Skia.Gtk/VideoView.cs +++ b/src/AddIns/Uno.UI.MediaPlayer.Skia.Gtk/VideoView.cs @@ -233,7 +233,12 @@ private void AttachToWidget() if (_videoWindow is null) { - throw new InvalidOperationException($"_videoWindow cannot be null"); + if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) + { + this.Log().Debug($"{GetHashCode():X8} Skipping AttachToWidget (no video window available)"); + } + + return; } // Reparent the window to the current window, so it appears inside, positioned outside the bounds of the window