[BUG] MediaElement throw ObjectDisposedException when wrapped in CollectionView #2359
Closed
2 tasks done
Labels
bug
Something isn't working
📽️ MediaElement
Issue/PR that has to do with MediaElement
needs reproduction
stale
The author has not responded in over 30 days
unverified
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
The
MAUIELEMENT.Handler?.DisconnectHandler()
throws anObjectDisposedException
when theMediaElement
is wrapped in aContentView
inside aCollectionView
.This issue occurs only when the
MediaElement
is wrapped in aContentView
(e.g., theVideoPlayer
in the reproduction repository). If theMediaElement
itself is used as the ItemTemplate, theDisconnectHandler()
works as expected.Expected Behavior
The
DisconnectHandler()
not throw an exception.Steps To Reproduce
Link to public reproduction project repository
https://github.com/WolfgangPhy/MediaElementInCollectionViewBug.git
Environment
Anything else?
I investigated the issue as thoroughly as I could to identify the root cause. By debugging the
MediaElement
source code, I found that the exception originates here: [SOURCE] (Maui/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
Line 94 in 9741f1a
(My issue might be related to the ExoPlayer issue mentioned in the comments a few lines above.)
You can see a screenshot of the exception here: Source of the exception
Given that the error only occurs when the
MediaElement
is wrapped, I strongly suspect thatCollectionView
recycling is the cause of this issue.The text was updated successfully, but these errors were encountered: