Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): override source metadata with custom metadata #4050

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/basic/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1594,4 +1594,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: a73d485df51877001f2b04a5a4379cfa5a3ba8fa

COCOAPODS: 1.15.2
COCOAPODS: 1.13.0
7 changes: 6 additions & 1 deletion ios/Video/NowPlayingInfoCenterManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? ""

Expand Down
Loading