首页 > 解决方案 > bixby:音频播放器,如何给音频播放器输入

问题描述

我已经下载了示例胶囊并实现到我的胶囊中并且它正在工作,但现在我需要传递一些 id 并生成歌曲的内容。

所以我的意图followup

intent{
    goal:PlaySongs
    value-set:MultipleArtistId{$expr(singleArtistEvent.artistId)}
}

我的 PlaySongs 动作文件如下所示

action (PlaySongs) {
  type (Search)
  collect {
     computed-input (songToPlay) {
       description (Create the playlist to play)
       type (audioPlayer.AudioInfo)
       min (Required) max (One)
       compute {
       intent {
          goal: GetMeArtistSong
          value-set: MultipleArtistId
       }
    }
  hidden     
}

computed-input (play) {
    description (By passing in the AudioInfo object to the PlayAudio action, we ask the client to play our sound.)
    type (audioPlayer.Result)
    compute {
       intent {
         goal: audioPlayer.PlayAudio
         value: $expr(songToPlay)
       }
    }
    hidden
  }
}
  output (Result)
}

GetMeArtistSong 动作文件如下所示

action (GetMeArtistSong) {
  type(Search)
  description (Artist Song)
  collect {
    input (artistId) {
    type (MultipleArtistId)
    min (Optional) max (One) 
  }
}
output (audioPlayer.AudioInfo)
}

我无法在 GetMeArtistSong js 文件中获取艺术家 ID。我做错了什么?隐藏是为了什么?请解释。

标签: bixbybixbystudio

解决方案


  1. hidden表示链接的 JS 函数不需要将该输入作为参数列出。如果没有hidden,您的 JS 函数需要同时具有songsToPlayplay作为参数。
  2. 如果没有实际的 JS 文件和端点文件,我只能推测您关于artistId. 它不应该与音频播放器有关。检查端点并做console.log(),我的感觉是动作模型和JS函数没有正确链接。此外,您可能希望更改min(Required)为强制输入。

推荐阅读