Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows multi window crash on Full Screen #2256

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4598670
Improve layout and fullscreen handling for MediaElement
ne0rrmatrix Oct 5, 2024
ed6f535
Merge branch 'CommunityToolkit:main' into FixWindowsMultiWindow
ne0rrmatrix Oct 5, 2024
9c87af8
Enable unsafe code, use partial classes, update imports
ne0rrmatrix Oct 5, 2024
3639064
Removed Grid as layouts should only be used if multiple visual elemen…
ne0rrmatrix Oct 15, 2024
851f2af
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Oct 15, 2024
a412a98
Merge branch 'FixWindowsMultiWindow' of https://github.com/ne0rrmatri…
ne0rrmatrix Oct 15, 2024
3425d3a
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Oct 15, 2024
9a61cb7
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Oct 16, 2024
479d2e9
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Oct 20, 2024
6b3371c
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Oct 31, 2024
5a3e171
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Nov 5, 2024
372ce36
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Nov 7, 2024
3ed8820
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Nov 11, 2024
3c02129
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Nov 11, 2024
375254f
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Dec 2, 2024
d8f44da
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Dec 12, 2024
2f9b058
Merge branch 'main' into FixWindowsMultiWindow
brminnick Dec 18, 2024
a403510
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Dec 19, 2024
f3e753d
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Dec 20, 2024
01bc20e
Revert changes to sample pages
ne0rrmatrix Dec 20, 2024
c20d2e5
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Dec 28, 2024
633f420
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Jan 3, 2025
113be81
Merge branch 'main' into FixWindowsMultiWindow
ne0rrmatrix Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,106 +10,107 @@
x:Class="CommunityToolkit.Maui.Sample.Pages.Views.MediaElementCarouselViewPage"
Padding="0, 20, 0, 0"
Title="MediaElement in CarouselView">
<VerticalStackLayout Spacing="12">
<Label HorizontalTextAlignment="Center"
<ScrollView VerticalScrollBarVisibility="Always">
<VerticalStackLayout>
<Label HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
HorizontalOptions="Center"
VerticalOptions="Center"
Text="This page demonstrates that the MediaElement can be used inside of a DataTemplate"
Margin="12,0,12,0"/>
<CarouselView HeightRequest="275" PeekAreaInsets="52" ItemsSource="{Binding ItemSource}">
<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal"
<CarouselView HeightRequest="275" PeekAreaInsets="52" ItemsSource="{Binding ItemSource}">

<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal"
ItemSpacing="24"
SnapPointsAlignment="Center"
SnapPointsType="MandatorySingle" />
</CarouselView.ItemsLayout>
</CarouselView.ItemsLayout>

<CarouselView.ItemTemplate>
<DataTemplate x:DataType="viewModels:MediaElementDataSource">
<Border
<CarouselView.ItemTemplate>
<DataTemplate x:DataType="viewModels:MediaElementDataSource">
<Border
x:Name="CarouselViewBorder"
BackgroundColor="Black"
Padding="5">
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<VerticalStackLayout Spacing="6" HeightRequest="250">
<toolkit:MediaElement
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<VerticalStackLayout Spacing="6" HeightRequest="250">
<toolkit:MediaElement
HeightRequest="200"
x:Name="MediaElement"
ShouldAutoPlay="True"
ShouldAutoPlay="False"
ShouldShowPlaybackControls="True"
Source="{Binding Source, Mode=OneTime}" />
<Label TextColor="White"
<Label TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontAttributes="Bold"
FontSize="18"
Text="{Binding Name, Mode=OneTime}"/>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<Label HorizontalTextAlignment="Center"
</VerticalStackLayout>
</Border>
</DataTemplate>
</CarouselView.ItemTemplate>

</CarouselView>

