Closed ricardocmj closed 1 year ago
Hi @jspizziri, are you able to review this? I'm facing this error using V4 RC03.
Thank you! 🙏
@bradleyflood just took a look. Not sure how there could be a problem caused by this line.
Thanks :)
I'm still debugging this now. But for me it happens during normal playback. I'll have an audio file playing fine, and then I click Play on that same audio file again and sometimes I get:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tutusgumboots.evergrace, PID: 11325
java.lang.NullPointerException: null cannot be cast to non-null type com.doublesymmetry.kotlinaudio.models.AudioItemHolder
at com.doublesymmetry.kotlinaudio.notification.NotificationManager.getCurrentItemHolder(NotificationManager.kt:159)
at com.doublesymmetry.kotlinaudio.notification.NotificationManager.setNotificationMetadata(NotificationManager.kt:54)
at com.doublesymmetry.kotlinaudio.players.BaseAudioPlayer.updateNotificationMetadataIfAutomatic$kotlin_audio_release(BaseAudioPlayer.kt:286)
at com.doublesymmetry.kotlinaudio.players.BaseAudioPlayer$PlayerListener.onMediaItemTransition(BaseAudioPlayer.kt:646)
Thanks for the investigation! Will go out with the next RC and nightly
Fixes https://github.com/doublesymmetry/react-native-track-player/issues/1997
This error happens due to a race condition with hideNotification():
https://github.com/doublesymmetry/KotlinAudio/blob/558fb7f963590813f7e629c73e3c4f9cb29f74f7/kotlin-audio/src/main/java/com/doublesymmetry/kotlinaudio/notification/NotificationManager.kt#L518-L520
or with destroy():
https://github.com/doublesymmetry/KotlinAudio/blob/558fb7f963590813f7e629c73e3c4f9cb29f74f7/kotlin-audio/src/main/java/com/doublesymmetry/kotlinaudio/notification/NotificationManager.kt#L544-L546