Maui icon indicating copy to clipboard operation
Maui copied to clipboard

Bug fix for MediaElement File Duplication

Open ne0rrmatrix opened this issue 9 months ago • 4 comments

Bug fix

Sample

https://github.com/CommunityToolkit/Maui/assets/4167863/1f481dc4-5f6e-40d3-aefe-3595cfce58a1

Description of Change

The most significant changes to the MauiMediaElement involve modernizing the fullscreen controls by transitioning from using static SVG images to adopting FontIcon elements for better flexibility and visual consistency. This shift enhances the user interface and interaction model for entering and exiting fullscreen mode. The key changes include:

  1. Removal of fullscreen.svg Resource: The static fullscreen.svg image resource was removed, indicating a move away from static images for the fullscreen button.
  2. Introduction of Font Icons for Fullscreen Controls: Replacing the Image with FontIcon elements for fullscreen controls, utilizing glyphs from the "Segoe MDL2 Assets" font for a more flexible and accessible approach.
  3. Adjustments to Fullscreen Button Logic: The logic for toggling between the fullscreen and exit fullscreen buttons was refined, including the dynamic addition and removal of buttons and event handlers based on the fullscreen state.
  4. UI and Styling Adjustments: Several UI and styling adjustments were made to improve the appearance and positioning of the fullscreen controls, such as setting the buttons' background to transparent and adjusting their size and margin.
  5. Removal of Static Image Source for Fullscreen Button: The static image source for the fullscreen button was removed, aligning with the shift towards a font icon-based approach for controls.
  6. Event Handling Adjustments: Minor adjustments were made to event handling, particularly in managing the visibility of the button container in response to pointer movements, ensuring intuitive user interactions.

These changes collectively enhance the MauiMediaElement by making the fullscreen controls more adaptable, visually consistent, and user-friendly.

Linked Issues

  • Fixes #1862

PR Checklist

  • [x] 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)
  • [x] Rebased on top of main at time of PR
  • [x] Changes adhere to coding standard
  • [ ] Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Fixes an issue where if you create a visual studio project and add a second project to it and then add media element to both projects will result in a file duplication error when attempting to build the project. This bug is fixed by not using a file image source and switching to using a FontIcon.

ne0rrmatrix avatar May 09 '24 03:05 ne0rrmatrix

@mhrastegari Thank you for the excellent suggestions. Good catch! PR has been updated as you suggested.

ne0rrmatrix avatar May 09 '24 17:05 ne0rrmatrix

Happy to help 🥰 @ne0rrmatrix

mhrastegari avatar May 09 '24 17:05 mhrastegari

I have downloaded the nuget and tested it against my project and both issues are resolved (Exiting full screen works ok, and there is no duplicate file error).

briankanelson avatar May 09 '24 22:05 briankanelson

@pictos I updated it as requested.

ne0rrmatrix avatar May 09 '24 23:05 ne0rrmatrix