jrfeng / snow

Android music player framework, compatible with MediaSession. Support custom music player (MediaPlayer, ExoPlayer), custom Notification, custom audio effect engine, only WiFi network, sound quality/dynamic URL, headset clicks, sleep timer, playback history, player state persistence.
MIT License
190 stars 45 forks source link

Fatal Exception: java.lang.IndexOutOfBoundsException #29

Closed webwayscript closed 2 years ago

webwayscript commented 2 years ago

I have this in firebase crash list . this one is your library problem or ourside problem?

  Fatal Exception: java.lang.IndexOutOfBoundsException: Index: 45, Size: 24
   at java.util.ArrayList.get(ArrayList.java:437)
   at snow.player.playlist.Playlist.get(Playlist.java:2)
   at snow.player.AbstractPlayer.playPause(AbstractPlayer.java:2)
   at snow.player.Player__ChannelHelper$Dispatcher.dispatch(Player__ChannelHelper.java:86)
   at channel.helper.DispatcherUtil$1.dispatch(DispatcherUtil.java:19)
   at channel.helper.pipe.CustomActionPipe.dispatch(CustomActionPipe.java:3)
   at snow.player.PlayerService.onCustomAction(PlayerService.java:3)
   at snow.player.PlayerService$MediaSessionCallback.onCustomAction(PlayerService.java:2)
   at android.support.v4.media.session.MediaSessionCompat$Callback$MediaSessionCallbackApi21.onCustomAction(MediaSessionCompat.java:257)
   at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1635)
   at android.os.Handler.dispatchMessage(Handler.java:107)
   at android.os.Looper.loop(Looper.java:225)
   at android.app.ActivityThread.main(ActivityThread.java:7563)
   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:994)
jrfeng commented 2 years ago

Sorry, there is too little information. Can you provide more information? I can't find the bug that caused the crash.

jrfeng commented 2 years ago

Maybe you used the wrong position value to call the playPause(int position) method. Maybe you should check your code. I optimized the relevant code, if the wrong position value is used, will cause a player error but not crash.