maxrave-dev / SimpMusic

A simple music app using YouTube Music for backend
https://simpmusic.tech/
GNU General Public License v3.0
1.93k stars 117 forks source link

Can't play large playlists at all #392

Open Cszyn opened 5 months ago

Cszyn commented 5 months ago

Describe the bug Can't play large playlists :( Basically same as #355, but now I have a new phone that isn't the worst android from 2019

To Reproduce Steps to reproduce the behavior:

  1. Sign in to google (optional)
  2. Get a large playlist (2k+) (also takes a long ass time to load)
  3. Select a song for playback
  4. Crash and See error

Expected behavior playlist starts playing

Screenshots Screenshot_2024-06-04-14-47-40-249_com maxrave simpmusic

Log (Error Details) Build version: 0.2.1 Current date: 2024-06-04 14:34:50 Device: Xiaomi 23127PN0CG OS version: Android 14 (SDK 34)

Stack trace:
java.lang.OutOfMemoryError: Failed to allocate a 40 byte allocation with 2505216 free bytes and 2446KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC. at android.media.MediaDescription$Builder.build(MediaDescription.java:400) at android.support.v4.media.MediaDescriptionCompat$Api21Impl.build(MediaDescriptionCompat.java:624) at android.support.v4.media.MediaDescriptionCompat.getMediaDescription(MediaDescriptionCompat.java:367) at android.support.v4.media.session.MediaSessionCompat$QueueItem.getQueueItem(MediaSessionCompat.java:2218) at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi21.setQueue(MediaSessionCompat.java:4123) at android.support.v4.media.session.MediaSessionCompat.setQueue(MediaSessionCompat.java:828) at androidx.media3.session.MediaSessionLegacyStub.setQueue(MediaSessionLegacyStub.java:925) at androidx.media3.session.MediaSessionLegacyStub.access$500(MediaSessionLegacyStub.java:110) at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast.handleBitmapFuturesAllCompletedAndSetQueue(MediaSessionLegacyStub.java:1222) at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast.lambda$updateQueue$0$androidx-media3-session-MediaSessionLegacyStub$ControllerLegacyCbForBroadcast(MediaSessionLegacyStub.java:1170) at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0) at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast.updateQueue(MediaSessionLegacyStub.java:1179) at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast.onTimelineChanged(MediaSessionLegacyStub.java:1153) at androidx.media3.session.MediaSessionImpl$PlayerListener.lambda$onTimelineChanged$11(MediaSessionImpl.java:1482) at androidx.media3.session.MediaSessionImpl$PlayerListener$$ExternalSyntheticLambda7.run(D8$$SyntheticClass:0) at androidx.media3.session.MediaSessionImpl.dispatchRemoteControllerTaskToLegacyStub(MediaSessionImpl.java:917) at androidx.media3.session.MediaSessionImpl.access$400(MediaSessionImpl.java:101) at androidx.media3.session.MediaSessionImpl$PlayerListener.onTimelineChanged(MediaSessionImpl.java:1481) at androidx.media3.common.ForwardingPlayer$ForwardingListener.onTimelineChanged(ForwardingPlayer.java:953) at androidx.media3.exoplayer.ExoPlayerImpl.lambda$updatePlaybackInfo$12(ExoPlayerImpl.java:2056) at androidx.media3.exoplayer.ExoPlayerImpl$$ExternalSyntheticLambda5.invoke(D8$$SyntheticClass:0) at androidx.media3.common.util.ListenerSet$ListenerHolder.invoke(ListenerSet.java:339) at androidx.media3.common.util.ListenerSet.lambda$queueEvent$0(ListenerSet.java:223) at androidx.media3.common.util.ListenerSet$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0) at androidx.media3.common.util.ListenerSet.flushEvents(ListenerSet.java:245) at androidx.media3.exoplayer.ExoPlayerImpl.updatePlaybackInfo(ExoPlayerImpl.java:2145) at androidx.media3.exoplayer.ExoPlayerImpl.addMediaSources(ExoPlayerImpl.java:674) at androidx.media3.exoplayer.ExoPlayerImpl.addMediaItems(ExoPlayerImpl.java:641) at androidx.media3.common.BasePlayer.addMediaItems(BasePlayer.java:71) at androidx.media3.common.BasePlayer.addMediaItem(BasePlayer.java:66) at com.maxrave.simpmusic.service.SimpleMediaServiceHandler.addMediaItemNotSet(SimpleMediaServiceHandler.kt:227) at com.maxrave.simpmusic.service.SimpleMediaServiceHandler.updateCatalog(SimpleMediaServiceHandler.kt:1062) at com.maxrave.simpmusic.service.SimpleMediaServiceHandler.load(SimpleMediaServiceHandler.kt:805) at com.maxrave.simpmusic.service.SimpleMediaServiceHandler.load$default(SimpleMediaServiceHandler.kt:801) at com.maxrave.simpmusic.service.SimpleMediaServiceHandler$loadPlaylistOrAlbum$1.invokeSuspend(SimpleMediaServiceHandler.kt:1103) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:65) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:257) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking(Builders.kt:69) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking$default(Builders.kt:48) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1) at com.maxrave.simpmusic.ui.widget.BasicWidget.performUpdate(BasicWidget.kt:68) at com.maxrave.simpmusic.viewModel.SharedViewModel$init$2$job2$1$1.invokeSuspend(SharedViewModel.kt:311) at com.maxrave.simpmusic.viewModel.SharedViewModel$init$2$job2$1$1.invoke(Unknown Source:8) at com.maxrave.simpmusic.viewModel.SharedViewModel$init$2$job2$1$1.invoke(Unknown Source:4) at kotlinx.coroutines.flow.FlowKtMergeKt$mapLatest$1.invokeSuspend(Merge.kt:213) at kotlinx.coroutines.flow.FlowKtMergeKt$mapLatest$1.invoke(Unknown Source:13) at kotlinx.coroutines.flow.FlowKtMergeKt$mapLatest$1.invoke(Unknown Source:4) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:30) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Unknown Source:8) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:27) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:90) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123) at kotlinx.coroutines.BuildersKtBuilders_commonKt.launch(Builders.common.kt:52) at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:43) at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1.emit(Merge.kt:29) at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:392) at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:65) at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:371) at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith$default(DispatchedContinuation.kt:274) at kotlinx.coroutines.DispatchedCoroutine.afterResume(Builders.common.kt:257) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:224) at android.os.Looper.loop(Looper.java:318) at android.app.ActivityThread.main(ActivityThread.java:8677) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@43c8600, Dispatchers.Main.immediate]

User actions: 2024-06-04 14:32:16: MainActivity created 2024-06-04 14:32:16: MainActivity resumed

maxrave-dev commented 5 months ago

Known issue. Thanks for reporting. I will make a paging for large playlist

maxrave-dev commented 3 months ago

Do you try latest build?

jagathvm commented 3 months ago

Do you try latest build?

Still the bug is not fixed.