fix(ios): override source metadata with custom metadata (#4050)
Some checks are pending
Build iOS / Build iOS Example App (push) Waiting to run
Build iOS / Build iOS Example App With Ads (push) Waiting to run
Build iOS / Build iOS Example App With Caching (push) Waiting to run
Check CLang / CLang-Format (push) Waiting to run
Check iOS / Swift-Lint (push) Waiting to run
Check iOS / Swift-Format (push) Waiting to run

* fix(ios): override source metadata with custom metadata

* lint code
This commit is contained in:
Krzysztof Moch
2024-08-05 11:59:49 +02:00
committed by GitHub
parent af0302b1b7
commit 38aa2b057a
2 changed files with 11 additions and 6 deletions

View File

@@ -192,7 +192,12 @@ class NowPlayingInfoCenterManager {
}
// commonMetadata is metadata from asset, externalMetadata is custom metadata set by user
let metadata = currentItem.asset.commonMetadata + currentItem.externalMetadata
// externalMetadata should override commonMetadata to allow override metadata from source
let metadata = {
let common = Dictionary(uniqueKeysWithValues: currentItem.asset.commonMetadata.map { ($0.identifier, $0) })
let external = Dictionary(uniqueKeysWithValues: currentItem.externalMetadata.map { ($0.identifier, $0) })
return Array((common.merging(external) { _, new in new }).values)
}()
let titleItem = AVMetadataItem.metadataItems(from: metadata, filteredByIdentifier: .commonIdentifierTitle).first?.stringValue ?? ""