Add Support for Multiple ItemViews in MediaElement
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) orChampioned(feature/proposal) - [ ] Has tests (if omitted, state reason in description)
- [x] Has samples (if omitted, state reason in description)
- [x] Rebased on top of
mainat 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.
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 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?
I've just seen this 😅