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
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:
@@ -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 ?? ""
|
||||
|
||||
|
Reference in New Issue
Block a user