Reputation: 2225
I'm working on a media app, and I'd like to improve its Siri interactions. I've implemented an Intents extension, with "radio" as the media category, and I'm refining the resolveMediaItems
method. Typically if I tell Siri Play <search query> in <my app>
, and then examine the INPlayMediaIntent
in the debugger, I see something like this
<INPlayMediaIntent: 0x143f181c0> {
playShuffled = 0;
mediaSearch = <INMediaSearch: 0x143d19b50> {
reference = 0;
mediaType = 18;
sortOrder = 0;
albumName = <null>;
mediaName = search query;
genreNames = (
);
artistName = <null>;
moodNames = (
);
releaseDate = <null>;
mediaIdentifier = <null>;
};
mediaContainer = <null>;
playbackRepeatMode = none;
mediaItems = <null>;
resumePlayback = 0;
playbackQueueLocation = now;
playbackSpeed = <null>;
}
where the mediaSearch.mediaName
has the data from the speaker that I can use to resolve the query.
Unfortunately, if the query contains the words 'music' or 'radio' these will not be included in the mediaName
field. If the query contains just these words, e.g., "Play music in <my app>"
, the field will be <null>
and the INPlayMediaIntent
will effectively contain no content whatsoever.
Given the content that app provides, knowing whether the terms 'music' and 'radio' were used are absolutely necessary for sensibly resolving the query. Can anyone provide guidance on how I can get these terms to be visible within the INPlayMediaIntent
object?
Upvotes: 0
Views: 171
Reputation: 2225
The words 'music' and 'radio' seem to almost never appear in the mediaName
field, but their presence in the Siri query is usually reflected in the mediaType
field. This looks like a Int but actually corresponds to the INMediaItemType
enum listed here. It seems that the two values I was seeing (16 and 18) correspond to .radioStation
and .music
respectively (why .music
and not .musicStation
, I don't know).
Mostly, between the mediaType
and mediaName
I was able to code meaningful ways to resolve most queries.
Still some queries were intractable. "music radio" gets the mediaType
.radioStation
and an empty field for mediaName
and so the query passed to my IntentsExtention has no way of knowing the user asked for music.
Upvotes: 0