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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -994,7 +994,7 @@ PODS:
- React-Mapbuffer (0.74.3):
- glog
- React-debug
- react-native-video (6.3.0):
- react-native-video (6.4.3):
- DoubleConversion
- glog
- hermes-engine
@ -1008,7 +1008,7 @@ PODS:
- React-featureflags
- React-graphics
- React-ImageManager
- react-native-video/Video (= 6.3.0)
- react-native-video/Video (= 6.4.3)
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
@ -1038,7 +1038,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-video/Video (6.3.0):
- react-native-video/Video (6.4.3):
- DoubleConversion
- glog
- hermes-engine
@ -1559,7 +1559,7 @@ SPEC CHECKSUMS:
React-jsitracing: 1aa5681c353b41573b03e0e480a5adf5fa1c56d8
React-logger: fa92ba4d3a5d39ac450f59be2a3cec7b099f0304
React-Mapbuffer: 70da5955150a58732e9336a0c7e71cd49e909f25
react-native-video: c44719c9a5261ad54fdad49e6dd0e98439e0e1b3
react-native-video: 3d5881ee6643a9a87e0e259b742c2d07aee7b27e
react-native-video-plugin-sample: d3a93b7ad777cad7fa2c30473de75a2635ce5feb
React-nativeconfig: 84806b820491db30175afbf027e99e8415dc63f0
React-NativeModulesApple: 7b79212f8cf496ab554e0b7b09acbd4aa4690260
@ -1594,4 +1594,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: a73d485df51877001f2b04a5a4379cfa5a3ba8fa
COCOAPODS: 1.15.2
COCOAPODS: 1.13.0

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 ?? ""