stevenleeg / geemusic

A bridge between Google Music and Amazon's Alexa
GNU General Public License v3.0
662 stars 181 forks source link

FireTV does not support AudioPlayer directive #199

Open phreakmonkey opened 6 years ago

phreakmonkey commented 6 years ago

Works great on Amazon Echo and Amazon Echo Dot. When I attempt to use it on my Amazon FireTV devices I get "The AudioPlayer directive "PlayDirective" is not supported"

I'm not sure if there's some alternative directive that can be used on the FireTV (though Amazon's native music streaming works fine on it, of course.)

fergyfresh commented 6 years ago

Possibly related:

https://forums.developer.amazon.com/questions/78973/skill-on-firetv-throws-invalid-directive-audioplay.html

fergyfresh commented 6 years ago

Sample message from The Alexa Docs

{
    "directive": {
        "header": {
            "namespace": "AudioPlayer",
            "name": "Play",
            "messageId": "{{STRING}}",
            "dialogRequestId": "{{STRING}}"
        },
        "payload": {
            "playBehavior": "{{STRING}}",
            "audioItem": {
                "audioItemId": "{{STRING}}",
                "stream": {
                        "url": "{{STRING}}",
                        "streamFormat": "AUDIO_MPEG"
                        "offsetInMilliseconds": {{LONG}},
                        "expiryTime": "{{STRING}}",
                        "progressReport": {
                            "progressReportDelayInMilliseconds": {{LONG}},
                            "progressReportIntervalInMilliseconds": {{LONG}}
                        },
                        "token": "{{STRING}}",
                        "expectedPreviousToken": "{{STRING}}"
                }
            }
        }
    }
}

And the actual server response:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "text": "Playing Beautiful Head by The National",
      "type": "PlainText"
    },
    "card": {
      "text": "",
      "title": "Playing Beautiful Head by The National",
      "image": {
        "smallImageUrl": "https://lh3.ggpht.com/EMVxrigdiy0z86n6aniZ75DSVQv2f0FQb6FtKUnRiW9ds0oTD_hg5I-_TDOXyCv4XEj9pW8R",
        "largeImageUrl": "https://lh3.ggpht.com/EMVxrigdiy0z86n6aniZ75DSVQv2f0FQb6FtKUnRiW9ds0oTD_hg5I-_TDOXyCv4XEj9pW8R"
      }
    },
    "speechletResponse": {
      "outputSpeech": {
        "text": "Playing Beautiful Head by The National"
      },
      "card": {
        "text": "",
        "image": {
          "smallImageUrl": "https://lh3.ggpht.com/EMVxrigdiy0z86n6aniZ75DSVQv2f0FQb6FtKUnRiW9ds0oTD_hg5I-_TDOXyCv4XEj9pW8R",
          "largeImageUrl": "https://lh3.ggpht.com/EMVxrigdiy0z86n6aniZ75DSVQv2f0FQb6FtKUnRiW9ds0oTD_hg5I-_TDOXyCv4XEj9pW8R"
        },
        "title": "Playing Beautiful Head by The National"
      },
      "directives": [
        {
          "playBehavior": "REPLACE_ALL",
          "audioItem": {
            "stream": {
              "token": "redacted",
              "url": "https://secure-sands-28038.herokuapp.com/alexa/stream/Tdxmo7bykcjo6v2pboovi3jlvam",
              "offsetInMilliseconds": 0
            }
          }
        },
        {
          "template": {
            "image": {
              "sources": [
                {
                  "url": "https://lh3.ggpht.com/EMVxrigdiy0z86n6aniZ75DSVQv2f0FQb6FtKUnRiW9ds0oTD_hg5I-_TDOXyCv4XEj9pW8R",
                  "size": "small",
                  "widthPixels": 0,
                  "heightPixels": 0
                },
                {
                  "url": "https://lh3.ggpht.com/EMVxrigdiy0z86n6aniZ75DSVQv2f0FQb6FtKUnRiW9ds0oTD_hg5I-_TDOXyCv4XEj9pW8R",
                  "size": "large",
                  "widthPixels": 0,
                  "heightPixels": 0
                }
              ]
            },
            "title": "Playing Beautiful Head by The National",
            "textContent": {
              "primaryText": {
                "richText": ""
              }
            },
            "backButtonBehavior": "HIDDEN"
          }
        }
      ],
      "shouldEndSession": true
    }
  },
  "sessionAttributes": {}
}
fergyfresh commented 6 years ago

It seems we don't split into header/payload. We don't have any of the header information it seems. More reading in the doc link provided above though seems to think that it can take it from the type of object that resolves from the directive section in the JSON, so I don't really know what to think so far.

HALLPPPPP.

fergyfresh commented 6 years ago

Hey @phreakmonkey could you try the @aplocher PR and see if that fixes this issue for you.

fergyfresh commented 6 years ago

Might be related to this https://github.com/johnwheeler/flask-ask/pull/189/files.