Fix MediaPreProcessor for images/videos sent as file

This commit is contained in:
ganfra 2023-06-16 13:52:07 +02:00
parent 2cc78fd5fb
commit 33c74fb4e5
7 changed files with 251 additions and 147 deletions

View file

@ -20,5 +20,9 @@ import android.media.MediaMetadataRetriever
/** [MediaMetadataRetriever] only implements `AutoClosable` since API 29, so we need to execute this to have the same in older APIs. */
inline fun <T> MediaMetadataRetriever.runAndRelease(block: MediaMetadataRetriever.() -> T): T {
return block().also { release() }
return try {
block()
} finally {
release()
}
}