File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
app/src/main/kotlin/com/simplemobiletools/musicplayer/extensions Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -164,8 +164,10 @@ fun Player.prepareUsingTracks(
164164 * items are added using [addRemainingMediaItems]. This helps prevent delays, especially with large queues, and
165165 * avoids potential issues like [android.app.ForegroundServiceStartNotAllowedException] when starting from background.
166166 */
167+ var prepareInProgress = false
167168inline fun Player.maybePreparePlayer (context : Context , crossinline callback : (success: Boolean ) -> Unit ) {
168- if (currentMediaItem == null ) {
169+ if (! prepareInProgress && currentMediaItem == null ) {
170+ prepareInProgress = true
169171 ensureBackgroundThread {
170172 var prepared = false
171173 context.audioHelper.getQueuedTracksLazily { tracks, startIndex, startPositionMs ->
You can’t perform that action at this time.
0 commit comments