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

Conversation

ne0rrmatrix
Copy link
Contributor

  • Bug fix

Description of Change

Improve layout and fullscreen handling for MediaElement

  • Wrap content in ScrollView in MediaElementCarouselViewPage.xaml
  • Replace Border with Grid in MediaElementCollectionViewPage.xaml
  • Use Grid for complex layout in MediaElementMultipleWindowsPage.cs
  • Add method for foreground window handle in MauiMediaElement.windows.cs
  • Refactor AppWindow retrieval and fullscreen handling logic
  • Add methods for screen size retrieval and popup configuration

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

This does not fix all issues with multi window environments in Windows. There is another issue where snackbar option is enabled crashes the app. I will be creating a bug report for that seperately.

- Wrap content in ScrollView in MediaElementCarouselViewPage.xaml
- Replace Border with Grid in MediaElementCollectionViewPage.xaml
- Use Grid for complex layout in MediaElementMultipleWindowsPage.cs
- Add method for foreground window handle in MauiMediaElement.windows.cs
- Refactor AppWindow retrieval and fullscreen handling logic
- Add methods for screen size retrieval and popup configuration
@ne0rrmatrix ne0rrmatrix self-assigned this Oct 5, 2024
@ne0rrmatrix ne0rrmatrix added the 📽️ MediaElement Issue/PR that has to do with MediaElement label Oct 5, 2024
Modified `CommunityToolkit.Maui.MediaElement.csproj` to allow unsafe code blocks by adding `<AllowUnsafeBlocks>true</AllowUnsafeBlocks>`. Changed `MauiMediaElement` class in `MauiMediaElement.windows.cs` to a partial class. Replaced `DllImport` with `LibraryImport` for `GetForegroundWindow` and marked the method as `internal static partial`.
@ne0rrmatrix ne0rrmatrix requested a review from brminnick October 7, 2024 19:57
@ne0rrmatrix ne0rrmatrix changed the title Fix windows multi window Fix windows multi window crash on Full Screen Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 5 changed files in this pull request and generated no suggestions.

Files not reviewed (3)
  • samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementCarouselViewPage.xaml: Language not supported
  • samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementCollectionViewPage.xaml: Language not supported
  • src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj: Language not supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📽️ MediaElement Issue/PR that has to do with MediaElement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Windows Media Element crash on full screen exit in multi window Environment
2 participants