You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MAUIELEMENT.Handler?.DisconnectHandler() throws an ObjectDisposedException when the MediaElement is wrapped in a ContentView inside a CollectionView.
This issue occurs only when the MediaElement is wrapped in a ContentView (e.g., the VideoPlayer in the reproduction repository). If the MediaElement itself is used as the ItemTemplate, the DisconnectHandler() works as expected.
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] (
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: