@fkuehne Following up on this old issue as I'm still having problems. Do you have a working code example that I can try? Thanks!
This is for local media. Am I using the correct parsing options: (VLCMediaFetchLocal | VLCMediaParseLocal)?
Yes, mediaDidFinishParsing is called and I checked the media status...it's .done.
func mediaDidFinishParsing(_ aMedia: VLCMedia) {
if aMedia.parsedStatus == .done {
print(aMedia.metaDictionary)
}
completion?(.done)
}
I have the following class which parses a VLCMedia instance and makes a callback when completed:
class VLCMediaParser: NSObject, VLCMediaDelegate {
var completion: VLCMediaParseCompletion? = nil
func parse(media: VLCMedia, options: VLCMediaParsingOptions, timeout: Int32, completion: @escaping VLCMediaParseCompletion) {
media.delegate = self
self.completion = completion
media.parse(withOptions: options, timeout: timeout)
}
func parse(media: VLCMedia, options: VLCMediaParsingOptions, completion: @escaping VLCMediaParseCompletion) {
media.delegate = self
self.completion = completion
media.parse(withOptions: options)
}
func mediaDidFinishParsing(_ aMedia: VLCMedia) {
completion?(.done)
}
func mediaMetaDataDidChange(_ aMedia: VLCMedia) {
print(aMedia.metaDictionary)
}
}
Here is the call to the parser class:
parser.parse(media: media,
options: VLCMediaParsingOptions(VLCMediaFetchLocal | VLCMediaParseLocal)) { status in
if status == .done {
print(media.metaDictionary)
}
}
I've tried both mp3 files and video files (mp4, mov, mkv) but the only metadata that ever gets returned is artworkURL.
I'm having issues getting the length of VLCMedia as well as the videoSize of the media.
public func updatePlayerURL(url: URL) {
mediaPlayer.stop()
let media = VLCMedia(url: url)
mediaPlayer.media = media
print(media.length.minuteStringValue)
print(mediaPlayer.videoSize)
}
Here are the respective print statement outputs:
Optional("")
(0.0, 0.0)
I'm having issues getting the length of VLCMedia as well as the videoSize of the media.
public func updatePlayerURL(url: URL) {
mediaPlayer.stop()
let media = VLCMedia(url: url)
mediaPlayer.media = media
print(media.length.minuteStringValue)
print(mediaPlayer.videoSize)
}
Here are the respective print statement outputs:
Optional("")
(0.0, 0.0)