From 9f8edd0e9d147ec13532143ae3174d3f71e8219a Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 18 Jul 2023 17:01:22 +0200 Subject: Fix MediaMetadataRetriever on API<29 On SDK<29, this class does not have a close method yet, so the app crashes when using try-with-resources. --- .../main/java/de/danoeh/antennapod/ui/glide/AudioCoverFetcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/glide') diff --git a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/AudioCoverFetcher.java b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/AudioCoverFetcher.java index d8e265ab5..309afa39d 100644 --- a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/AudioCoverFetcher.java +++ b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/AudioCoverFetcher.java @@ -2,13 +2,13 @@ package de.danoeh.antennapod.ui.glide; import android.content.ContentResolver; import android.content.Context; -import android.media.MediaMetadataRetriever; import android.net.Uri; import androidx.annotation.NonNull; import com.bumptech.glide.Priority; import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.data.DataFetcher; +import de.danoeh.antennapod.model.MediaMetadataRetrieverCompat; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -25,7 +25,7 @@ class AudioCoverFetcher implements DataFetcher { @Override public void loadData(@NonNull Priority priority, @NonNull DataCallback callback) { - try (MediaMetadataRetriever retriever = new MediaMetadataRetriever()) { + try (MediaMetadataRetrieverCompat retriever = new MediaMetadataRetrieverCompat()) { if (path.startsWith(ContentResolver.SCHEME_CONTENT)) { retriever.setDataSource(context, Uri.parse(path)); } else { -- cgit v1.2.3