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 Back button behavior when Media Element is full screen #1761

Merged

Conversation

ne0rrmatrix
Copy link
Contributor

@ne0rrmatrix ne0rrmatrix commented Mar 18, 2024

  • Bug fix

Description of Change

Adding an override method OnDetachedFromWindow to the MauiMediaElement class. This method ensures that when the view is detached from the window, if the media element is in full screen mode, it will exit full screen mode.

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

Changes:

  • Added an override method OnDetachedFromWindow to the MauiMediaElement class. This method is called when the view is detached from a window. It first calls the base class's OnDetachedFromWindow method.
  • Inside the OnDetachedFromWindow method, it checks if the media element is in full screen mode. If it is, it triggers the OnFullscreenButtonClick event with the argument set to the opposite of isFullScreen, and stops the player. This ensures that when the view is detached from the window, if the media element is in full screen mode, it will exit full screen mode.

…DetachedFromWindow` to the `MauiMediaElement` class. This method ensures that when the view is detached from the window, if the media element is in full screen mode, it will exit full screen mode and stop the player.

Changes:
- Added an override method `OnDetachedFromWindow` to the `MauiMediaElement` class. This method is called when the view is detached from a window. It first calls the base class's `OnDetachedFromWindow` method.
- Inside the `OnDetachedFromWindow` method, it checks if the media element is in full screen mode. If it is, it triggers the `OnFullscreenButtonClick` event with the argument set to the opposite of `isFullScreen`, and stops the player. This ensures that when the view is detached from the window, if the media element is in full screen mode, it will exit full screen mode and stop the player.
@ne0rrmatrix ne0rrmatrix marked this pull request as ready for review March 18, 2024 16:20
ne0rrmatrix and others added 12 commits March 19, 2024 11:13
…n the `MauiMediaElement` class. The player will no longer stop if the view is in full screen mode when detached from the window.

Changes:
- The `OnDetachedFromWindow` method in the `MauiMediaElement` class has been altered. The code that stopped the player when the view was in full screen mode and detached from the window has been removed. The call to the base class's `OnDetachedFromWindow` method is still present. (Reference: `MauiMediaElement` class, `OnDetachedFromWindow` method)
@brminnick brminnick enabled auto-merge (squash) April 27, 2024 23:18
Copy link
Collaborator

@brminnick brminnick left a comment

Choose a reason for hiding this comment

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

Thanks @ne0rrmatrix!

@brminnick brminnick merged commit 3e17a9c into CommunityToolkit:main Apr 27, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Back Button not working in Fullscreen mode
2 participants