text: WEBVTT
  
  00:00:01.516 --> 00:00:05.500 A:middle
  [ Music ]
  
  00:00:10.516 --> 00:00:17.856 A:middle
  [ Applause ]
  
  00:00:18.356 --> 00:00:20.496 A:middle
  &gt;&gt; Hi. I'm Danny Mandel.
  
  00:00:20.496 --> 00:00:22.166 A:middle
  And welcome to Introducing
  
  00:00:22.216 --> 00:00:23.386 A:middle
  SiriKit Media Intents.
  
  00:00:24.366 --> 00:00:25.946 A:middle
  We've added media domain support
  
  00:00:25.946 --> 00:00:27.806 A:middle
  to SiriKit for audio use cases
  
  00:00:27.976 --> 00:00:29.986 A:middle
  and we're super excited to tell
  
  00:00:29.986 --> 00:00:32.366 A:middle
  you all about it.
  
  00:00:33.196 --> 00:00:34.096 A:middle
  So what are we going to cover in
  
  00:00:34.096 --> 00:00:34.556 A:middle
  this session?
  
  00:00:35.316 --> 00:00:36.836 A:middle
  The first thing we'll do is
  
  00:00:36.836 --> 00:00:38.816 A:middle
  introduce the new SiriKit Media
  
  00:00:38.816 --> 00:00:40.456 A:middle
  Intents and talk about their
  
  00:00:40.456 --> 00:00:41.026 A:middle
  capabilities.
  
  00:00:42.346 --> 00:00:43.796 A:middle
  Then we'll talk about what's
  
  00:00:43.796 --> 00:00:45.286 A:middle
  required for you to handle
  
  00:00:45.356 --> 00:00:46.616 A:middle
  SiriKit Media requests on your
  
  00:00:47.306 --> 00:00:47.376 A:middle
  app.
  
  00:00:47.946 --> 00:00:49.496 A:middle
  And finally, we'll talk about
  
  00:00:49.496 --> 00:00:50.726 A:middle
  some best practices you're going
  
  00:00:50.726 --> 00:00:52.466 A:middle
  to want to follow to provide the
  
  00:00:52.466 --> 00:00:54.126 A:middle
  best user experience possible
  
  00:00:54.446 --> 00:00:55.646 A:middle
  when you add SiriKit Media
  
  00:00:55.646 --> 00:00:57.326 A:middle
  Support to your app.
  
  00:00:58.216 --> 00:01:01.386 A:middle
  This year, we're allowing you to
  
  00:00:58.216 --> 00:01:01.386 A:middle
  This year, we're allowing you to
  
  00:01:01.386 --> 00:01:03.966 A:middle
  control audio in a whole new way
  
  00:01:04.066 --> 00:01:05.536 A:middle
  with SiriKit Media Intents.
  
  00:01:06.046 --> 00:01:07.276 A:middle
  And we think people are going to
  
  00:01:07.276 --> 00:01:08.856 A:middle
  love using the Siri Media
  
  00:01:08.856 --> 00:01:10.226 A:middle
  capabilities you build into your
  
  00:01:10.416 --> 00:01:10.626 A:middle
  apps.
  
  00:01:11.436 --> 00:01:12.796 A:middle
  With SiriKit Media Intents,
  
  00:01:13.166 --> 00:01:14.506 A:middle
  people will be able to do things
  
  00:01:14.506 --> 00:01:17.226 A:middle
  like play audio, update taste
  
  00:01:17.226 --> 00:01:19.216 A:middle
  profiles, add to collections,
  
  00:01:19.676 --> 00:01:20.236 A:middle
  and search.
  
  00:01:21.226 --> 00:01:22.276 A:middle
  This means that they'll be able
  
  00:01:22.276 --> 00:01:24.366 A:middle
  to use the rich natural language
  
  00:01:24.366 --> 00:01:26.136 A:middle
  processing capabilities of Siri
  
  00:01:26.936 --> 00:01:28.996 A:middle
  to say things like "Play Khalid
  
  00:01:28.996 --> 00:01:31.386 A:middle
  on my app," to immediately begin
  
  00:01:31.716 --> 00:01:35.286 A:middle
  playing Khalid in your app.
  
  00:01:36.676 --> 00:01:37.946 A:middle
  Let's take a look at the new
  
  00:01:38.036 --> 00:01:39.746 A:middle
  SiriKit Media Intents and their
  
  00:01:39.746 --> 00:01:40.436 A:middle
  capabilities.
  
  00:01:42.056 --> 00:01:44.486 A:middle
  There are four SiriKit Media
  
  00:01:44.486 --> 00:01:44.876 A:middle
  Intents.
  
  00:01:45.806 --> 00:01:46.816 A:middle
  The first intent is
  
  00:01:46.876 --> 00:01:48.006 A:middle
  INPlayMediaIntent.
  
  00:01:49.106 --> 00:01:51.056 A:middle
  INPlayMediaIntent allows people
  
  00:01:51.056 --> 00:01:52.516 A:middle
  to play audio by saying
  
  00:01:52.566 --> 00:01:54.676 A:middle
  something like "Play Outer Peace
  
  00:01:54.676 --> 00:01:55.746 A:middle
  in my app."
  
  00:01:56.046 --> 00:01:58.346 A:middle
  Now, you might remember that we
  
  00:01:58.346 --> 00:01:59.816 A:middle
  launched Media Playback Support
  
  00:01:59.816 --> 00:02:01.746 A:middle
  in IOS 12 with Shortcuts.
  
  00:01:59.816 --> 00:02:01.746 A:middle
  in IOS 12 with Shortcuts.
  
  00:02:02.256 --> 00:02:03.696 A:middle
  And this year, we're adding
  
  00:02:03.696 --> 00:02:04.826 A:middle
  SiriKit features to
  
  00:02:04.966 --> 00:02:07.206 A:middle
  INPlayMediaIntent.
  
  00:02:07.796 --> 00:02:09.765 A:middle
  The next intent is
  
  00:02:09.866 --> 00:02:10.946 A:middle
  INAddMediaIntent.
  
  00:02:11.846 --> 00:02:14.046 A:middle
  INAddMediaIntent allows people
  
  00:02:14.536 --> 00:02:16.146 A:middle
  to add items to their playlists
  
  00:02:16.186 --> 00:02:16.926 A:middle
  and libraries.
  
  00:02:17.626 --> 00:02:20.376 A:middle
  An example of this could be "add
  
  00:02:20.406 --> 00:02:21.676 A:middle
  this song to my road trip
  
  00:02:21.676 --> 00:02:24.486 A:middle
  playlist in my app."
  
  00:02:25.096 --> 00:02:25.526 A:middle
  We have
  
  00:02:25.526 --> 00:02:27.636 A:middle
  INUpdateMediaAffinityIntent,
  
  00:02:27.756 --> 00:02:29.096 A:middle
  which allows people to express
  
  00:02:29.096 --> 00:02:30.456 A:middle
  affinity for media items.
  
  00:02:31.556 --> 00:02:32.746 A:middle
  People can say this by saying
  
  00:02:32.746 --> 00:02:34.456 A:middle
  something as simple as "I like
  
  00:02:34.456 --> 00:02:34.916 A:middle
  this song."
  
  00:02:35.046 --> 00:02:38.186 A:middle
  And finally, we have
  
  00:02:38.326 --> 00:02:40.416 A:middle
  INSearchForMediaIntent, which
  
  00:02:40.416 --> 00:02:41.746 A:middle
  lets people search your app for
  
  00:02:41.746 --> 00:02:43.156 A:middle
  a particular media item.
  
  00:02:43.586 --> 00:02:46.156 A:middle
  For example, "Find Billie Eilish
  
  00:02:46.156 --> 00:02:48.886 A:middle
  in my app."
  
  00:02:50.126 --> 00:02:51.076 A:middle
  Let's talk about the supported
  
  00:02:51.076 --> 00:02:52.496 A:middle
  media types in SiriKit Media.
  
  00:02:53.366 --> 00:02:54.906 A:middle
  SiriKit Media supports a number
  
  00:02:54.906 --> 00:02:56.206 A:middle
  of different audio types, with
  
  00:02:56.206 --> 00:02:57.276 A:middle
  the first one being music.
  
  00:02:58.036 --> 00:03:00.066 A:middle
  And music support is going to
  
  00:02:58.036 --> 00:03:00.066 A:middle
  And music support is going to
  
  00:03:00.066 --> 00:03:01.636 A:middle
  let you say things like "Play
  
  00:03:01.636 --> 00:03:03.246 A:middle
  the song Awesome Song in my
  
  00:03:03.246 --> 00:03:03.486 A:middle
  app."
  
  00:03:04.766 --> 00:03:06.296 A:middle
  In addition to songs, we have
  
  00:03:06.296 --> 00:03:07.696 A:middle
  support for albums, artists,
  
  00:03:07.966 --> 00:03:09.756 A:middle
  playlists, genres, and many
  
  00:03:09.756 --> 00:03:09.956 A:middle
  more.
  
  00:03:09.956 --> 00:03:11.926 A:middle
  So you're going to want to check
  
  00:03:11.926 --> 00:03:13.236 A:middle
  out the documentation for
  
  00:03:13.236 --> 00:03:14.956 A:middle
  INMediaSearch to get the full
  
  00:03:14.956 --> 00:03:16.386 A:middle
  list of supported search terms.
  
  00:03:16.826 --> 00:03:18.506 A:middle
  And we want you to adopt as many
  
  00:03:18.506 --> 00:03:20.386 A:middle
  of them as possible to provide
  
  00:03:20.386 --> 00:03:22.286 A:middle
  the best Siri user experience in
  
  00:03:22.286 --> 00:03:23.256 A:middle
  your app.
  
  00:03:23.706 --> 00:03:24.976 A:middle
  Additionally, we have playback
  
  00:03:24.976 --> 00:03:27.406 A:middle
  controls, like shuffle, repeat,
  
  00:03:27.516 --> 00:03:28.256 A:middle
  and playback queues.
  
  00:03:28.506 --> 00:03:30.566 A:middle
  And this lets people say things
  
  00:03:30.566 --> 00:03:32.246 A:middle
  like "Play Khalid shuffle in my
  
  00:03:32.246 --> 00:03:34.926 A:middle
  app," or, "Play Outer Peace next
  
  00:03:35.196 --> 00:03:35.646 A:middle
  in my app."
  
  00:03:38.916 --> 00:03:40.386 A:middle
  The next supported audio type is
  
  00:03:40.446 --> 00:03:40.916 A:middle
  Podcasts.
  
  00:03:41.866 --> 00:03:42.826 A:middle
  People can begin playing
  
  00:03:42.826 --> 00:03:44.026 A:middle
  podcasts by saying something
  
  00:03:44.026 --> 00:03:45.416 A:middle
  like "Put on the Stuff You
  
  00:03:45.416 --> 00:03:46.806 A:middle
  Should Know podcast for my app."
  
  00:03:47.956 --> 00:03:49.626 A:middle
  Additionally, people can also
  
  00:03:49.626 --> 00:03:51.076 A:middle
  control the playback order and
  
  00:03:51.076 --> 00:03:53.106 A:middle
  speeds of podcast episodes.
  
  00:03:53.996 --> 00:03:55.266 A:middle
  This lets people say something
  
  00:03:55.266 --> 00:03:56.916 A:middle
  like "Play the newest episode of
  
  00:03:56.916 --> 00:03:58.246 A:middle
  Stuff You Should Know podcast in
  
  00:03:58.246 --> 00:04:00.286 A:middle
  my app," or, "Play the Stuff You
  
  00:03:58.246 --> 00:04:00.286 A:middle
  my app," or, "Play the Stuff You
  
  00:04:00.286 --> 00:04:01.836 A:middle
  Should Know podcast in my app at
  
  00:04:01.836 --> 00:04:02.456 A:middle
  double speed."
  
  00:04:05.686 --> 00:04:07.046 A:middle
  Moving on, we have audiobook
  
  00:04:07.046 --> 00:04:07.546 A:middle
  support.
  
  00:04:08.336 --> 00:04:09.846 A:middle
  This lets people say things like
  
  00:04:10.256 --> 00:04:11.646 A:middle
  "Play the audiobook Becoming in
  
  00:04:11.646 --> 00:04:11.986 A:middle
  my app."
  
  00:04:12.426 --> 00:04:14.536 A:middle
  And like Podcasts, people can
  
  00:04:14.536 --> 00:04:16.005 A:middle
  begin to playback at a specific
  
  00:04:16.005 --> 00:04:17.065 A:middle
  speed when asking to play
  
  00:04:17.065 --> 00:04:17.516 A:middle
  audiobooks.
  
  00:04:18.276 --> 00:04:20.616 A:middle
  And finally, we have radio
  
  00:04:20.616 --> 00:04:20.966 A:middle
  support.
  
  00:04:21.875 --> 00:04:23.536 A:middle
  Radio support allows people to
  
  00:04:23.536 --> 00:04:25.346 A:middle
  ask for a specific radio station
  
  00:04:25.346 --> 00:04:26.556 A:middle
  in your Radio Playback app.
  
  00:04:27.206 --> 00:04:29.796 A:middle
  For example, "Play 89.1 FM in my
  
  00:04:29.796 --> 00:04:29.956 A:middle
  app."
  
  00:04:32.586 --> 00:04:33.956 A:middle
  And don't worry if your app
  
  00:04:33.956 --> 00:04:35.006 A:middle
  doesn't fall into one of the
  
  00:04:35.006 --> 00:04:36.586 A:middle
  previous media types, you can
  
  00:04:36.586 --> 00:04:37.996 A:middle
  still adopt the SiriKit Media
  
  00:04:37.996 --> 00:04:39.826 A:middle
  Intent and get the full power.
  
  00:04:40.926 --> 00:04:41.706 A:middle
  People will be able to say
  
  00:04:41.706 --> 00:04:43.456 A:middle
  things like "Play search term in
  
  00:04:43.456 --> 00:04:44.886 A:middle
  my app," and you'll be able to
  
  00:04:44.886 --> 00:04:45.986 A:middle
  look up search term in your app
  
  00:04:45.986 --> 00:04:46.636 A:middle
  and play it.
  
  00:04:46.926 --> 00:04:48.796 A:middle
  The only thing that will be
  
  00:04:48.796 --> 00:04:49.986 A:middle
  missing will be support for
  
  00:04:49.986 --> 00:04:51.216 A:middle
  strongly parsed media types.
  
  00:04:51.746 --> 00:04:52.976 A:middle
  So say you had a nature sounds
  
  00:04:52.976 --> 00:04:55.356 A:middle
  app and you said "Play reptile
  
  00:04:55.356 --> 00:04:57.296 A:middle
  sounds in my app," or, "Play
  
  00:04:57.296 --> 00:04:59.426 A:middle
  mammal sounds in my app," Siri
  
  00:04:59.426 --> 00:05:00.326 A:middle
  is not going to know that those
  
  00:04:59.426 --> 00:05:00.326 A:middle
  is not going to know that those
  
  00:05:00.326 --> 00:05:01.196 A:middle
  are two different types of
  
  00:05:01.196 --> 00:05:01.796 A:middle
  animal sounds.
  
  00:05:02.116 --> 00:05:04.306 A:middle
  So you'd get a string of mammal
  
  00:05:04.306 --> 00:05:07.716 A:middle
  sounds or reptile sounds, and
  
  00:05:07.976 --> 00:05:09.066 A:middle
  you could look it up and play
  
  00:05:09.066 --> 00:05:09.166 A:middle
  it.
  
  00:05:09.306 --> 00:05:10.856 A:middle
  So not quite as structured as
  
  00:05:10.856 --> 00:05:12.396 A:middle
  the other types but still
  
  00:05:14.766 --> 00:05:15.026 A:middle
  supported.
  
  00:05:16.536 --> 00:05:17.456 A:middle
  Let's look at how we handle
  
  00:05:17.456 --> 00:05:19.106 A:middle
  these intents in SiriKit.
  
  00:05:21.276 --> 00:05:23.666 A:middle
  So the first thing to know about
  
  00:05:24.076 --> 00:05:25.336 A:middle
  how to request with SiriKit
  
  00:05:25.336 --> 00:05:26.936 A:middle
  Media is that SiriKit Media
  
  00:05:26.936 --> 00:05:28.436 A:middle
  Intents are just like any other
  
  00:05:28.436 --> 00:05:29.156 A:middle
  SiriKit domain.
  
  00:05:30.196 --> 00:05:31.486 A:middle
  So all the intent-handling
  
  00:05:31.806 --> 00:05:32.906 A:middle
  happens in your Intents app
  
  00:05:32.906 --> 00:05:35.136 A:middle
  extension, where you conform to
  
  00:05:35.136 --> 00:05:36.266 A:middle
  the SiriKit Media Intent
  
  00:05:36.266 --> 00:05:36.966 A:middle
  handling protocols.
  
  00:05:37.516 --> 00:05:39.626 A:middle
  The details of SiriKit request
  
  00:05:39.626 --> 00:05:40.516 A:middle
  handling have been covered
  
  00:05:40.516 --> 00:05:42.326 A:middle
  really well in previous WWDC
  
  00:05:42.326 --> 00:05:44.086 A:middle
  talks, so I'd refer you to those
  
  00:05:44.156 --> 00:05:45.906 A:middle
  talks and to the developer
  
  00:05:45.906 --> 00:05:47.616 A:middle
  documentation online for more
  
  00:05:47.616 --> 00:05:49.596 A:middle
  general details about SiriKit
  
  00:05:49.596 --> 00:05:50.276 A:middle
  Request Processing.
  
  00:05:53.196 --> 00:05:54.846 A:middle
  Now let's look at what happens
  
  00:05:54.846 --> 00:05:56.516 A:middle
  for a typical request in the
  
  00:05:56.586 --> 00:05:57.546 A:middle
  SiriKit Media domain.
  
  00:05:58.986 --> 00:06:00.236 A:middle
  The request processing begins
  
  00:05:58.986 --> 00:06:00.236 A:middle
  The request processing begins
  
  00:06:00.436 --> 00:06:01.886 A:middle
  when someone says "Play cool
  
  00:06:01.886 --> 00:06:02.826 A:middle
  song in my app."
  
  00:06:03.346 --> 00:06:04.726 A:middle
  And Siri is going to recognize
  
  00:06:04.726 --> 00:06:05.796 A:middle
  that this is a request for your
  
  00:06:05.796 --> 00:06:07.146 A:middle
  app, it's going to launch your
  
  00:06:07.146 --> 00:06:07.906 A:middle
  Intents Extension.
  
  00:06:08.806 --> 00:06:09.906 A:middle
  Now, there are three steps in
  
  00:06:09.906 --> 00:06:11.116 A:middle
  SiriKit Request Processing:
  
  00:06:11.926 --> 00:06:13.456 A:middle
  resolve, confirm, and handle.
  
  00:06:13.706 --> 00:06:16.856 A:middle
  The first step in request
  
  00:06:16.856 --> 00:06:18.206 A:middle
  processing is the resolve step.
  
  00:06:18.726 --> 00:06:20.666 A:middle
  In the media domain, the resolve
  
  00:06:20.666 --> 00:06:21.886 A:middle
  step is where we take the
  
  00:06:21.886 --> 00:06:24.086 A:middle
  intents' INMediaSearch object
  
  00:06:24.426 --> 00:06:26.306 A:middle
  and we run a search against our
  
  00:06:26.306 --> 00:06:26.966 A:middle
  app catalog.
  
  00:06:27.896 --> 00:06:29.406 A:middle
  The output of resolve is one or
  
  00:06:29.406 --> 00:06:31.436 A:middle
  more concrete media item objects
  
  00:06:31.436 --> 00:06:31.756 A:middle
  to play.
  
  00:06:33.056 --> 00:06:34.696 A:middle
  Alternatively, if we didn't find
  
  00:06:34.696 --> 00:06:36.526 A:middle
  anything that matched or another
  
  00:06:36.526 --> 00:06:38.276 A:middle
  error occurred, we can return an
  
  00:06:38.276 --> 00:06:39.986 A:middle
  unsupported result, which will
  
  00:06:39.986 --> 00:06:41.346 A:middle
  tell Siri to display the
  
  00:06:41.346 --> 00:06:44.776 A:middle
  appropriate error dialog.
  
  00:06:45.276 --> 00:06:46.306 A:middle
  The next step in Request
  
  00:06:46.306 --> 00:06:47.576 A:middle
  Processing is the confirm step.
  
  00:06:48.706 --> 00:06:50.426 A:middle
  And typically, we discourage use
  
  00:06:50.426 --> 00:06:51.646 A:middle
  of the confirm step in the Media
  
  00:06:51.646 --> 00:06:51.926 A:middle
  domain.
  
  00:06:52.826 --> 00:06:54.156 A:middle
  In looking at usage in our own
  
  00:06:54.156 --> 00:06:56.516 A:middle
  apps, we find that using confirm
  
  00:06:57.136 --> 00:06:58.526 A:middle
  actually lowers the likelihood
  
  00:06:58.526 --> 00:06:59.866 A:middle
  that people will continue on to
  
  00:06:59.896 --> 00:07:00.376 A:middle
  play media.
  
  00:06:59.896 --> 00:07:00.376 A:middle
  play media.
  
  00:07:00.876 --> 00:07:01.926 A:middle
  So we don't recommend using the
  
  00:07:01.926 --> 00:07:03.156 A:middle
  confirm step in the Media
  
  00:07:03.156 --> 00:07:03.456 A:middle
  domain.
  
  00:07:04.076 --> 00:07:06.976 A:middle
  The final step in Request
  
  00:07:06.976 --> 00:07:09.066 A:middle
  Processing is the handle step.
  
  00:07:09.226 --> 00:07:11.716 A:middle
  Now, for INPlayMediaIntent, this
  
  00:07:11.716 --> 00:07:12.776 A:middle
  ends up being really simple,
  
  00:07:12.996 --> 00:07:13.996 A:middle
  because we're going to return
  
  00:07:13.996 --> 00:07:15.766 A:middle
  the response code "handle an
  
  00:07:15.946 --> 00:07:17.256 A:middle
  app," which is going to do a
  
  00:07:17.256 --> 00:07:18.456 A:middle
  background app launch.
  
  00:07:19.426 --> 00:07:23.076 A:middle
  And inside of our background app
  
  00:07:23.076 --> 00:07:25.116 A:middle
  launch, we're just going to play
  
  00:07:25.116 --> 00:07:26.846 A:middle
  media like we normally do in our
  
  00:07:26.906 --> 00:07:26.973 A:middle
  app.
  
  00:07:26.973 --> 00:07:29.106 A:middle
  The only tricky part here is
  
  00:07:29.166 --> 00:07:29.446 A:middle
  testing.
  
  00:07:29.446 --> 00:07:30.566 A:middle
  You're going to want to make
  
  00:07:30.566 --> 00:07:31.676 A:middle
  sure everything plays because
  
  00:07:31.676 --> 00:07:32.466 A:middle
  there's not going to be any UI
  
  00:07:32.466 --> 00:07:33.146 A:middle
  on screen.
  
  00:07:33.146 --> 00:07:34.106 A:middle
  You're also going to want to
  
  00:07:34.106 --> 00:07:35.506 A:middle
  make sure that you test in a
  
  00:07:35.506 --> 00:07:36.746 A:middle
  variety of situations.
  
  00:07:37.086 --> 00:07:39.576 A:middle
  For example, in CarPlay or when
  
  00:07:39.576 --> 00:07:40.336 A:middle
  you're wearing headphones.
  
  00:07:40.726 --> 00:07:41.766 A:middle
  So now that we've seen an
  
  00:07:41.766 --> 00:07:43.526 A:middle
  overview of SiriKit Request
  
  00:07:43.526 --> 00:07:45.386 A:middle
  Processing, let's take a look at
  
  00:07:45.386 --> 00:07:46.826 A:middle
  a simplified resolve media items
  
  00:07:46.826 --> 00:07:47.106 A:middle
  method.
  
  00:07:47.406 --> 00:07:48.986 A:middle
  And the first thing to note is
  
  00:07:48.986 --> 00:07:50.366 A:middle
  that the parameters are going to
  
  00:07:50.366 --> 00:07:52.166 A:middle
  be slightly different but the
  
  00:07:52.216 --> 00:07:53.636 A:middle
  same resolve logic is going to
  
  00:07:53.636 --> 00:07:55.286 A:middle
  be the same for all four media
  
  00:07:55.286 --> 00:07:55.776 A:middle
  intents.
  
  00:07:56.686 --> 00:07:58.406 A:middle
  Resolve's job is to search the
  
  00:07:58.406 --> 00:07:59.086 A:middle
  app catalog.
  
  00:07:59.086 --> 00:08:00.296 A:middle
  And you're going to want to do
  
  00:07:59.086 --> 00:08:00.296 A:middle
  And you're going to want to do
  
  00:08:00.296 --> 00:08:01.516 A:middle
  it the same way for all four
  
  00:08:02.446 --> 00:08:02.676 A:middle
  intents.
  
  00:08:03.616 --> 00:08:06.126 A:middle
  So we'll initialize a result to
  
  00:08:06.126 --> 00:08:07.056 A:middle
  the unsupported result.
  
  00:08:07.056 --> 00:08:08.676 A:middle
  And this is going to tell Siri
  
  00:08:08.676 --> 00:08:09.726 A:middle
  to say the appropriate error
  
  00:08:09.726 --> 00:08:11.566 A:middle
  dialogue if we don't find
  
  00:08:11.566 --> 00:08:14.536 A:middle
  anything in our app catalog.
  
  00:08:15.466 --> 00:08:16.976 A:middle
  INMediaSearch is the intent
  
  00:08:16.976 --> 00:08:18.426 A:middle
  field that contains the details
  
  00:08:18.426 --> 00:08:19.466 A:middle
  about what the user asks to
  
  00:08:19.466 --> 00:08:19.666 A:middle
  play.
  
  00:08:20.686 --> 00:08:22.166 A:middle
  INMediaSearch represents the
  
  00:08:22.166 --> 00:08:23.216 A:middle
  universe of all the
  
  00:08:23.216 --> 00:08:24.666 A:middle
  audio-related queries that Siri
  
  00:08:24.666 --> 00:08:25.206 A:middle
  supports.
  
  00:08:26.196 --> 00:08:27.716 A:middle
  Our job in Resolve is to go from
  
  00:08:27.716 --> 00:08:29.006 A:middle
  that universe of possibilities
  
  00:08:29.536 --> 00:08:30.716 A:middle
  to a single item to play.
  
  00:08:31.626 --> 00:08:33.246 A:middle
  And in this example, the first
  
  00:08:33.246 --> 00:08:34.946 A:middle
  thing we're going to do is read
  
  00:08:34.946 --> 00:08:36.236 A:middle
  the media name off the
  
  00:08:36.236 --> 00:08:37.166 A:middle
  INMediaSearch.
  
  00:08:39.376 --> 00:08:40.926 A:middle
  Then we're going to retrieve a
  
  00:08:40.926 --> 00:08:42.246 A:middle
  list of items from our app
  
  00:08:42.246 --> 00:08:42.716 A:middle
  catalog.
  
  00:08:43.676 --> 00:08:46.436 A:middle
  And we're going to use the media
  
  00:08:46.436 --> 00:08:47.496 A:middle
  name property off the media
  
  00:08:47.496 --> 00:08:48.906 A:middle
  search to compare against the
  
  00:08:48.906 --> 00:08:50.786 A:middle
  item's name property.
  
  00:08:51.296 --> 00:08:53.956 A:middle
  And we'll talk a little bit more
  
  00:08:53.956 --> 00:08:55.346 A:middle
  about this later on, but this
  
  00:08:55.386 --> 00:08:56.276 A:middle
  isn't really something you're
  
  00:08:56.276 --> 00:08:57.416 A:middle
  going to want to do in your
  
  00:08:57.416 --> 00:08:58.906 A:middle
  shipping app.
  
  00:08:59.696 --> 00:09:02.346 A:middle
  But if we had an exact match on
  
  00:08:59.696 --> 00:09:02.346 A:middle
  But if we had an exact match on
  
  00:09:02.346 --> 00:09:04.326 A:middle
  the name, we found the item to
  
  00:09:04.326 --> 00:09:05.996 A:middle
  play, and we're going to create
  
  00:09:05.996 --> 00:09:07.796 A:middle
  a success result using that
  
  00:09:07.796 --> 00:09:08.506 A:middle
  item's properties.
  
  00:09:10.096 --> 00:09:11.996 A:middle
  Then we'll call a completion
  
  00:09:11.996 --> 00:09:13.826 A:middle
  handler and move on to handle.
  
  00:09:14.326 --> 00:09:17.386 A:middle
  And in this case, as we said
  
  00:09:17.386 --> 00:09:19.196 A:middle
  before, handle ends up being
  
  00:09:19.196 --> 00:09:20.786 A:middle
  very short, since all we're
  
  00:09:20.786 --> 00:09:21.996 A:middle
  going to do is return the
  
  00:09:22.076 --> 00:09:23.726 A:middle
  handleInApp success response
  
  00:09:23.806 --> 00:09:23.996 A:middle
  code.
  
  00:09:24.056 --> 00:09:25.586 A:middle
  And this is going to start the
  
  00:09:25.586 --> 00:09:26.746 A:middle
  process of background launching
  
  00:09:26.746 --> 00:09:27.116 A:middle
  our app.
  
  00:09:28.186 --> 00:09:29.396 A:middle
  Now let's take a look at
  
  00:09:29.456 --> 00:09:30.376 A:middle
  background app launch.
  
  00:09:32.156 --> 00:09:33.666 A:middle
  The method that we implement in
  
  00:09:33.666 --> 00:09:35.546 A:middle
  our app delegate to support
  
  00:09:35.596 --> 00:09:36.886 A:middle
  background app launch is
  
  00:09:37.276 --> 00:09:38.886 A:middle
  application handling intent
  
  00:09:39.216 --> 00:09:39.856 A:middle
  completion handler.
  
  00:09:41.846 --> 00:09:43.306 A:middle
  Again, this is a pretty short
  
  00:09:43.306 --> 00:09:44.026 A:middle
  implementation.
  
  00:09:44.026 --> 00:09:47.416 A:middle
  We're going to read the first
  
  00:09:47.416 --> 00:09:48.966 A:middle
  media item to play out of the
  
  00:09:48.966 --> 00:09:51.796 A:middle
  intent and then we're going to
  
  00:09:51.796 --> 00:09:53.216 A:middle
  just play it in our app the way
  
  00:09:53.216 --> 00:09:53.836 A:middle
  we normally do.
  
  00:09:55.796 --> 00:09:57.256 A:middle
  And finally, we'll call the
  
  00:09:57.256 --> 00:09:58.886 A:middle
  completion handler with our
  
  00:09:58.886 --> 00:10:00.786 A:middle
  success response code.
  
  00:09:58.886 --> 00:10:00.786 A:middle
  success response code.
  
  00:10:01.856 --> 00:10:03.446 A:middle
  So now that we've seen the new
  
  00:10:03.446 --> 00:10:04.786 A:middle
  intents and how they all fit
  
  00:10:04.866 --> 00:10:06.526 A:middle
  together, let's hand it over to
  
  00:10:06.526 --> 00:10:08.286 A:middle
  Ryan Klems, who's going to show
  
  00:10:08.286 --> 00:10:09.906 A:middle
  us how this all works in a real
  
  00:10:10.096 --> 00:10:10.166 A:middle
  app.
  
  00:10:11.516 --> 00:10:17.216 A:middle
  [ Applause ]
  
  00:10:17.716 --> 00:10:18.346 A:middle
  &gt;&gt; Thanks, Danny.
  
  00:10:20.816 --> 00:10:22.066 A:middle
  Adding SiriKit Media Intent
  
  00:10:22.066 --> 00:10:23.216 A:middle
  handling to your existing media
  
  00:10:23.216 --> 00:10:24.196 A:middle
  application is easy.
  
  00:10:24.616 --> 00:10:25.536 A:middle
  Here we have our music
  
  00:10:25.536 --> 00:10:26.846 A:middle
  application and all we need to
  
  00:10:26.846 --> 00:10:29.176 A:middle
  do to add Siri support is to add
  
  00:10:29.176 --> 00:10:30.636 A:middle
  the Siri extension target, add a
  
  00:10:30.636 --> 00:10:33.496 A:middle
  few methods, and then we'll up
  
  00:10:33.496 --> 00:10:34.816 A:middle
  and handling Siri requests in no
  
  00:10:34.816 --> 00:10:35.086 A:middle
  time.
  
  00:10:36.056 --> 00:10:36.966 A:middle
  To add to the intent's
  
  00:10:36.966 --> 00:10:38.176 A:middle
  extension, all we have to do is
  
  00:10:38.176 --> 00:10:41.226 A:middle
  go to file, new, target, select
  
  00:10:42.516 --> 00:10:45.326 A:middle
  the intents extension and click
  
  00:10:45.326 --> 00:10:45.796 A:middle
  next.
  
  00:10:46.236 --> 00:10:50.896 A:middle
  Give it a name and then click
  
  00:10:50.896 --> 00:10:51.336 A:middle
  finish.
  
  00:10:53.716 --> 00:10:55.396 A:middle
  It will go ahead and create our
  
  00:10:55.396 --> 00:10:56.516 A:middle
  intent handler for us.
  
  00:10:57.256 --> 00:10:59.486 A:middle
  We'll want to go ahead and add
  
  00:10:59.756 --> 00:11:01.196 A:middle
  the Siri capability to our
  
  00:10:59.756 --> 00:11:01.196 A:middle
  the Siri capability to our
  
  00:11:01.196 --> 00:11:01.836 A:middle
  application.
  
  00:11:05.576 --> 00:11:07.166 A:middle
  And then we'll come over to our
  
  00:11:07.166 --> 00:11:09.896 A:middle
  control extension and we will
  
  00:11:09.896 --> 00:11:12.406 A:middle
  add our intents that we support,
  
  00:11:12.406 --> 00:11:13.456 A:middle
  and in this example, we'll just
  
  00:11:13.456 --> 00:11:14.736 A:middle
  go ahead and support the
  
  00:11:15.806 --> 00:11:19.266 A:middle
  INPlayMediaIntent and the
  
  00:11:19.266 --> 00:11:20.406 A:middle
  INAddMediaIntent.
  
  00:11:27.046 --> 00:11:27.836 A:middle
  We'll go ahead and select the
  
  00:11:27.836 --> 00:11:28.656 A:middle
  music type.
  
  00:11:30.646 --> 00:11:31.896 A:middle
  We have a few methods here that
  
  00:11:31.896 --> 00:11:33.406 A:middle
  we want to add to make sure that
  
  00:11:33.406 --> 00:11:34.836 A:middle
  we build in our extension.
  
  00:11:40.726 --> 00:11:41.666 A:middle
  And we'll want to make sure to
  
  00:11:41.666 --> 00:11:44.976 A:middle
  turn on our proper code signing.
  
  00:11:46.156 --> 00:11:47.396 A:middle
  Now we'll come over to our
  
  00:11:47.396 --> 00:11:49.496 A:middle
  intent handler and all we need
  
  00:11:49.496 --> 00:11:51.086 A:middle
  to do is add support for the
  
  00:11:51.086 --> 00:11:52.516 A:middle
  INPlayMediaIntent handling
  
  00:11:52.516 --> 00:11:53.016 A:middle
  protocol.
  
  00:11:53.716 --> 00:11:57.636 A:middle
  And then we'll drop in some
  
  00:11:57.636 --> 00:12:01.526 A:middle
  stubs for our resolve and handle
  
  00:11:57.636 --> 00:12:01.526 A:middle
  stubs for our resolve and handle
  
  00:12:02.586 --> 00:12:03.196 A:middle
  methods.
  
  00:12:03.276 --> 00:12:06.436 A:middle
  For this beginning example,
  
  00:12:06.526 --> 00:12:07.436 A:middle
  we're just going to return the
  
  00:12:07.436 --> 00:12:10.566 A:middle
  unsupported result from resolve
  
  00:12:10.566 --> 00:12:11.856 A:middle
  media items, which will cause
  
  00:12:11.856 --> 00:12:13.096 A:middle
  Siri to speak to the fact that
  
  00:12:13.136 --> 00:12:14.256 A:middle
  it couldn't find the item.
  
  00:12:15.096 --> 00:12:16.296 A:middle
  So we'll go ahead and try that
  
  00:12:16.296 --> 00:12:16.506 A:middle
  out.
  
  00:12:16.846 --> 00:12:17.536 A:middle
  This is what that would've
  
  00:12:17.536 --> 00:12:17.936 A:middle
  looked like.
  
  00:12:28.096 --> 00:12:30.376 A:middle
  So Siri speaks to the fact that
  
  00:12:30.376 --> 00:12:32.446 A:middle
  it couldn't find the item due to
  
  00:12:32.446 --> 00:12:33.326 A:middle
  the fact that we returned the
  
  00:12:33.326 --> 00:12:35.656 A:middle
  unsupported from the intent
  
  00:12:35.656 --> 00:12:35.936 A:middle
  handler.
  
  00:12:37.366 --> 00:12:39.286 A:middle
  So what we'll do now is we'll go
  
  00:12:39.286 --> 00:12:41.326 A:middle
  ahead and hook this up to our
  
  00:12:41.326 --> 00:12:42.766 A:middle
  existing search implementation.
  
  00:12:48.056 --> 00:12:50.456 A:middle
  And in this case, the first
  
  00:12:50.456 --> 00:12:51.076 A:middle
  thing that we're going to want
  
  00:12:51.076 --> 00:12:52.496 A:middle
  to do is determine what the user
  
  00:12:52.496 --> 00:12:53.206 A:middle
  is searching for.
  
  00:12:53.206 --> 00:12:55.096 A:middle
  So for this simple example,
  
  00:12:55.096 --> 00:12:57.136 A:middle
  we'll just search for an artist.
  
  00:12:57.846 --> 00:13:03.046 A:middle
  And in the method, we'll go
  
  00:12:57.846 --> 00:13:03.046 A:middle
  And in the method, we'll go
  
  00:13:03.046 --> 00:13:06.106 A:middle
  ahead and resolve the media
  
  00:13:06.106 --> 00:13:06.476 A:middle
  item.
  
  00:13:24.046 --> 00:13:25.146 A:middle
  And once we resolve the media
  
  00:13:25.146 --> 00:13:27.196 A:middle
  item, then we will return to our
  
  00:13:27.196 --> 00:13:28.966 A:middle
  handle method and we're just
  
  00:13:28.966 --> 00:13:30.456 A:middle
  going to return the handleInApp
  
  00:13:31.236 --> 00:13:33.176 A:middle
  method response code, which will
  
  00:13:33.176 --> 00:13:34.656 A:middle
  cause us to background launch
  
  00:13:34.656 --> 00:13:35.346 A:middle
  the application.
  
  00:13:35.346 --> 00:13:36.326 A:middle
  So in order to do that, we'll
  
  00:13:36.326 --> 00:13:37.566 A:middle
  switch over to our app delegate
  
  00:13:38.436 --> 00:13:41.176 A:middle
  and we need to add the handle
  
  00:13:41.176 --> 00:13:41.866 A:middle
  intent method.
  
  00:13:42.356 --> 00:13:43.796 A:middle
  And this will just extract the
  
  00:13:43.796 --> 00:13:45.806 A:middle
  INMediaItem that we passed, that
  
  00:13:45.806 --> 00:13:46.886 A:middle
  we resolved, in the previous
  
  00:13:46.886 --> 00:13:48.796 A:middle
  step, and pass that to playback.
  
  00:13:49.506 --> 00:13:51.656 A:middle
  And so we'll go ahead and play
  
  00:13:51.656 --> 00:13:53.506 A:middle
  what that would look like.
  
  00:13:59.456 --> 00:14:00.766 A:middle
  So you can see, we return the
  
  00:13:59.456 --> 00:14:00.766 A:middle
  So you can see, we return the
  
  00:14:00.896 --> 00:14:02.896 A:middle
  INMediaItem and it has resolved
  
  00:14:02.896 --> 00:14:04.706 A:middle
  that, handed it back to the
  
  00:14:04.706 --> 00:14:06.456 A:middle
  application, and begun playback.
  
  00:14:07.436 --> 00:14:08.486 A:middle
  So now that we've done that, why
  
  00:14:08.486 --> 00:14:09.476 A:middle
  don't we go ahead and add
  
  00:14:09.476 --> 00:14:12.696 A:middle
  support for the add method.
  
  00:14:12.756 --> 00:14:14.436 A:middle
  So to do that, we'll just extend
  
  00:14:14.436 --> 00:14:16.446 A:middle
  this by adding the
  
  00:14:16.446 --> 00:14:17.776 A:middle
  INAddMediaIntent handling
  
  00:14:17.776 --> 00:14:18.256 A:middle
  protocol.
  
  00:14:22.836 --> 00:14:25.146 A:middle
  And then we'll add our methods
  
  00:14:25.186 --> 00:14:27.706 A:middle
  for resolving and handling for
  
  00:14:27.706 --> 00:14:28.356 A:middle
  the add method.
  
  00:14:29.316 --> 00:14:30.166 A:middle
  So you notice here that the
  
  00:14:30.166 --> 00:14:31.636 A:middle
  resolve media items for add
  
  00:14:31.636 --> 00:14:33.646 A:middle
  looks pretty much identical to
  
  00:14:33.646 --> 00:14:35.066 A:middle
  the resolve method for play.
  
  00:14:36.966 --> 00:14:38.456 A:middle
  Additionally, now for ad, we'll
  
  00:14:38.456 --> 00:14:39.706 A:middle
  also have a resolve media
  
  00:14:39.706 --> 00:14:40.456 A:middle
  destination.
  
  00:14:40.536 --> 00:14:41.316 A:middle
  And this is where we're going to
  
  00:14:41.316 --> 00:14:42.166 A:middle
  determine whether the user's
  
  00:14:42.166 --> 00:14:43.396 A:middle
  trying to add to the library or
  
  00:14:43.396 --> 00:14:44.196 A:middle
  to a playlist.
  
  00:14:45.186 --> 00:14:46.316 A:middle
  And in the case of a playlist,
  
  00:14:46.316 --> 00:14:47.126 A:middle
  you might want to do something
  
  00:14:47.126 --> 00:14:49.246 A:middle
  like "Return playlist name not
  
  00:14:49.246 --> 00:14:51.526 A:middle
  found," if the playlist that the
  
  00:14:51.526 --> 00:14:53.236 A:middle
  user specified was not present
  
  00:14:53.236 --> 00:14:53.966 A:middle
  in their library.
  
  00:14:56.686 --> 00:14:59.136 A:middle
  And also, what's different in
  
  00:14:59.196 --> 00:15:00.716 A:middle
  the ad is there's no reason to
  
  00:14:59.196 --> 00:15:00.716 A:middle
  the ad is there's no reason to
  
  00:15:00.716 --> 00:15:02.196 A:middle
  go back to the application like
  
  00:15:02.306 --> 00:15:03.816 A:middle
  to begin playback like we do in
  
  00:15:03.816 --> 00:15:04.866 A:middle
  the Play Media Intent.
  
  00:15:05.316 --> 00:15:06.476 A:middle
  So in this case what we would do
  
  00:15:06.476 --> 00:15:07.336 A:middle
  is we would actually handle
  
  00:15:07.396 --> 00:15:08.746 A:middle
  everything in the extension
  
  00:15:08.746 --> 00:15:09.146 A:middle
  itself.
  
  00:15:09.776 --> 00:15:11.756 A:middle
  So we have the resolved media
  
  00:15:11.756 --> 00:15:12.786 A:middle
  item, and we'll just go ahead
  
  00:15:12.786 --> 00:15:15.646 A:middle
  and use our applications methods
  
  00:15:15.646 --> 00:15:16.966 A:middle
  to add to the library or to the
  
  00:15:17.066 --> 00:15:17.566 A:middle
  playlist.
  
  00:15:17.966 --> 00:15:18.766 A:middle
  And in this case, we're just
  
  00:15:18.766 --> 00:15:19.896 A:middle
  going to use the media player
  
  00:15:19.896 --> 00:15:21.366 A:middle
  utilities to add to it.
  
  00:15:22.126 --> 00:15:23.226 A:middle
  So let's go ahead and take a
  
  00:15:23.226 --> 00:15:24.026 A:middle
  look at what that would look
  
  00:15:24.076 --> 00:15:24.246 A:middle
  like.
  
  00:15:37.316 --> 00:15:38.546 A:middle
  So it speaks to the item that is
  
  00:15:38.546 --> 00:15:39.976 A:middle
  added to the playlist as well as
  
  00:15:39.976 --> 00:15:41.076 A:middle
  the playlist name, because those
  
  00:15:41.076 --> 00:15:43.426 A:middle
  are specified in the request.
  
  00:15:44.456 --> 00:15:45.846 A:middle
  So as you can see, it's
  
  00:15:45.846 --> 00:15:47.376 A:middle
  relatively easy to add support
  
  00:15:47.376 --> 00:15:48.236 A:middle
  to your application.
  
  00:15:48.236 --> 00:15:49.186 A:middle
  And we really look forward to
  
  00:15:49.186 --> 00:15:50.606 A:middle
  seeing what you do in your
  
  00:15:50.606 --> 00:15:51.156 A:middle
  application.
  
  00:15:51.336 --> 00:15:51.626 A:middle
  Thank you.
  
  00:15:52.016 --> 00:15:53.586 A:middle
  [ Applause ]
  
  00:15:53.586 --> 00:15:54.246 A:middle
  Danny, back to you.
  
  00:15:57.756 --> 00:15:58.356 A:middle
  &gt;&gt; Thanks, Ryan.
  
  00:15:58.966 --> 00:16:00.216 A:middle
  So what did Ryan show us?
  
  00:15:58.966 --> 00:16:00.216 A:middle
  So what did Ryan show us?
  
  00:16:00.826 --> 00:16:02.306 A:middle
  First, he showed us how to add
  
  00:16:02.306 --> 00:16:03.776 A:middle
  our intents extension to our
  
  00:16:04.516 --> 00:16:04.596 A:middle
  app.
  
  00:16:04.596 --> 00:16:06.536 A:middle
  Then he showed us how to specify
  
  00:16:06.536 --> 00:16:08.066 A:middle
  our supported intents and
  
  00:16:08.066 --> 00:16:09.076 A:middle
  supported media types.
  
  00:16:09.486 --> 00:16:11.106 A:middle
  And finally, he showed us how to
  
  00:16:11.106 --> 00:16:13.676 A:middle
  implement resolve and handle for
  
  00:16:13.676 --> 00:16:15.486 A:middle
  INPlayMediaIntent and
  
  00:16:15.486 --> 00:16:17.416 A:middle
  INAddMediaIntent so we could
  
  00:16:17.416 --> 00:16:19.646 A:middle
  immediately begin playing and
  
  00:16:19.646 --> 00:16:22.286 A:middle
  adding media using Siri.
  
  00:16:23.556 --> 00:16:25.036 A:middle
  So let's look at some best
  
  00:16:25.036 --> 00:16:26.106 A:middle
  practices you're going to want
  
  00:16:26.106 --> 00:16:27.936 A:middle
  to follow when you adopt SiriKit
  
  00:16:27.936 --> 00:16:28.246 A:middle
  Media.
  
  00:16:28.866 --> 00:16:31.686 A:middle
  We have great news if you've
  
  00:16:31.686 --> 00:16:33.036 A:middle
  already implemented shortcut
  
  00:16:33.036 --> 00:16:34.326 A:middle
  support for media playback.
  
  00:16:35.116 --> 00:16:36.966 A:middle
  SiriKit Media uses the same code
  
  00:16:37.056 --> 00:16:38.596 A:middle
  and handle and for background
  
  00:16:38.596 --> 00:16:39.106 A:middle
  app launch.
  
  00:16:40.176 --> 00:16:41.916 A:middle
  While Shortcuts operates on
  
  00:16:41.916 --> 00:16:43.656 A:middle
  previously donated intents which
  
  00:16:43.656 --> 00:16:45.206 A:middle
  don't require intent resolution,
  
  00:16:45.886 --> 00:16:47.626 A:middle
  SiriKit does require a resolve
  
  00:16:47.626 --> 00:16:47.896 A:middle
  step.
  
  00:16:48.446 --> 00:16:49.416 A:middle
  So the two things you're going
  
  00:16:49.416 --> 00:16:51.516 A:middle
  to need to add are your resolve
  
  00:16:51.516 --> 00:16:52.976 A:middle
  method and your intent handler,
  
  00:16:53.546 --> 00:16:54.226 A:middle
  and you're going to need to
  
  00:16:54.226 --> 00:16:55.696 A:middle
  update your intents extension
  
  00:16:55.696 --> 00:16:57.286 A:middle
  supported media types in Xcode
  
  00:16:57.976 --> 00:16:59.556 A:middle
  so Siri knows what content types
  
  00:16:59.556 --> 00:17:00.286 A:middle
  your app supports.
  
  00:16:59.556 --> 00:17:00.286 A:middle
  your app supports.
  
  00:17:01.516 --> 00:17:03.256 A:middle
  The extensions handle method
  
  00:17:03.256 --> 00:17:04.396 A:middle
  should be the same between both
  
  00:17:04.396 --> 00:17:05.876 A:middle
  implementations and the
  
  00:17:05.876 --> 00:17:08.205 A:middle
  background app launch to the app
  
  00:17:08.205 --> 00:17:10.016 A:middle
  delegate's handle intent can be
  
  00:17:10.016 --> 00:17:11.766 A:middle
  the same, as long as you use the
  
  00:17:11.806 --> 00:17:13.705 A:middle
  same identifiers for your media
  
  00:17:13.705 --> 00:17:14.036 A:middle
  items.
  
  00:17:14.036 --> 00:17:17.096 A:middle
  So let's see what this looks
  
  00:17:17.236 --> 00:17:17.415 A:middle
  like.
  
  00:17:17.756 --> 00:17:18.695 A:middle
  Here's our Shortcuts
  
  00:17:18.695 --> 00:17:19.915 A:middle
  implementation from last year.
  
  00:17:20.445 --> 00:17:21.406 A:middle
  You'll notice that there's no
  
  00:17:21.406 --> 00:17:22.516 A:middle
  resolve method, but the rest of
  
  00:17:22.516 --> 00:17:22.976 A:middle
  it's the same.
  
  00:17:23.705 --> 00:17:25.056 A:middle
  So to go from Shortcuts to
  
  00:17:25.056 --> 00:17:27.546 A:middle
  SiriKit, we just add in our
  
  00:17:27.546 --> 00:17:30.016 A:middle
  resolve method and we're good to
  
  00:17:31.396 --> 00:17:31.476 A:middle
  go.
  
  00:17:31.726 --> 00:17:32.926 A:middle
  Now let's talk about what you
  
  00:17:32.926 --> 00:17:34.096 A:middle
  need to do to bring SiriKit
  
  00:17:34.096 --> 00:17:37.656 A:middle
  Media Support to the Apple
  
  00:17:37.656 --> 00:17:37.906 A:middle
  Watch.
  
  00:17:37.906 --> 00:17:39.186 A:middle
  On watchOS, apps launch in the
  
  00:17:39.186 --> 00:17:39.696 A:middle
  foreground.
  
  00:17:40.086 --> 00:17:41.376 A:middle
  And the way you do that is by
  
  00:17:41.376 --> 00:17:44.516 A:middle
  returning INPlayMediaIntent
  
  00:17:44.516 --> 00:17:46.636 A:middle
  response code continueInApp from
  
  00:17:46.906 --> 00:17:47.906 A:middle
  your handle method in your
  
  00:17:47.906 --> 00:17:48.686 A:middle
  intent's extension.
  
  00:17:50.196 --> 00:17:51.246 A:middle
  This code is going to do a
  
  00:17:51.246 --> 00:17:52.776 A:middle
  foreground app launch and
  
  00:17:52.776 --> 00:17:53.906 A:middle
  forward the intent to your
  
  00:17:53.906 --> 00:17:55.386 A:middle
  WKExtension delegate in your
  
  00:17:55.456 --> 00:17:55.546 A:middle
  app.
  
  00:17:55.546 --> 00:17:59.486 A:middle
  You'll note that the apps handle
  
  00:17:59.486 --> 00:18:00.676 A:middle
  method looks pretty similar to
  
  00:17:59.486 --> 00:18:00.676 A:middle
  method looks pretty similar to
  
  00:18:00.676 --> 00:18:01.526 A:middle
  the one in iOS.
  
  00:18:02.186 --> 00:18:03.596 A:middle
  The method signature is slightly
  
  00:18:03.596 --> 00:18:05.006 A:middle
  different, but you're going to
  
  00:18:05.006 --> 00:18:06.616 A:middle
  want to read the intent off the
  
  00:18:06.616 --> 00:18:08.616 A:middle
  NSUser activities interaction
  
  00:18:08.616 --> 00:18:09.066 A:middle
  property.
  
  00:18:09.316 --> 00:18:11.256 A:middle
  And then, just like on iOS, you
  
  00:18:11.256 --> 00:18:13.376 A:middle
  read the media item to play and
  
  00:18:13.376 --> 00:18:15.406 A:middle
  start playback in your app.
  
  00:18:16.516 --> 00:18:17.696 A:middle
  One word of caution.
  
  00:18:17.696 --> 00:18:19.136 A:middle
  You're going to want to use the
  
  00:18:19.136 --> 00:18:21.266 A:middle
  on-device cache in your resolve
  
  00:18:21.266 --> 00:18:22.436 A:middle
  method on watchOS.
  
  00:18:22.746 --> 00:18:24.446 A:middle
  Only go over the network if it's
  
  00:18:24.546 --> 00:18:25.626 A:middle
  absolutely necessary.
  
  00:18:26.446 --> 00:18:29.676 A:middle
  So we know that when someone
  
  00:18:29.676 --> 00:18:31.876 A:middle
  says "Play Awesome Song in my
  
  00:18:31.876 --> 00:18:33.926 A:middle
  app," the first step in Request
  
  00:18:33.926 --> 00:18:35.566 A:middle
  Processing is to resolve the
  
  00:18:35.566 --> 00:18:36.476 A:middle
  media items to play.
  
  00:18:36.476 --> 00:18:38.506 A:middle
  And we looked at a previous
  
  00:18:38.506 --> 00:18:40.276 A:middle
  implementation where we checked
  
  00:18:40.276 --> 00:18:41.336 A:middle
  the value of the media item's
  
  00:18:41.376 --> 00:18:43.356 A:middle
  name against the intent's media
  
  00:18:43.356 --> 00:18:43.996 A:middle
  name property.
  
  00:18:45.146 --> 00:18:46.796 A:middle
  And it was an exact match.
  
  00:18:47.406 --> 00:18:49.076 A:middle
  So what are some edge cases that
  
  00:18:49.076 --> 00:18:50.066 A:middle
  we didn't cover in that
  
  00:18:50.066 --> 00:18:50.786 A:middle
  implementation?
  
  00:18:51.306 --> 00:18:53.786 A:middle
  The first place that our
  
  00:18:53.786 --> 00:18:54.856 A:middle
  previous method won't do the
  
  00:18:54.856 --> 00:18:56.206 A:middle
  right thing is if we have a
  
  00:18:56.206 --> 00:18:58.036 A:middle
  mismatch on either case or
  
  00:18:58.036 --> 00:18:58.616 A:middle
  punctuation.
  
  00:18:59.376 --> 00:19:01.426 A:middle
  So in this example, "Play hello
  
  00:18:59.376 --> 00:19:01.426 A:middle
  So in this example, "Play hello
  
  00:19:01.426 --> 00:19:02.896 A:middle
  in my app," we can see a few
  
  00:19:02.896 --> 00:19:04.066 A:middle
  cases where exact string
  
  00:19:04.066 --> 00:19:05.096 A:middle
  comparison will fail.
  
  00:19:06.296 --> 00:19:07.666 A:middle
  The exact song title is
  
  00:19:07.876 --> 00:19:09.206 A:middle
  uppercase HELLO with an
  
  00:19:09.206 --> 00:19:09.986 A:middle
  exclamation point.
  
  00:19:10.606 --> 00:19:11.856 A:middle
  But it's possible that the Siri
  
  00:19:11.856 --> 00:19:13.096 A:middle
  speech engine could give us
  
  00:19:13.296 --> 00:19:14.076 A:middle
  lowercase hello.
  
  00:19:14.726 --> 00:19:16.026 A:middle
  Or maybe it gives us uppercase
  
  00:19:16.026 --> 00:19:17.246 A:middle
  HELLO without the exclamation
  
  00:19:17.246 --> 00:19:17.496 A:middle
  point.
  
  00:19:18.026 --> 00:19:19.806 A:middle
  So it's really important that we
  
  00:19:19.806 --> 00:19:21.916 A:middle
  ignore case and punctuation in
  
  00:19:21.916 --> 00:19:23.426 A:middle
  our resolve method.
  
  00:19:25.476 --> 00:19:27.736 A:middle
  Similarly, a lot of music
  
  00:19:27.736 --> 00:19:28.876 A:middle
  entities have things in the
  
  00:19:28.876 --> 00:19:30.686 A:middle
  title that people either won't
  
  00:19:30.726 --> 00:19:33.026 A:middle
  say or they're going to say in a
  
  00:19:33.026 --> 00:19:34.826 A:middle
  way that doesn't exactly match
  
  00:19:34.826 --> 00:19:35.706 A:middle
  with the item's title.
  
  00:19:36.556 --> 00:19:37.726 A:middle
  For instance, a lot of albums
  
  00:19:37.816 --> 00:19:39.116 A:middle
  come in a deluxe edition
  
  00:19:39.116 --> 00:19:39.536 A:middle
  variant.
  
  00:19:39.886 --> 00:19:41.086 A:middle
  And people aren't going to say
  
  00:19:41.086 --> 00:19:42.606 A:middle
  this when they ask to play the
  
  00:19:42.606 --> 00:19:42.986 A:middle
  album.
  
  00:19:44.346 --> 00:19:45.846 A:middle
  They aren't going to say "Play
  
  00:19:45.846 --> 00:19:47.226 A:middle
  the album Outer Peace deluxe
  
  00:19:47.226 --> 00:19:48.846 A:middle
  edition in my app," they'll say
  
  00:19:48.846 --> 00:19:50.196 A:middle
  "Play the album Outer Peace in
  
  00:19:50.306 --> 00:19:50.566 A:middle
  my app."
  
  00:19:51.986 --> 00:19:53.086 A:middle
  And soundtracks are another
  
  00:19:53.086 --> 00:19:53.506 A:middle
  example.
  
  00:19:54.526 --> 00:19:55.596 A:middle
  People aren't going to say --
  
  00:19:55.596 --> 00:19:57.006 A:middle
  they'll say "Play the Rocket Man
  
  00:19:57.066 --> 00:19:58.016 A:middle
  soundtrack in my app."
  
  00:19:58.836 --> 00:19:59.836 A:middle
  And they aren't going to say
  
  00:19:59.836 --> 00:20:01.046 A:middle
  "Music from the motion picture."
  
  00:19:59.836 --> 00:20:01.046 A:middle
  "Music from the motion picture."
  
  00:20:02.536 --> 00:20:03.786 A:middle
  And finally, a lot of hip-hop
  
  00:20:03.786 --> 00:20:05.376 A:middle
  songs have this featuring
  
  00:20:05.376 --> 00:20:06.546 A:middle
  abbreviation in their title.
  
  00:20:07.126 --> 00:20:09.966 A:middle
  So people either won't say it or
  
  00:20:09.966 --> 00:20:10.696 A:middle
  they'll say the word
  
  00:20:10.696 --> 00:20:11.166 A:middle
  "featuring."
  
  00:20:11.346 --> 00:20:12.706 A:middle
  So exact match isn't going to
  
  00:20:12.706 --> 00:20:13.666 A:middle
  work here either.
  
  00:20:19.476 --> 00:20:21.756 A:middle
  And podcasts also have some
  
  00:20:21.756 --> 00:20:23.036 A:middle
  cases where there is a mismatch
  
  00:20:23.296 --> 00:20:25.076 A:middle
  between what people say and what
  
  00:20:25.076 --> 00:20:26.126 A:middle
  entity titles are.
  
  00:20:27.106 --> 00:20:29.116 A:middle
  So some podcasts have the word
  
  00:20:29.116 --> 00:20:30.156 A:middle
  "podcast" in their title.
  
  00:20:30.796 --> 00:20:32.616 A:middle
  So if someone said "Play the
  
  00:20:32.686 --> 00:20:34.246 A:middle
  Stuff You Should Know podcast in
  
  00:20:34.246 --> 00:20:36.706 A:middle
  my app," Siri could parse it as
  
  00:20:37.136 --> 00:20:39.316 A:middle
  stuff you should know in a media
  
  00:20:39.316 --> 00:20:40.836 A:middle
  item type of podcast.
  
  00:20:41.436 --> 00:20:42.976 A:middle
  So an exact match isn't going to
  
  00:20:42.976 --> 00:20:43.806 A:middle
  work here either.
  
  00:20:44.726 --> 00:20:46.696 A:middle
  And additionally, some podcasts
  
  00:20:46.806 --> 00:20:49.326 A:middle
  come in audio or video variants,
  
  00:20:49.326 --> 00:20:50.676 A:middle
  and that audio or video word
  
  00:20:50.916 --> 00:20:51.726 A:middle
  appears in the title.
  
  00:20:52.606 --> 00:20:54.376 A:middle
  But SiriKit Media implies the
  
  00:20:54.376 --> 00:20:56.426 A:middle
  audio variety, so people aren't
  
  00:20:56.426 --> 00:20:59.716 A:middle
  going to say that either.
  
  00:20:59.946 --> 00:21:01.076 A:middle
  Finally, remember that you're
  
  00:20:59.946 --> 00:21:01.076 A:middle
  Finally, remember that you're
  
  00:21:01.076 --> 00:21:01.866 A:middle
  working with a speech
  
  00:21:01.866 --> 00:21:03.756 A:middle
  recognizer, and the speech
  
  00:21:03.756 --> 00:21:05.566 A:middle
  recognizer can come with word
  
  00:21:05.566 --> 00:21:06.586 A:middle
  formatting variations.
  
  00:21:06.996 --> 00:21:08.166 A:middle
  So if someone asks to play the
  
  00:21:08.166 --> 00:21:10.106 A:middle
  song 81st, you can get the
  
  00:21:10.106 --> 00:21:12.286 A:middle
  number 81 st or you can get the
  
  00:21:12.326 --> 00:21:13.796 A:middle
  hyphenated eighty-first.
  
  00:21:15.286 --> 00:21:16.416 A:middle
  Or if someone asks to play the
  
  00:21:16.416 --> 00:21:17.866 A:middle
  song I Love You Son, you could
  
  00:21:17.866 --> 00:21:19.786 A:middle
  get sun or son.
  
  00:21:19.846 --> 00:21:23.116 A:middle
  Now, Siri is going to do the
  
  00:21:23.116 --> 00:21:25.056 A:middle
  best job it can to give you the
  
  00:21:25.056 --> 00:21:26.386 A:middle
  entity titles for the things
  
  00:21:26.386 --> 00:21:27.086 A:middle
  that it knows about.
  
  00:21:27.746 --> 00:21:30.496 A:middle
  But it's better for you to be
  
  00:21:30.496 --> 00:21:33.546 A:middle
  flexible in your resolve method.
  
  00:21:35.096 --> 00:21:38.136 A:middle
  When you implement your SiriKit
  
  00:21:38.136 --> 00:21:39.846 A:middle
  Media Support, you control what
  
  00:21:39.846 --> 00:21:42.246 A:middle
  Siri says by the INMediaItem
  
  00:21:42.246 --> 00:21:43.446 A:middle
  objects you return from your
  
  00:21:43.446 --> 00:21:44.046 A:middle
  resolve method.
  
  00:21:44.976 --> 00:21:46.906 A:middle
  As you can see here, the user
  
  00:21:46.906 --> 00:21:48.106 A:middle
  asks to play the song Maybe
  
  00:21:48.106 --> 00:21:49.986 A:middle
  Sometime by Special Disaster
  
  00:21:49.986 --> 00:21:51.436 A:middle
  team in Control Audio.
  
  00:21:51.936 --> 00:21:53.856 A:middle
  And Siri said, "Here's Maybe
  
  00:21:53.856 --> 00:21:55.536 A:middle
  Sometime by Special Disaster
  
  00:21:55.536 --> 00:21:57.146 A:middle
  Team from Control Audio."
  
  00:21:57.896 --> 00:22:00.316 A:middle
  In this case the returned
  
  00:21:57.896 --> 00:22:00.316 A:middle
  In this case the returned
  
  00:22:00.486 --> 00:22:02.826 A:middle
  INMediaItem had a title property
  
  00:22:02.826 --> 00:22:04.756 A:middle
  of Maybe Sometime and an artist
  
  00:22:04.756 --> 00:22:06.226 A:middle
  property of Special Disaster
  
  00:22:06.226 --> 00:22:06.416 A:middle
  team.
  
  00:22:07.306 --> 00:22:08.966 A:middle
  So make sure you always populate
  
  00:22:09.486 --> 00:22:12.216 A:middle
  title, artist, and type in the
  
  00:22:12.216 --> 00:22:13.946 A:middle
  returned media items, as these
  
  00:22:13.976 --> 00:22:15.586 A:middle
  can all influence what Siri
  
  00:22:15.586 --> 00:22:15.866 A:middle
  says.
  
  00:22:16.686 --> 00:22:18.396 A:middle
  And one thing to note, if you
  
  00:22:18.396 --> 00:22:19.686 A:middle
  return more than one item in
  
  00:22:19.686 --> 00:22:21.226 A:middle
  your resolve method, Siri is
  
  00:22:21.226 --> 00:22:22.376 A:middle
  going to speak to the first item
  
  00:22:22.376 --> 00:22:23.506 A:middle
  in the list.
  
  00:22:25.146 --> 00:22:26.966 A:middle
  It's super important that you
  
  00:22:27.046 --> 00:22:28.596 A:middle
  handle error cases appropriately
  
  00:22:28.596 --> 00:22:29.426 A:middle
  in SiriKit Media.
  
  00:22:30.456 --> 00:22:31.426 A:middle
  When you're interacting with an
  
  00:22:31.426 --> 00:22:32.926 A:middle
  intelligent assistant like Siri,
  
  00:22:32.926 --> 00:22:34.996 A:middle
  it can be unclear why something
  
  00:22:34.996 --> 00:22:35.946 A:middle
  happened when it happened.
  
  00:22:36.376 --> 00:22:37.586 A:middle
  And handling error cases
  
  00:22:37.586 --> 00:22:39.036 A:middle
  appropriately is going to allow
  
  00:22:39.036 --> 00:22:40.506 A:middle
  you to give the user the best
  
  00:22:40.506 --> 00:22:41.476 A:middle
  idea of what happened when
  
  00:22:41.476 --> 00:22:42.186 A:middle
  something goes wrong.
  
  00:22:43.136 --> 00:22:44.576 A:middle
  So the most common case you're
  
  00:22:44.576 --> 00:22:45.906 A:middle
  going to run into is when you
  
  00:22:45.906 --> 00:22:47.116 A:middle
  don't find something in your app
  
  00:22:47.116 --> 00:22:48.136 A:middle
  catalog that someone's asked
  
  00:22:48.136 --> 00:22:48.356 A:middle
  for.
  
  00:22:48.476 --> 00:22:50.776 A:middle
  And you handle this case by just
  
  00:22:50.776 --> 00:22:52.006 A:middle
  returning the unsupported
  
  00:22:52.006 --> 00:22:53.626 A:middle
  resolution result from resolve
  
  00:22:53.626 --> 00:22:54.186 A:middle
  media items.
  
  00:22:55.236 --> 00:22:56.016 A:middle
  But there's a lot of other
  
  00:22:56.016 --> 00:22:57.686 A:middle
  errors that could happen.
  
  00:22:57.686 --> 00:22:58.676 A:middle
  Maybe someone asks to play
  
  00:22:58.736 --> 00:23:00.416 A:middle
  something that requires cellular
  
  00:22:58.736 --> 00:23:00.416 A:middle
  something that requires cellular
  
  00:23:00.416 --> 00:23:02.026 A:middle
  data but they have the cellular
  
  00:23:02.026 --> 00:23:03.216 A:middle
  data switch turned off for your
  
  00:23:04.186 --> 00:23:04.276 A:middle
  app.
  
  00:23:04.696 --> 00:23:06.206 A:middle
  Or maybe they ask to play
  
  00:23:06.206 --> 00:23:07.306 A:middle
  something that requires a
  
  00:23:07.306 --> 00:23:08.836 A:middle
  subscription and they don't have
  
  00:23:08.836 --> 00:23:09.016 A:middle
  one.
  
  00:23:10.586 --> 00:23:11.426 A:middle
  The full list is in
  
  00:23:11.556 --> 00:23:12.986 A:middle
  INPlayMediaMediaItem
  
  00:23:12.986 --> 00:23:13.826 A:middle
  UnsupportedReason.
  
  00:23:14.216 --> 00:23:15.476 A:middle
  And there's generally similar
  
  00:23:15.476 --> 00:23:17.536 A:middle
  naming for all four intents, so
  
  00:23:17.536 --> 00:23:18.766 A:middle
  make sure you adopt them for all
  
  00:23:18.766 --> 00:23:19.756 A:middle
  the intents you support.
  
  00:23:20.296 --> 00:23:21.846 A:middle
  Now let's talk about some of the
  
  00:23:21.846 --> 00:23:23.316 A:middle
  variety of things that people
  
  00:23:23.316 --> 00:23:25.106 A:middle
  say to Siri and how you can do a
  
  00:23:25.106 --> 00:23:27.146 A:middle
  good job handling of them in
  
  00:23:27.146 --> 00:23:28.086 A:middle
  your SiriKit Media
  
  00:23:28.086 --> 00:23:28.826 A:middle
  implementation.
  
  00:23:29.466 --> 00:23:32.306 A:middle
  So one of the most popular
  
  00:23:32.306 --> 00:23:33.626 A:middle
  things that people say to Siri
  
  00:23:33.626 --> 00:23:35.486 A:middle
  is "Play my app."
  
  00:23:35.816 --> 00:23:36.906 A:middle
  They don't tell you exactly what
  
  00:23:36.906 --> 00:23:38.196 A:middle
  it is that they want to play,
  
  00:23:39.346 --> 00:23:41.386 A:middle
  and it's your job as a SiriKit
  
  00:23:41.386 --> 00:23:43.276 A:middle
  Media developer to choose the
  
  00:23:43.276 --> 00:23:45.816 A:middle
  right thing to do for your app.
  
  00:23:46.036 --> 00:23:47.186 A:middle
  Now, this might be something as
  
  00:23:47.186 --> 00:23:48.656 A:middle
  simple as resuming an existing
  
  00:23:48.656 --> 00:23:49.036 A:middle
  queue.
  
  00:23:49.716 --> 00:23:51.386 A:middle
  If you're not an audiobooks or
  
  00:23:51.386 --> 00:23:53.196 A:middle
  podcasting app, this is probably
  
  00:23:53.196 --> 00:23:54.356 A:middle
  the most reasonable behavior to
  
  00:23:54.356 --> 00:23:54.726 A:middle
  implement.
  
  00:23:55.976 --> 00:23:57.236 A:middle
  But you can make the behavior as
  
  00:23:57.236 --> 00:23:58.096 A:middle
  dynamic as you like.
  
  00:23:58.926 --> 00:24:00.996 A:middle
  Maybe you want to direct them to
  
  00:23:58.926 --> 00:24:00.996 A:middle
  Maybe you want to direct them to
  
  00:24:00.996 --> 00:24:02.976 A:middle
  a recommended playlist or some
  
  00:24:02.976 --> 00:24:04.036 A:middle
  hot new trending music.
  
  00:24:04.616 --> 00:24:05.426 A:middle
  The choice is yours.
  
  00:24:06.186 --> 00:24:07.266 A:middle
  And how do you know that someone
  
  00:24:07.266 --> 00:24:09.336 A:middle
  said, "Play my app," well, there
  
  00:24:09.336 --> 00:24:10.626 A:middle
  will be no search criteria
  
  00:24:10.626 --> 00:24:12.306 A:middle
  specified in the INMediaSearch
  
  00:24:12.306 --> 00:24:12.646 A:middle
  object.
  
  00:24:13.246 --> 00:24:14.426 A:middle
  One thing that might seem like a
  
  00:24:14.426 --> 00:24:16.396 A:middle
  good idea is to ask someone what
  
  00:24:16.396 --> 00:24:17.016 A:middle
  they want to play.
  
  00:24:17.016 --> 00:24:19.186 A:middle
  But for the same reason that we
  
  00:24:19.186 --> 00:24:20.646 A:middle
  don't recommend using confirm,
  
  00:24:21.196 --> 00:24:22.596 A:middle
  we don't recommend this
  
  00:24:22.596 --> 00:24:22.986 A:middle
  approach.
  
  00:24:23.746 --> 00:24:24.946 A:middle
  Putting dialogue prompts in
  
  00:24:24.946 --> 00:24:26.686 A:middle
  front of people is one of the
  
  00:24:26.686 --> 00:24:27.876 A:middle
  most common ways that they'll
  
  00:24:27.876 --> 00:24:29.146 A:middle
  quit the SiriKit Media
  
  00:24:29.146 --> 00:24:29.636 A:middle
  experience.
  
  00:24:30.326 --> 00:24:33.766 A:middle
  People can ask to initiate
  
  00:24:33.766 --> 00:24:34.706 A:middle
  playback with additional
  
  00:24:34.706 --> 00:24:36.526 A:middle
  controls, and some of the
  
  00:24:36.526 --> 00:24:37.876 A:middle
  supported options are repeat,
  
  00:24:37.966 --> 00:24:39.466 A:middle
  shuffle, resume, and playback
  
  00:24:39.466 --> 00:24:40.126 A:middle
  queue location.
  
  00:24:41.136 --> 00:24:43.366 A:middle
  And if you support these in your
  
  00:24:43.366 --> 00:24:45.216 A:middle
  app, make sure you support them
  
  00:24:45.216 --> 00:24:46.866 A:middle
  in your INPlayMediaIntent
  
  00:24:47.446 --> 00:24:48.456 A:middle
  implementation as well.
  
  00:24:50.026 --> 00:24:51.196 A:middle
  And people can also ask to play
  
  00:24:51.196 --> 00:24:52.326 A:middle
  content with a variety of search
  
  00:24:52.326 --> 00:24:52.776 A:middle
  options.
  
  00:24:53.586 --> 00:24:54.476 A:middle
  And one of the most useful
  
  00:24:54.476 --> 00:24:55.726 A:middle
  search options is the sort
  
  00:24:55.726 --> 00:24:56.156 A:middle
  parameter.
  
  00:24:56.976 --> 00:24:58.196 A:middle
  You can say things like "Play
  
  00:24:58.196 --> 00:24:59.406 A:middle
  the new Stuff You Should Know
  
  00:24:59.406 --> 00:25:00.896 A:middle
  podcast in my app," and you'll
  
  00:24:59.406 --> 00:25:00.896 A:middle
  podcast in my app," and you'll
  
  00:25:00.896 --> 00:25:02.446 A:middle
  get INMediaSortOrder newest.
  
  00:25:03.306 --> 00:25:04.436 A:middle
  Or you can ask for the best
  
  00:25:04.436 --> 00:25:05.816 A:middle
  album by an artist, and you'll
  
  00:25:05.816 --> 00:25:08.006 A:middle
  get INMediaSortOrder best.
  
  00:25:08.126 --> 00:25:09.566 A:middle
  Or you can ask your app for a
  
  00:25:09.686 --> 00:25:11.296 A:middle
  recommendation, and you'll get
  
  00:25:11.406 --> 00:25:13.026 A:middle
  INMediaSortOrder recommended.
  
  00:25:13.866 --> 00:25:14.926 A:middle
  Check out the full list in
  
  00:25:15.016 --> 00:25:15.966 A:middle
  INMediaSortOrder.
  
  00:25:16.146 --> 00:25:19.396 A:middle
  And another powerful search
  
  00:25:19.396 --> 00:25:20.876 A:middle
  option is the reference
  
  00:25:20.876 --> 00:25:22.266 A:middle
  property, which can have
  
  00:25:22.416 --> 00:25:23.696 A:middle
  INMediaReferenceCurrently
  
  00:25:23.696 --> 00:25:24.046 A:middle
  Playing.
  
  00:25:25.166 --> 00:25:26.356 A:middle
  This is really useful for
  
  00:25:26.356 --> 00:25:27.766 A:middle
  INAddMediaIntent or
  
  00:25:27.766 --> 00:25:30.056 A:middle
  INUpdateMediaIntent, because
  
  00:25:30.056 --> 00:25:31.816 A:middle
  people can easily add the
  
  00:25:31.816 --> 00:25:33.066 A:middle
  currently playing item to a
  
  00:25:33.066 --> 00:25:35.206 A:middle
  library or a playlist, or they
  
  00:25:35.206 --> 00:25:36.656 A:middle
  can tell your app that they love
  
  00:25:36.656 --> 00:25:37.746 A:middle
  or they hate their currently
  
  00:25:37.786 --> 00:25:38.306 A:middle
  playing item.
  
  00:25:39.146 --> 00:25:41.006 A:middle
  And one thing to note too is if
  
  00:25:41.006 --> 00:25:42.336 A:middle
  you've populated the external
  
  00:25:42.336 --> 00:25:43.576 A:middle
  content identifier in
  
  00:25:43.576 --> 00:25:46.096 A:middle
  MPNowPlayingInfo center, that
  
  00:25:46.096 --> 00:25:47.436 A:middle
  identifier is going to be in
  
  00:25:47.436 --> 00:25:48.876 A:middle
  INMediaSearch's identifier
  
  00:25:48.876 --> 00:25:50.586 A:middle
  property, so you know exactly
  
  00:25:50.586 --> 00:25:54.036 A:middle
  what item to find.
  
  00:25:54.496 --> 00:25:56.556 A:middle
  Now, telling Siri more about how
  
  00:25:56.556 --> 00:25:58.726 A:middle
  your customer uses your app is
  
  00:25:58.786 --> 00:26:00.306 A:middle
  going to help Siri provide a
  
  00:25:58.786 --> 00:26:00.306 A:middle
  going to help Siri provide a
  
  00:26:00.306 --> 00:26:01.806 A:middle
  wonderful SiriKit Media
  
  00:26:01.806 --> 00:26:02.346 A:middle
  experience.
  
  00:26:06.256 --> 00:26:08.256 A:middle
  So when you give user vocabulary
  
  00:26:08.256 --> 00:26:10.426 A:middle
  to Siri, this helps Siri
  
  00:26:10.476 --> 00:26:11.626 A:middle
  understand the parts of your
  
  00:26:11.626 --> 00:26:13.446 A:middle
  catalog that are interesting to
  
  00:26:13.446 --> 00:26:13.966 A:middle
  your customer.
  
  00:26:14.906 --> 00:26:16.266 A:middle
  It's important to note it's not
  
  00:26:16.266 --> 00:26:17.806 A:middle
  the entire contents of your app
  
  00:26:17.806 --> 00:26:19.806 A:middle
  catalog, it's only the pieces of
  
  00:26:19.836 --> 00:26:21.086 A:middle
  content that your customer is
  
  00:26:21.086 --> 00:26:21.876 A:middle
  specifically interested in.
  
  00:26:23.406 --> 00:26:25.056 A:middle
  It's also important to note that
  
  00:26:25.056 --> 00:26:26.746 A:middle
  the vocabulary is ordered, so
  
  00:26:26.746 --> 00:26:28.236 A:middle
  make sure that you include the
  
  00:26:28.236 --> 00:26:29.916 A:middle
  most important items at the
  
  00:26:29.916 --> 00:26:30.926 A:middle
  beginning of the collection.
  
  00:26:32.146 --> 00:26:33.076 A:middle
  And depending on the type of
  
  00:26:33.076 --> 00:26:34.706 A:middle
  media your app supports, you're
  
  00:26:34.706 --> 00:26:35.776 A:middle
  going to send different types to
  
  00:26:35.776 --> 00:26:36.106 A:middle
  Siri.
  
  00:26:37.316 --> 00:26:39.466 A:middle
  Music apps should use playlist
  
  00:26:39.466 --> 00:26:41.006 A:middle
  title and music artist name.
  
  00:26:41.816 --> 00:26:43.206 A:middle
  Audiobook apps should use
  
  00:26:43.336 --> 00:26:44.816 A:middle
  audiobook title and audiobook
  
  00:26:44.816 --> 00:26:45.196 A:middle
  author.
  
  00:26:45.926 --> 00:26:47.496 A:middle
  And podcasting apps should use
  
  00:26:48.056 --> 00:26:48.636 A:middle
  show title.
  
  00:26:50.256 --> 00:26:51.516 A:middle
  And for those things that are
  
  00:26:51.516 --> 00:26:53.806 A:middle
  applicable to everybody that
  
  00:26:53.806 --> 00:26:55.346 A:middle
  uses your app, check out the
  
  00:26:55.346 --> 00:26:57.196 A:middle
  global vocabulary support in
  
  00:26:57.196 --> 00:26:57.706 A:middle
  SiriKit.
  
  00:26:58.486 --> 00:27:02.136 A:middle
  So in conclusion, we're
  
  00:26:58.486 --> 00:27:02.136 A:middle
  So in conclusion, we're
  
  00:27:02.136 --> 00:27:03.746 A:middle
  launching new SiriKit Media
  
  00:27:03.746 --> 00:27:05.906 A:middle
  Intents to allow you to use Siri
  
  00:27:05.906 --> 00:27:07.776 A:middle
  to control your audio apps.
  
  00:27:08.006 --> 00:27:09.796 A:middle
  You'll be able to play, add,
  
  00:27:10.366 --> 00:27:11.976 A:middle
  update taste profiles, and
  
  00:27:12.026 --> 00:27:13.336 A:middle
  search for media using the new
  
  00:27:13.336 --> 00:27:13.716 A:middle
  intents.
  
  00:27:14.876 --> 00:27:16.056 A:middle
  It's very important that you
  
  00:27:16.056 --> 00:27:17.266 A:middle
  provide the best experience
  
  00:27:17.266 --> 00:27:17.766 A:middle
  possible.
  
  00:27:18.396 --> 00:27:20.486 A:middle
  And you can do this by embracing
  
  00:27:20.486 --> 00:27:21.546 A:middle
  search flexibility.
  
  00:27:22.296 --> 00:27:24.426 A:middle
  Because people don't say exactly
  
  00:27:24.426 --> 00:27:25.226 A:middle
  what they want to play.
  
  00:27:26.246 --> 00:27:27.366 A:middle
  You can handle errors
  
  00:27:27.366 --> 00:27:29.486 A:middle
  appropriately, so people know
  
  00:27:29.486 --> 00:27:30.756 A:middle
  what's happened when something
  
  00:27:30.756 --> 00:27:31.206 A:middle
  goes wrong.
  
  00:27:31.826 --> 00:27:32.816 A:middle
  And you're going to you want to
  
  00:27:32.816 --> 00:27:34.006 A:middle
  make sure that you construct
  
  00:27:34.326 --> 00:27:35.856 A:middle
  your INMediaItem objects
  
  00:27:35.856 --> 00:27:37.996 A:middle
  appropriately so Siri can speak
  
  00:27:38.116 --> 00:27:39.716 A:middle
  the best dialogue possible.
  
  00:27:40.786 --> 00:27:42.336 A:middle
  And finally, make sure you give
  
  00:27:42.336 --> 00:27:44.506 A:middle
  Siri the important contextual
  
  00:27:44.506 --> 00:27:46.736 A:middle
  information possible so Siri can
  
  00:27:46.736 --> 00:27:48.516 A:middle
  make the best choices possible
  
  00:27:49.136 --> 00:27:50.326 A:middle
  on your customer's behalf.
  
  00:27:51.106 --> 00:27:54.686 A:middle
  So come see us at the labs and
  
  00:27:54.686 --> 00:27:55.796 A:middle
  check out the documentation
  
  00:27:55.796 --> 00:27:56.106 A:middle
  online.
  
  00:27:56.916 --> 00:27:57.756 A:middle
  We think you're going to love
  
  00:27:57.756 --> 00:27:59.206 A:middle
  building apps with the new
  
  00:27:59.206 --> 00:28:00.906 A:middle
  SiriKit Media Intents and we
  
  00:27:59.206 --> 00:28:00.906 A:middle
  SiriKit Media Intents and we
  
  00:28:00.906 --> 00:28:01.916 A:middle
  can't wait to see what you'll
  
  00:28:01.916 --> 00:28:02.166 A:middle
  build.
  
  00:28:02.766 --> 00:28:03.076 A:middle
  Thank you.
  
  00:28:04.516 --> 00:28:07.500 A:middle
  [ Applause ]
  