SimpMusic icon indicating copy to clipboard operation
SimpMusic copied to clipboard

Playing a video and then minimizing the app causes a crash

Open LiLCavee opened this issue 6 months ago • 1 comments

Duplicate Check

  • [x] I confirm I searched for existing reports and found no duplicates.

Describe the Bug

Fixed with new version

Working now thank you but having a new problem Playing a video and then minimizing the app causes a crash

I hv analysed this and it's , specifically related to the Media3 ExoPlayer library. The key issue is: IllegalStateException: Session ID must be unique. ID=com.mxavie.media3.service.SimpleMediaService.

Steps to Reproduce

  1. Key Error: java.lang.IllegalStateException: Session ID must be unique. ID=com.mxavie.media3.service.SimpleMediaService
  2. Fix for the Code: In SimpleMediaService.java (or SimpleMediaService.kt), ensure the Session ID is dynamic. Example: kotlin val sessionId = "media_session_${System.currentTimeMillis()}" // Unique ID val mediaSession = MediaSession.Builder(context, player) .setSessionId(sessionId) .build()
  3. Release the Media Session Properly: Add this to onDestroy(): kotlin override fun onDestroy() { mediaSession?.player?.release() mediaSession?.release() mediaSession = null super.onDestroy() }
  4. Update the AndroidManifest.xml: Ensure the service is declared like this: xml
  5. Test for Edge Cases: • Rapid app restarts (open/close the app multiple times quickly). • Background/foreground transitions (minimize the app while media is playing).

Hope this is helpful. 👆

Expected Behavior

The app should handle media playback without crashes, duplicate sessions, or resource leaks, ensuring a smooth and stable experience.

The SimpleMediaService should initialize and run smoothly without throwing IllegalStateException.

The app should never create multiple instances of SimpleMediaService simultaneously.

Lastly The app should recover gracefully from interruptions example incoming calls, app switches.

App Version

1.2.1

Android Version

Android 13

Device Model

Samsung a12

Custom ROM

  • [ ] I am using a custom ROM

Custom ROM Name (if applicable)

No response

Screenshots (optional)

Image

Log / Error Details

No response

LiLCavee avatar May 10 '26 15:05 LiLCavee

Please update to the latest release v2.2.0, since 1.2.1 is several versions behind. If minimizing during video playback still crashes there, please attach the full crash log. Thanks for the analysis: the "Session ID must be unique" crash looks related to the open report #2399.

Automatic reply — the maintainer may follow up.

simpmusic-support[bot] avatar Oct 07 '26 03:10 simpmusic-support[bot]