Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MediaElement throw ObjectDisposedException when wrapped in CollectionView #2359

Open
2 tasks done
WolfgangPhy opened this issue Nov 25, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working unverified

Comments

@WolfgangPhy
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

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.

Expected Behavior

The DisconnectHandler() not throw an exception.

Steps To Reproduce

  1. Open the app in the reproduction project
  2. Click on the CollectionView button
  3. Click on the go back arrow in the NavigationBar

Link to public reproduction project repository

https://github.com/WolfgangPhy/MediaElementInCollectionViewBug.git

Environment

- .NET MAUI CommunityToolkit: 9.1.1
- OS: Android (not tested on iOS yet)
- .NET MAUI: 8

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] (

).

(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 that CollectionView recycling is the cause of this issue.

@WolfgangPhy WolfgangPhy added bug Something isn't working unverified labels Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant