Mugurel Mugurel - 11 months ago 71
Swift Question

Swift Read in UTF8 String from MPMoviePlayerController metadata

I need to read some metadata which can contain French or German characters & accents.

I think that I need to read the metadata as UTF8 String. But being a beginner in Swift and Apple in general I don't know how to do this.

I tried to implement some similar solutions found on stackOverflow but none worked.

What I'm working with:

let firstMeta: MPTimedMetadata = radioPlayer.timedMetadata.first as! MPTimedMetadata
let metaData = firstMeta.value as! String

There I get

Antonin DvoÅák

instead of

Antonin Dvořák

Any ideas?

Easy solution for how to get UTF8 metadata from online audio stream using AVPlayer


This is a problem in the library, you cannot fix it because the string is already decoded from data.

There is a reason why the whole set of classes was deprecated in iOS 9.

You should use AVPlayerViewController & AVPlayer & AVPlayerItem & AVMetadataItem.

They are solving this issue. Don't use MPMoviePlayerController.