chore: outsource functions to own utils file

This commit is contained in:
Konstantin Späth
2023-09-09 16:15:51 +02:00
parent b1c49decbf
commit 33c0be449a
3 changed files with 65 additions and 56 deletions

View File

@@ -316,4 +316,18 @@ enum RCTVideoUtils {
}
return (asset, assetOptions)
}
static func createMetadataItems(for mapping: [AVMetadataIdentifier: Any]) -> [AVMetadataItem] {
return mapping.compactMap { createMetadataItem(for:$0, value:$1) }
}
static func createMetadataItem(for identifier: AVMetadataIdentifier,
value: Any) -> AVMetadataItem {
let item = AVMutableMetadataItem()
item.identifier = identifier
item.value = value as? NSCopying & NSObjectProtocol
// Specify "und" to indicate an undefined language.
item.extendedLanguageTag = "und"
return item.copy() as! AVMetadataItem
}
}