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
{{ message }}
Repository navigation
Preload media period not prepared when onContinueLoadingRequested is called #2315
Fatal Exception: java.lang.IllegalStateException:
at androidx.media3.common.util.Assertions.checkState(Assertions.java:85)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod.assertPrepared(ProgressiveMediaPeriod.java:999)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod.getBufferedPositionUs(ProgressiveMediaPeriod.java)
at androidx.media3.exoplayer.source.preload.PreloadMediaPeriod.getBufferedPositionUs(PreloadMediaPeriod.java:264)
at androidx.media3.exoplayer.source.preload.PreloadMediaSource$PreloadMediaPeriodCallback.lambda$onContinueLoadingRequested$1(PreloadMediaSource.java:508)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
[com.android.thememanager_issue_2947d0273e7f29d94ddff2a6db7b788f_crash_session_67EE316A008700017C745A594FC6525D_DNE_0_v2_stacktrace.txt](https://github.com/user-attachments/files/19643871/com.android.thememanager_issue_2947d0273e7f29d94ddff2a6db7b788f_crash_session_67EE316A008700017C745A594FC6525D_DNE_0_v2_stacktrace.txt)
@Apengsun If you file a bug and then a question is asked to provide more information, please do not open a new bug but continue instead with the existing bug. I close the other bug. If you want to increase your chance to get help on an issue tracker, then you can add some concrete questions instead pasting code without any comments.
The stack trace originates from ActivityThread.main (I'm not sure if this is a red hearing though)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7562)
and when the DefaultPreloadManager is built the main looper is passed to the builder:
.setPreloadLooper(Looper.getMainLooper())
Can you delete this line and try when the manager creates a loader thread internally? I'm unsure what the reason for the exception is but lets try with the default setting when it creates a thread internally.
From the library side I think we can add an assertion there to assert that the looper passed in is not the main Looper.
changed the title [-]Preload media period not prepared when continueLoading is called[/-][+]Preload media period not prepared when onContinueLoadingRequested is called[/+]on Apr 9, 2025
I'm able to reproduce this on demo-shortform app if I manually setContinueLoadingIntervalBytes() to a smaller value, with which the media period hasn't prepared and still needs more rounds of MediaPeriod.continueLoading to get it fully prepared.
I'm going to send a fix for this. Also +1 on @marcbaechinger's suggestion to assert the preload looper passed not the main looper.
Activity
Apengsun commentedon Apr 8, 2025
marcbaechinger commentedon Apr 8, 2025
@Apengsun If you file a bug and then a question is asked to provide more information, please do not open a new bug but continue instead with the existing bug. I close the other bug. If you want to increase your chance to get help on an issue tracker, then you can add some concrete questions instead pasting code without any comments.
marcbaechinger commentedon Apr 9, 2025
The stack trace originates from
ActivityThread.main(I'm not sure if this is a red hearing though)and when the
DefaultPreloadManageris built the main looper is passed to the builder:Can you delete this line and try when the manager creates a loader thread internally? I'm unsure what the reason for the exception is but lets try with the default setting when it creates a thread internally.
From the library side I think we can add an assertion there to assert that the
looperpassed in is not the mainLooper.[-]使用 Media3 1.5.1版本[/-][+]Preload media period not prepared when continueLoading is called[/+][-]Preload media period not prepared when continueLoading is called[/-][+]Preload media period not prepared when onContinueLoadingRequested is called[/+]tianyif commentedon Apr 10, 2025
I'm able to reproduce this on demo-shortform app if I manually
setContinueLoadingIntervalBytes()to a smaller value, with which the media period hasn't prepared and still needs more rounds ofMediaPeriod.continueLoadingto get it fully prepared.I'm going to send a fix for this. Also +1 on @marcbaechinger's suggestion to assert the preload looper passed not the main looper.
Fix issue where ProgressiveMediaPeriod fails assertPrepared
Fix issue where ProgressiveMediaPeriod fails assertPrepared
Fix issue where ProgressiveMediaPeriod fails assertPrepared
Assert preload looper is not the main looper