Skip to content

Commit

Permalink
Fixed crash #1052
Browse files Browse the repository at this point in the history
  • Loading branch information
fast4x committed Mar 14, 2024
1 parent ffa4b06 commit bdc1bc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ class PlayerService : InvincibleService(),
mediaSession.isActive = false
mediaSession.release()
cache.release()
downloadCache.release()
//downloadCache.release()

loudnessEnhancer?.release()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package it.vfsfitvnm.vimusic.ui.screens.player
import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Build
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.tween
Expand Down Expand Up @@ -134,6 +136,7 @@ import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Date

@RequiresApi(Build.VERSION_CODES.M)
@ExperimentalTextApi
@SuppressLint("SuspiciousIndentation")
@ExperimentalFoundationApi
Expand Down Expand Up @@ -213,14 +216,14 @@ fun Queue(
player.DisposableListener {
object : Player.Listener {
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
mediaItemIndex =
if (player.mediaItemCount == 0) -1 else player.currentMediaItemIndex
mediaItemIndex = player.currentMediaItemIndex
//if (player.mediaItemCount == 0) -1 else player.currentMediaItemIndex
}

override fun onTimelineChanged(timeline: Timeline, reason: Int) {
windows = timeline.windows
mediaItemIndex =
if (player.mediaItemCount == 0) -1 else player.currentMediaItemIndex
mediaItemIndex = player.currentMediaItemIndex
//if (player.mediaItemCount == 0) -1 else player.currentMediaItemIndex
}

override fun onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) {
Expand Down

0 comments on commit bdc1bc5

Please sign in to comment.