Maui icon indicating copy to clipboard operation
Maui copied to clipboard

Add Support for Multiple ItemViews in MediaElement

Open ne0rrmatrix opened this issue 6 months ago • 3 comments

Description of Change

Add Mac/iOS support for multiple Item Views when used in CollectionView or CarouselView when using MediaElement. This also adds support for Multi-Window on iOS.

  • Fixes #2247
  • Fixes #2249

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)
  • [x] 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

This will add feature parity when using CollectionView and CarouselView with iOS and MacOS to match current support in Android and Windows when using Media Element. This adds support for multiple items views and supports multiple windows. This PR is focused on MacOS and iOS only. The required support is already available on other platforms.

ne0rrmatrix avatar Jul 09 '25 15:07 ne0rrmatrix

Sorry I just realized this does not actually work! It does not crash. But it does not provide the correct order of collection view items on page. I still have to work that out. I will continue working on this.

ne0rrmatrix avatar Jul 09 '25 17:07 ne0rrmatrix

@ne0rrmatrix I have an issue when using MediaElement on iOS and wondering if this PR could solve it.

My issue is this: on MAUI ContentPage I have this hierarchy CollectionView -> CollectionView.Header -> DataTemplate -> MediaElement and when I try to play video I get this error: Name: UIViewControllerHierarchyInconsistency Reason: child view controller:<AVPlayerViewController: 0x11abef000> should have parent view controller:<Microsoft_Maui_Controls_Handlers_Items_ReorderableItemsViewController_1: 0x11bdba800> but actual parent is:<Microsoft_Maui_Platform_PageViewController: 0x118bd9fd0> at UIKit.UIView.AddSubview(UIView view) ...

I think code that searcher for iOS media player parent it's written in a way, that if on a ContentPage there is a CollectionView take this as parent, but in may case because player is in Header I need to take Page as a parent. What do you think, can this PR also solve this issue?

dainius-r avatar Jul 09 '25 18:07 dainius-r

I've just seen this 😅

orlandommb avatar Jul 11 '25 12:07 orlandommb