androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.67k stars 397 forks source link

evaluateMediaItemTransitionReason - IllegalStateException #1005

Closed captain81 closed 8 months ago

captain81 commented 9 months ago

Version

Media3 1.2.1

More version details

java.lang.IllegalStateException at com.oplus.tbl.exoplayer2.ExoPlayerImpl.evaluateMediaItemTransitionReason(ExoPlayerImpl.java:18) at com.oplus.tbl.exoplayer2.ExoPlayerImpl.updatePlaybackInfo(ExoPlayerImpl.java:5) at com.oplus.tbl.exoplayer2.ExoPlayerImpl.handlePlaybackInfo(ExoPlayerImpl.java:19) at com.oplus.tbl.exoplayer2.ExoPlayerImpl.lambda$null$1(ExoPlayerImpl.java:1) at com.oplus.tbl.exoplayer2.ExoPlayerImpl.s(Unknown Source:0) at com.oplus.tbl.exoplayer2.s.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:240) at android.os.Looper.loop(Looper.java:351) at android.app.ActivityThread.main(ActivityThread.java:8422) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Devices that reproduce the issue

Play video, I have seen many people asking this question before, but there has been no clear solution

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

No

Expected result

No

Actual result

No

Media

I cannot reproduce the issue. It reported by customer. As evaluateMediaItemTransitionReason's IllegalStateException has not been catch. I‘m adding a new reason MEDIA_ITEM_TRANSITION_REASON_OTHER, and send the Exception with message to ExoPlayerImplInernal. ExoPlayerImplInernal catch the IllegalStateException and send error to user. Add new MEDIA_ITEM_TRANSITION_REASON_OTHER, Is this method OK?

int MEDIA_ITEM_TRANSITION_REASON_REPEAT = 0; int MEDIA_ITEM_TRANSITION_REASON_AUTO = 1; int MEDIA_ITEM_TRANSITION_REASON_SEEK = 2; int MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED = 3; /* unknown media item transitioned reason. / int MEDIA_ITEM_TRANSITION_REASON_OTHER = -1;

if (positionDiscontinuity && positionDiscontinuityReason == DISCONTINUITY_REASON_PERIOD_TRANSITION) { transitionReason = MEDIA_ITEM_TRANSITION_REASON_AUTO; } else if (positionDiscontinuity && positionDiscontinuityReason == DISCONTINUITY_REASON_SEEK) { transitionReason = MEDIA_ITEM_TRANSITION_REASON_SEEK; } else if (timelineChanged) { transitionReason = MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED; } else { // A change reasons in window uid is none of above. transitionReason = MEDIA_ITEM_TRANSITION_REASON_OTHER; internalPlayer.mediaitemTransitionReasonUnknownMessage(); }

public void mediaitemTransitionReasonUnknownMessage() { handler.sendEmptyMessage(MSG_MEDIAITEM_TRANSITION_REASON_UNKNOWN); }

case MSG_MEDIAITEM_TRANSITION_REASON_UNKNOWN: mediaitemTransitionReasonUnknown(); return true;

private void mediaitemTransitionReasonUnknown() { Log.e(TAG, "A change reasons in window uid is unknown"); throw new IllegalStateException(); }

Bug Report

tonihei commented 9 months ago

The check is there to catch an unexpected flow in the code and it's really an "illegal state" to end up there. So I don't think adding a new discontinuity reason is the right approach. Ideally we can find whatever situation caused you to end up there.

Do you have any additional context on the playback and the type of transition you normally get in your app? Anything unusual about your media setup or player interaction that may cause this issue in your app but not in others?

google-oss-bot commented 8 months ago

Hey @captain81. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 8 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@captain81 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.