Skip to content

Commit

Permalink
[optimize] Optimize media URI identification
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyD666 committed Sep 17, 2024
1 parent 09aa495 commit bcecc7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
minSdk = 24
targetSdk = 35
versionCode = 24
versionName = "2.1-beta05"
versionName = "2.1-beta06"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
13 changes: 8 additions & 5 deletions app/src/main/java/com/skyd/anivu/ui/mpv/PlayerView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ fun PlayerView(
}
LaunchedEffect(mediaLoaded) {
if (uiState.needLoadLastPlayPosition && mediaLoaded && playState.duration > 0) {
dispatcher(PlayerIntent.TrySeekToLast(uri.toString(), playState.duration * 1000L))
uri.resolveUri(context)?.let { mediaId ->
dispatcher(PlayerIntent.TrySeekToLast(mediaId, playState.duration * 1000L))
}
}
}
val dialogState by remember {
Expand Down Expand Up @@ -455,10 +457,11 @@ fun PlayerView(
}

Lifecycle.Event.ON_DESTROY -> {
viewModel.updatePlayHistory(
uri.toString(),
playState.currentPosition * 1000L,
)
uri.resolveUri(context)?.let { mediaId ->
viewModel.updatePlayHistory(
mediaId, playState.currentPosition * 1000L,
)
}
}

else -> Unit
Expand Down

0 comments on commit bcecc7f

Please sign in to comment.