Skip to content

Commit b217532

Browse files
committed
fix: MetatdataRetriever process not finding embedded artwork
- We're falling back to using the `embeddedPicture` accessor in `MediaMetadataRetriever` to get the artwork since it's found there. - ❗ This fix is only applied to `getArtwork()`. ❗
1 parent bc14a74 commit b217532

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
1717
### 🛠️ Fixes
1818

1919
- Artwork not found for `.mp4` file.
20+
- `MediaMetadataRetriever` does find the artwork via the `embeddedPicture` accessor while the process involving `MetatdataRetriever` doesn't.
21+
-**This fix is only applied to `getArtwork()`.**
2022

2123
### ⚙️ Internal Changes
2224

android/src/main/java/com/cyanchill/missingcore/metadataretriever/modules/MetadataRetrieverModule.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,12 @@ class MetadataRetrieverModule(reactContext: ReactApplicationContext) :
172172
var coverImage: Any? = null
173173
var backupImage: Any? = null
174174

175-
// Fallback to `MediaMetadataRetriever` if we find nothing with `MetadataRetriever`.
176-
if (metadataList.isEmpty()) {
175+
val isFLAC = uri.endsWith(".flac") || uri.endsWith(".m4a") || uri.endsWith(".mp4")
176+
177+
// Fallback to `MediaMetadataRetriever` if we find nothing with `MetadataRetriever` or with
178+
// flac/mp4/m4a files due to artwork not being parsed correctly.
179+
// - https://github.com/MissingCore/Music/issues/432
180+
if (metadataList.isEmpty() || isFLAC) {
177181
val mmrMetadata = MediaMetadataRetriever()
178182
mmrMetadata.setDataSource(Normalization.getSafeUri(uri))
179183
coverImage = if (asBase64) reader.getBase64Image(mmrMetadata.embeddedPicture) else mmrMetadata.embeddedPicture

0 commit comments

Comments
 (0)