Skip to content

Conversation

ne0rrmatrix
Copy link
Contributor

Description of Change

Add missing media3 Stub OnPositionDiscontinuity back to Android MediaManager class

PR Classification

New feature to enhance media playback handling.

PR Summary

This pull request introduces a new method to improve the media manager's ability to respond to playback position changes.

  • MediaManager.android.cs: Added the OnPositionDiscontinuity method with parameters for old and new positions and a reason.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

This is the last Stub I had forgotten to add back. There was a specific reason why I removed it. dotnet/android-libraries#929 & dotnet/android-libraries#949

There are issues with having it and not having this specific stub in media element. I am not sure exactly what issues it will generate by adding it back now. It may cause no problem for developers. But I do remember that it was excluded for a reason that caused actual issues for some people. I don't remember what issues as it was a while back.

@ne0rrmatrix ne0rrmatrix added needs discussion Discuss it on the next Monthly standup 📽️ MediaElement Issue/PR that has to do with MediaElement labels Jul 30, 2025
@ne0rrmatrix ne0rrmatrix marked this pull request as ready for review August 3, 2025 22:48
@Copilot Copilot AI review requested due to automatic review settings August 3, 2025 22:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds back a missing media3 stub method OnPositionDiscontinuity to the Android MediaManager class that was previously removed due to compatibility issues. The change addresses issue #2824 by restoring the stub implementation that handles position discontinuity events in media playback.

  • Adds the OnPositionDiscontinuity stub method to maintain interface compliance with media3 APIs

@VladislavAntonyuk VladislavAntonyuk removed the needs discussion Discuss it on the next Monthly standup label Aug 7, 2025
Introduced a new method `OnMetadata(Metadata? metadata)`
to handle updates related to media metadata in the
MediaManager.android.cs file.
@jonmdev
Copy link
Contributor

jonmdev commented Sep 11, 2025

Is there any update or timeline on when this might be getting merged and the nuget updated? Getting it functional would be very helpful. Thanks for your help.

@bijington is there anything else that needs to be done for it?

@bijington
Copy link
Contributor

@jonmdev i don't know. I'm concerned by this statement

There are issues with having it and not having this specific stub in media element. I am not sure exactly what issues it will generate by adding it back now. It may cause no problem for developers. But I do remember that it was excluded for a reason that caused actual issues for some people. I don't remember what issues as it was a while back.

@ne0rrmatrix What is the status of this? Do you believe this is tested enough to move forward?

@ne0rrmatrix
Copy link
Contributor Author

@jonmdev i don't know. I'm concerned by this statement

There are issues with having it and not having this specific stub in media element. I am not sure exactly what issues it will generate by adding it back now. It may cause no problem for developers. But I do remember that it was excluded for a reason that caused actual issues for some people. I don't remember what issues as it was a while back.

@ne0rrmatrix What is the status of this? Do you believe this is tested enough to move forward?

I think we should move forward with this PR. It will solve many issues and bug reports that we have had.

@tpitman
Copy link

tpitman commented Sep 19, 2025

how do i get this into my app based on .net9 maui?

@jonmdev
Copy link
Contributor

jonmdev commented Sep 22, 2025

how do i get this into my app based on .net9 maui?

@ne0rrmatrix if it has been approved (2 weeks ago) what needs to happen next to get it into an updated nuget release so we can consume it normally?

Currently any project with media element just crashes constantly in Android due to this issue. Even on open and close or rewind as this all triggers a position discontinuity.

This is a needed fix to make it usable on Android.

@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) October 10, 2025 18:09
@TheCodeTraveler TheCodeTraveler merged commit 3c77945 into CommunityToolkit:main Oct 10, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📽️ MediaElement Issue/PR that has to do with MediaElement
Projects
None yet
6 participants