Move metadata management to the VLCMediaMetaData class.
Move metadata management to the VLCMediaMetaData class.
This eliminates the need for casting when retrieving metadata values.
let media: VLCMedia = ...
/************ before ************/
// Get metadata values
let title: String? = media.metadata(forKey: VLCMetaInformationTitle)
or
let title: String? = media.metaDictionary[VLCMetaInformationTitle] as? String
let trackNumber: UInt32 = media.metadata(forKey: VLCMetaInformationTrackNumber) as? UInt32 ?? .zero
or
let trackNumber: UInt32 = media.metaDictionary[VLCMetaInformationTrackNumber] as? UInt32 ?? .zero
// Save metadata values
media.setMetadata("new title", forKey: VLCMetaInformationTitle)
let newTrackNumber = 10
media.setMetadata("\(newTrackNumber)", forKey: VLCMetaInformationTrackNumber)
media.saveMetadata
/************ after ************/
// Get metadata values
let metaData: VLCMediaMetaData = media.metaData
let title: String? = metaData.title
let trackNumber: UInt32 = metaData.trackNumber
// Save metadata values
metaData.title = "new title"
metaData.trackNumber = 10
metaData.save()
Probably related #416 (closed)
Edited by Hank Anderson