Displaying "matchedMediaItem.artist" on the screen of iPhone

I try to match a microphone audio with a custom catalog which I created via ShazamKit. What is the code for extracting and displaying "matchedMediaItem.artist" information on my iPhone screen after finding a song match with an entry of my custom-built catalog? I am a beginner.

Custom Catalogs have their metadata defined by you in a form of a SHMediaItem. When you create a SHCustomCatalog with a SHSignature, you can attach a SHMediaItem objects as a metadata to represent a signature.

When the match happens then you should be able to get that SHMatchedMediaItem/SHMediaItem you defined at catalog creation. So in order to get the artist property, you will need to create an SHMediaItem with SHMediaItemArtist at catalog creation, something like this:

let signature = ...
let mediaItem = SHMediaItem(properties: [.artist: "Artist name"])

let customCatalog = SHCustomCatalog()
try customCatalog.addReferenceSignature(signature, representing: [mediaItem])


You can also download the Building a Custom Catalog sample app, where you can find an example of how a Custom Catalog is created and how metadata is defined. The CatalogProvider.swift file should contain most of the relevant parts.

Let us know if you run into any issues.

Displaying "matchedMediaItem.artist" on the screen of iPhone
 
 
Q