alexa-js / alexa-app-server

An Alexa app server for alexa-app.
MIT License
401 stars 116 forks source link

Getting different response in alexa developer service simulator and in alexa app server testing utility #105

Open rajeevs960 opened 6 years ago

rajeevs960 commented 6 years ago

Hi ,

I am getting different responses in alexa developer service simulator and in your testing utility.

Response in alexa app server testing utility

{
  "version": "1.0",
  "response": {
    "directives": [
      {
        "type": "AudioPlayer.Play",
        "playBehavior": "REPLACE_ALL",
        "audioItem": {
          "stream": {
            "url": "https://songurl",
            "token": "123456",
            "offsetInMilliseconds": 0
          }
        }
      }
    ],
    "shouldEndSession": true,
    "outputSpeech": {
      "type": "SSML",
      "ssml": "<speak>playing the song shape of you from app</speak>"
    },
    "card": {
      "type": "Simple",
      "title": "My Cool Card",
      "content": "playing the song shape of you from app"
    }
  },
  "sessionAttributes": {}
}

Response in alexa developer service simulator:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "ssml": "<speak>playing the song shape of you from app</speak>",
      "type": "SSML"
    },
    "card": {
      "content": "playing the song shape of you from app",
      "title": "My Cool Card"
    },
    "speechletResponse": {
      "outputSpeech": {
        "ssml": "<speak>playing the song shape of you from app</speak>"
      },
      "card": {
        "content": "playing the song shape of you from app",
        "title": "My Cool Card"
      },
      "directives": [
        {
          "playBehavior": "REPLACE_ALL",
          "audioItem": {
            "stream": {
              "token": "123456",
              "url": "https://songurl",
              "offsetInMilliseconds": 0
            }
          }
        },
        {
          "template": {
            "title": "My Cool Card",
            "textContent": {
              "primaryText": {
                "richText": "<font size=\"7\">playing the song shape of you from app</font>"
              }
            },
            "backButtonBehavior": "HIDDEN"
          }
        }
      ],
      "shouldEndSession": true
    }
  },
  "sessionAttributes": {}
}  

why the "type": "AudioPlayer.Play" is not displaying in service simulator. The song is not playing. Only the text is saying by the device. And why "speechletResponse" object is displaying in service simulator. Am i doing anything wrong?. Please let me know the solution. I am facing the issue.

benedekh commented 6 years ago

afaik, AudioPlayer is not supported yet in the simulator.

rajeevs960 commented 6 years ago

yes its not supported. But in response its only displaying this

"directives": [
        {
          "playBehavior": "REPLACE_ALL",
          "audioItem": {
            "stream": {
              "token": "123456",
              "url": "https://songurl",
              "offsetInMilliseconds": 0
            }
          }
        },

the "type" : "AudioPlayer.Play" is not displaying. So is it because of AudioPlayer is not supported yet in the simulator?

and when i tested the same in the echo dot the song is not playing only the text is being played. Do you know any solution for this?

benedekh commented 6 years ago

First question: I think so, but problably @dblock could verify it.

Second question: unfortunately no.

dblock commented 6 years ago

If you're getting a different response to the same request from the same code there's probably a real problem somewhere. I would debug what's going on there, because regardless of which simulator you use I would expect the response to look the same.

Your first one is missing cards, etc., I think your code is taking different paths?

rajeevs960 commented 6 years ago

yes, i am not understanding how "speechletResponse" object is coming in service simulator. And the audioplayer.play type is missing in directive. This is my code, i have removed the card . I am sending the songname which i get in slot to a method gettrackurl, from which i get the songurl and then i am sending the audioitem:

 return gettrackurl(req.slot('songName')).
     then(songURL=> {
 res.say("playing the song " +req.slot('songName')+" from app");
                var stream = {
                    "url": songURL,
                    "token": "123456",
                    "offsetInMilliseconds": 0
                };
                res.audioPlayerPlayStream("REPLACE_ALL", stream);
                return res.send(); 

please let me know if i have done anything wrong. I am getting proper response in your testing utility.

rajeevs960 commented 6 years ago

And even for link account the card object is showing empty in service simulator of amazon developer site.

rajeevs960 commented 6 years ago

I think there is a problem in service simulator of amazon developer site. Now i am able to play a song in echo dot. But still the service simulator doesn't show the proper response type for directives and card also.