I want to get the media title through AVMetadataItem
class
/* provides the value of the metadata item */
@NSCopying public var value: protocol<NSCopying, NSObjectProtocol>? { get }
Above is Apple official illustrate about value
property
import Foundation
import AVFoundation
extension AVAsset{
func title() ->String{
let key = "commonMetadata";
self.loadValuesAsynchronouslyForKeys([key]){
if(self.statusOfValueForKey(key, error:nil) == .Loaded)
{
let metadata = AVMetadataItem.metadataItemsFromArray(self.metadata, withKey: key, keySpace: AVMetadataKeySpaceCommon)
if(metadata.count > 0){
let item = metadata[0];
return (item.value?.copyWithZone(nil))! as! String;
}
}
};
}
}
then I get error 'Unexpected non-void return value in void function' where I use 'as' perform type casting