-
Notifications
You must be signed in to change notification settings - Fork 46
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
Cannot replace a media item or seek in Exoplayer when adding a listener #929
Comments
Here is an example implementation. It is in sample app under views. MediaElement page. CommunityToolkit/Maui#2076 |
Stacktrace:
|
Added minimal reproduction. |
Hey @moljac! Thanks for doing the Media3 bindings! Any chance you could help us resolve this? My guess is that we're missing a binding in the new Media3 libraries. We're blocked from porting |
Do you need the The issue may be you are providing: public void OnPositionDiscontinuity (int reason) { } while the void OnPositionDiscontinuityDeprecated (int reason) { ... } |
Yes we need the iPlayer listener. It is critical. We use it extensively and will continue to need it while we support legacy APIs and for monitoring many things currently. |
I'm not suggesting you remove |
Yes I would be happy to do that! Sorry I was confused there. It is the Maui Community toolkit. I did not add the stubs. They have been there since I started helping out last year. I will go through them and remove the ones we are not using. The sample I provided was just a ripped sample that I made up in an afternoon as I did not want to link a huge sample app with many other things listed. I am currently working on migrating the Dotnet Maui Community toolkit to use media 3. |
The implementation stubs are required or the app will crash. Even when empty they do something. BTW I have tried other media 3 nugets which with very minor changes to the code I have do work 100 percent of the time. I have tested https://www.nuget.org/packages/Anjo.Android.Media3.ExoPlayer and it works out of the box with little to no modifications. I can't use that as it would not be allowed at all. The source is unavailable and not on GitHub in a public repo. But if it is indeed media 3 and the same as what you have done I have to think that this is a binding issue and not an issue with my code. |
It's not an issue with your implementation, it's because Anjo's and the others are mostly copies of the work I've done here: Baseflow/ExoPlayerXamarin#166 I think I had this issue too all the way back when Media3 was still ExoPlayer, I ended up removing the deprecated methods (https://github.com/ArchangelWTF/ExoPlayerXamarin/blob/22591a98b8448f1b716c1cb74d2c700164c54361/Media3.Common/Transforms/Metadata.xml#L11) as well as setting the entire listener class to abstract(https://github.com/ArchangelWTF/ExoPlayerXamarin/blob/22591a98b8448f1b716c1cb74d2c700164c54361/Media3.Common/Transforms/Metadata.xml#L17) to force them to be fully implemented by people trying to use the Listener (because otherwise the app would crash anyway) There was a reason I removed the deprecated methods over renaming but I cant remember what it was, it might be related to the crash. Maybe that gives some pointers for the AndroidX maintainers to fix the issue. |
This needs to be implemented
The second one is not used and if removed causes app to crash while seeking. It still needs to be there as a stub. The first one is used by our app to provide video dimensions to developers. |
Android application type
Not applicable
Affected platform version
VS 2022, Dotnet Maui 8.0.21, Dotnet 8.x
Description
When enabling
PlayerListener
interface I am having issues with**Java.Lang.AbstractMethodError:** 'abstract method "void androidx.media3.common.Player$Listener.onPositionDiscontinuity(int)"'
on adding a media item or seeking. If I never add the listener exoplayer has no issues. This worked previously with version 2 and I have updated it to support version 3. Adding any media item using any available method and then attempting to change it crashes the app. Seeking using timeline or by implementing seek method has same result.Note: The log output below contains the crash info for when you scrub the timeline.
Steps to Reproduce
IPlayerListener
Did you find any workaround?
Do not implement the listener or do not enable it when changing media or scrubbing the timeline. Either will solve issue.
Relevant log output
The text was updated successfully, but these errors were encountered: