Is it possible to play audio file or stream?

后端 未结 2 635
旧巷少年郎
旧巷少年郎 2020-12-17 07:40

Is it possible to play audio file or stream using actions-on-google-nodejs library?

2条回答
  •  囚心锁ツ
    2020-12-17 07:55

    Using SSML you can return an audio clip up to 120s.

    
      
    
    

    Edit

    If you want to play audio the mp3 file (over 120s), you need to use Media Responses

    if (!conv.surface.capabilities.has('actions.capability.MEDIA_RESPONSE_AUDIO')) {
          conv.ask('Sorry, this device does not support audio playback.');
          return;
        }
        conv.ask(new MediaObject({
          name: 'Jazz in Paris',
          url: 'https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
          description: 'A funky Jazz tune',
          icon: new Image({
            url: 'https://storage.googleapis.com/automotive-media/album_art.jpg',
            alt: 'Ocean view',
          }),
        }));
    

提交回复
热议问题