<Label HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
HorizontalOptions="Center"
VerticalOptions="Center"
Text="Second CarouselView to confirm MediaElement can be used on a Page containing multiple ItemsView controls"
Margin="12,0,12,0"/>
<CarouselView HeightRequest="275" PeekAreaInsets="52" ItemsSource="{Binding ItemSource}">
<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal"

<CarouselView HeightRequest="275" PeekAreaInsets="52" ItemsSource="{Binding ItemSource}">

<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal"
ItemSpacing="24"
SnapPointsAlignment="Center"
SnapPointsType="MandatorySingle" />
</CarouselView.ItemsLayout>
</CarouselView.ItemsLayout>

<CarouselView.ItemTemplate>
<DataTemplate x:DataType="viewModels:MediaElementDataSource">
<Border
<CarouselView.ItemTemplate>
<DataTemplate x:DataType="viewModels:MediaElementDataSource">
<Border
x:Name="CarouselViewBorder"
BackgroundColor="Black"
Padding="5">
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<VerticalStackLayout Spacing="6" HeightRequest="250">
<toolkit:MediaElement
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<VerticalStackLayout Spacing="6" HeightRequest="250">
<toolkit:MediaElement
HeightRequest="200"
x:Name="MediaElement"
ShouldAutoPlay="True"
ShouldAutoPlay="False"
ShouldShowPlaybackControls="True"
Source="{Binding Source, Mode=OneTime}" />
<Label TextColor="White"
<Label TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontAttributes="Bold"
FontSize="18"
Text="{Binding Name, Mode=OneTime}"/>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<Label Text="Swipe Left or Right to see next video"
</VerticalStackLayout>
</Border>
</DataTemplate>
</CarouselView.ItemTemplate>

</CarouselView>

<Label Text="Swipe Left or Right to see next video"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontAttributes="Italic"/>

</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</pages:BasePage>
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,33 @@

<CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModels:MediaElementDataSource">
<Border
x:Name="CollectionViewBorder"
BackgroundColor="Black"
Padding="5">
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<VerticalStackLayout Spacing="6" HeightRequest="250">
<toolkit:MediaElement
HeightRequest="200"
x:Name="MediaElement"
ShouldAutoPlay="True"
ShouldShowPlaybackControls="True"
Source="{Binding Source, Mode=OneTime}" />
<Label TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontAttributes="Bold"
FontSize="18"
Text="{Binding Name, Mode=OneTime}"/>
</VerticalStackLayout>
</Border>
</DataTemplate>
<Grid>
<Border
x:Name="CollectionViewBorder"
BackgroundColor="Black"
Padding="5">
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<VerticalStackLayout Spacing="6" HeightRequest="250">
<toolkit:MediaElement
HeightRequest="200"
x:Name="MediaElement"
ShouldAutoPlay="True"
ShouldShowPlaybackControls="True"
Source="{Binding Source, Mode=OneTime}" />
<Label TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontAttributes="Bold"
FontSize="18"
Text="{Binding Name, Mode=OneTime}"/>
</VerticalStackLayout>
</Border>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>

</CollectionView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace CommunityToolkit.Maui.Sample.Pages.Views;

public class MediaElementMultipleWindowsPage : BasePage<MediaElementMultipleWindowsViewModel>
{
const string buckBunnyMp4Url = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
#if WINDOWS || MACCATALYST
const string buckBunnyMp4Url = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
const string elephantsDreamMp4Url = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4";
readonly Window secondWindow;
#endif
Expand All @@ -21,10 +21,10 @@ public MediaElementMultipleWindowsPage(MediaElementMultipleWindowsViewModel view
secondWindow = new Window(new ContentPage
{
Content = new MediaElement
{
Source = elephantsDreamMp4Url,
ShouldAutoPlay = true
}
{
Source = elephantsDreamMp4Url,
ShouldAutoPlay = true
}
});

Content = new MediaElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<SingleProject>true</SingleProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAotCompatible>true</IsAotCompatible>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
Expand Down
Loading
Loading