Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

media prompt type issue #7

Closed
leartgjoni-voiceflow opened this issue Sep 22, 2020 · 4 comments
Closed

media prompt type issue #7

leartgjoni-voiceflow opened this issue Sep 22, 2020 · 4 comments

Comments

@leartgjoni-voiceflow
Copy link

leartgjoni-voiceflow commented Sep 22, 2020

Following the example here, this:

conv.add(new Media({
    mediaObjects: [
      {
        name: 'Media name',
        description: 'Media description',
        url: 'https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
        image: {
          large: JAZZ_IN_PARIS_IMAGE,
        }
      }
    ],
    mediaType: 'AUDIO',
    optionalMediaControls: ['PAUSED', 'STOPPED'],
    startOffset: '2.12345s'
  }));

will throw a type error of: Argument of type 'Media' is not assignable to parameter of type 'PromptItem'.

Possible fix:

export type PromptItem =
  string |
  Simple |
  Content |
  Link |
  Suggestion |
  Canvas |
  OrderUpdate |
  Media

@taycaldwell

@NielsOtten
Copy link

The documentation seems to use another actions library: (https://github.com/actions-on-google/actions-on-google-nodejs). To add media with this library you need to add it like this:

conv.add(
    new Content({
      media: {
        mediaObjects: [
          {
            name: 'Media name',
            url: 'https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
            image: { icon: { url: JAZZ_IN_PARIS_IMAGE, alt: `Jazz in paris image` } },
            mediaType: 'AUDIO',
            optionalMediaControls: ['PAUSED', 'STOPPED'],
            startOffset: '2.12345s',
          },
        ],
      },
    }),
  );

@Fleker
Copy link
Member

Fleker commented Oct 9, 2020

I'm going to take a look at this, as Media is used in the conversation-components sample, so it would in theory break that sample too.

I wouldn't advise you to mix those two libraries together, as they're meant to work only for their specific services.

@Fleker
Copy link
Member

Fleker commented Oct 9, 2020

Seems like Image should also be exported.

@Fleker
Copy link
Member

Fleker commented Oct 12, 2020

This was fixed in c0472b9.

@Fleker Fleker closed this as completed Oct 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants