Giter Club home page Giter Club logo

Comments (34)

stevenleeg avatar stevenleeg commented on July 30, 2024

Hey! I'm currently away from my alexa so it's hard to debug right now, but these sorts of issues almost always stem from alexa not being redirected properly to the URL for the music file hosted on google's servers.

try using the test tool in the skill dashboard to see what URL is being sent back to alexa when you say something like "play songs by artist radiohead". if you can't load that URL and get music in your own browser then the same will be happening to your dot/echo.

let me know if that helps, otherwise I'll be back home on sunday and can take a peek.

from geemusic.

appetterson avatar appetterson commented on July 30, 2024

Cheers for the reply, I don't seem to be getting the URL back in the test tool. The response was:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "Playing top tracks from Radiohead"
    },
    "shouldEndSession": true
  },
  "sessionAttributes": {}
}

My .env file contains:

# Google credentials
GOOGLE_EMAIL=[email is here]
GOOGLE_PASSWORD=[password is here]

# Publicly accessible URL to your server, WITHOUT trailing slash
APP_URL=https://[code is here].ngrok.io

Obviously with the correct things instead of the square brackets.

from geemusic.

appetterson avatar appetterson commented on July 30, 2024

So I got home myself and did some testing. I stuck in a debug line to give the URL that it sends back to alexa (i.e. before the redirect) and stuck that in my browser. That plays fine. In the log I just see the 302, no 400. However when I ask Alexa to do it it goes through exactly the same process, gives me the redirect link, shows that the redirect happens then gives me the 400.

So this is me opening the stream in a browser:

18:01:24 web.1  | --------------------------------------------------------------------------------
18:01:24 web.1  | DEBUG in selection [/home/adam/geemusic/geemusic/geemusic/intents/selection.py:49]:
18:01:24 web.1  | Fetching album feeling electric by None
18:01:24 web.1  | --------------------------------------------------------------------------------
18:01:26 web.1  | --------------------------------------------------------------------------------
18:01:26 web.1  | DEBUG in selection [/home/adam/geemusic/geemusic/geemusic/intents/selection.py:65]:
18:01:26 web.1  | URL is https://[ngrok code].ngrok.io/stream/Thcn3dx45gqvphgmb2j65umeo3i
18:01:26 web.1  | --------------------------------------------------------------------------------
18:01:26 web.1  | 127.0.0.1 - - [16/Feb/2017 18:01:26] "POST /alexa HTTP/1.1" 200 -
18:01:37 web.1  | --------------------------------------------------------------------------------
18:01:37 web.1  | DEBUG in controllers [/home/adam/geemusic/geemusic/geemusic/controllers.py:19]:
18:01:37 web.1  | URL is [long google link removed for ease of reading]
18:01:37 web.1  | --------------------------------------------------------------------------------
18:01:37 web.1  | 127.0.0.1 - - [16/Feb/2017 18:01:37] "GET /stream/Thcn3dx45gqvphgmb2j65umeo3i HTTP/1.1" 302 -

and this is the output from Alexa:

18:05:13 web.1  | --------------------------------------------------------------------------------
18:05:13 web.1  | DEBUG in selection [/home/adam/geemusic/geemusic/geemusic/intents/selection.py:49]:
18:05:13 web.1  | Fetching album feeling electric by None
18:05:13 web.1  | --------------------------------------------------------------------------------
18:05:14 web.1  | --------------------------------------------------------------------------------
18:05:14 web.1  | DEBUG in selection [/home/adam/geemusic/geemusic/geemusic/intents/selection.py:65]:
18:05:14 web.1  | URL is https://[ngrok code].ngrok.io/stream/Thcn3dx45gqvphgmb2j65umeo3i
18:05:14 web.1  | --------------------------------------------------------------------------------
18:05:14 web.1  | 127.0.0.1 - - [16/Feb/2017 18:05:14] "POST /alexa HTTP/1.1" 200 -
18:05:17 web.1  | --------------------------------------------------------------------------------
18:05:17 web.1  | DEBUG in controllers [/home/adam/geemusic/geemusic/geemusic/controllers.py:19]:
18:05:17 web.1  | URL is [google link]
18:05:17 web.1  | --------------------------------------------------------------------------------
18:05:17 web.1  | 127.0.0.1 - - [16/Feb/2017 18:05:17] "GET /stream/Thcn3dx45gqvphgmb2j65umeo3i HTTP/1.1" 302 -
18:05:20 web.1  | 127.0.0.1 - - [16/Feb/2017 18:05:20] "POST /alexa HTTP/1.1" 400 -

So it seems that Alexa is receiving the link, requesting it, then failing to do anything with it?

from geemusic.

leaskovski avatar leaskovski commented on July 30, 2024

I think I am getting similar issues with my setup as well.

54.240.197.9 - - [16/Feb/2017 22:56:43] "POST /alexa HTTP/1.1" 200 -
--------------------------------------------------------------------------------
DEBUG in controllers [/opt/geemusic/geemusic/controllers.py:19]:
URL is https://r2---sn-cn3tc-xh5e.c.doc-0-0-sj.sj.googleusercontent.com/videoplayback?............
--------------------------------------------------------------------------------
192.168.0.1 - - [16/Feb/2017 22:56:45] "GET /stream/Tgyekwg6b4dqwk3xcizsmzwycxi HTTP/1.1" 302 -
54.240.197.9 - - [16/Feb/2017 22:56:46] "POST /alexa HTTP/1.1" 400 -

Not sure what is going on. Originally I wasn't able to get this far as I was running a self signed cert on my server, but now that I have used LetsEncrypt to get a proper cert, I am now seeing the googleusercontent URL in debugging.

Just not getting any actual audio, and Alexa thinks that the media is playing as I ask it whats its doing and it tells me the track.

from geemusic.

appetterson avatar appetterson commented on July 30, 2024

I've done some digging and I'm assuming that 400 is a playback response. Specifically I imagine playback failed. It doesn't seem that there is anything in the code to handle it, and I can't find any examples for flask-ask that implement it. I had a dig around in the flask-ask source and there is a bit of code that does something with it but I'm not sure what, and my attempts to implement in it in selection failed.

If I'm right and it is playback failed it might help to see the json that is being sent so we can see the errors but I'm not sure how to go about doing that.

I had a play around with the Flask-ask source and managed to output the request type for the 400 error. It seems to confirm my suspicions as it has the type: IntentRequestlaybackFailed (exactly that, with what I assume is a typo that may be causing the problem not getting a response from playback failed).

I'd have more of a play now but I unfortunately need to get to work. I'll try to have another look tomorrow.

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@appetterson Yep, your right if you turn on debugging here is the json.

15:29:35 web.1  |   "request": {
15:29:35 web.1  |     "currentPlaybackState": {
15:29:35 web.1  |       "playerActivity": "IDLE"
15:29:35 web.1  |     },
15:29:35 web.1  |     "error": {
15:29:35 web.1  |       "message": "SSL certificate problem: unable to get local issuer certificate",
15:29:35 web.1  |       "type": "MEDIA_ERROR_UNKNOWN"
15:29:35 web.1  |     },
15:29:35 web.1  |     "locale": "en-US",
15:29:35 web.1  |     "requestId": "[Request Id here]",
15:29:35 web.1  |     "timestamp": "[Timestamp here]",
15:29:35 web.1  |     "token": "[Token here]",
15:29:35 web.1  |     "type": "AudioPlayer.PlaybackFailed"
15:29:35 web.1  |   },
15:29:35 web.1  |   "version": "1.0"
15:29:35 web.1  | }

I've removed the redirect so it goes directly to google's url but it still returns the same error. The way I see it there are two ways to resolve this. Either contact amazon and see if they will trust the googleusercontent.com certs or figure out a way to proxy_pass the url (kinda like you would do in nginx). I'm going to continue looking into the second option and see if I can get something whipped up.

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

I fixed this in PR #41 by streaming the url though a proxy. The speed was fast enough for me with no stutters.

from geemusic.

appetterson avatar appetterson commented on July 30, 2024

I can confirm this is the same issue. I fixed the problem in handling playbackFailed in flask-ask and implemented it in geemusic. I got this response:

10:55:02 web.1  | 127.0.0.1 - - [18/Feb/2017 10:55:02] "GET /stream/Thcn3dx45gqvphgmb2j65umeo3i HTTP/1.1" 302 -
10:55:03 web.1  | --------------------------------------------------------------------------------
10:55:03 web.1  | DEBUG in playback [/home/adam/geemusic2/geemusic/geemusic/intents/playback.py:34]:
10:55:03 web.1  | Playback failed due to error: {u'message': u'SSL certificate problem: unable to get local issuer certificate', u'type': u'MEDIA_ERROR_UNKNOWN'}
10:55:03 web.1  | --------------------------------------------------------------------------------

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@appetterson Can you test out this branch to see if it fixes that issue?

from geemusic.

arimk avatar arimk commented on July 30, 2024

Seems like a general issue, having the same trouble on geemusic on heroku. Will wait for your branch to merge then :)

from geemusic.

raphaelcastaneda avatar raphaelcastaneda commented on July 30, 2024

@PostsDesert - When I attempted to deploy your branch to heroku, I got the following error (the app crashed on startup):

2017-02-18T22:00:55.544244+00:00 heroku[web.1]: Starting process with command `python3 server.py`
2017-02-18T22:00:58.649389+00:00 app[web.1]: Fatal Python error: Py_Initialize: Unable to get the locale encoding
2017-02-18T22:00:58.649406+00:00 app[web.1]: ImportError: No module named 'encodings'
2017-02-18T22:00:58.775469+00:00 heroku[web.1]: Process exited with status 134
2017-02-18T22:00:58.800135+00:00 heroku[web.1]: State changed from starting to crashed

from geemusic.

raphaelcastaneda avatar raphaelcastaneda commented on July 30, 2024

@PostsDesert - On your loop-support branch, after setting up a runtime.txt with python-3.6.0 for heroku, I was able to get some endpoints to work, for example the IFL radio. However, when attempting to play an artist radio, I get an "Invalid Request" error:

2017-02-18T22:48:20.068932+00:00 app[web.1]: gmusicapi.exceptions.CallFailure: BatchMutateStations: BatchMutateStations: The server reported failure while changing the requested resource. If this wasn't caused by invalid arguments or server flakiness, please open an issue.
2017-02-18T22:48:20.068933+00:00 app[web.1]: (requests kwargs: {'method': 'POST', 'url': 'https://mclients.googleapis.com/sj/v2.5/radio/editstation', 'data': '{"mutations": [{"createOrGet": {"clientId": "582f8358-f62c-11e6-82e1-b6fb9be2bec5", "deleted": false, "imageType": 1, "lastModifiedTimestamp": "-1", "name": "Radiohead Radio", "recentTimestamp": "1487458099988003", "seed": {}, "tracks": []}, "includeFeed": false, "numEntries": 0, "params": {"contentFilter": 1}}]}', 'headers': {'Content-Type': 'application/json', 'Authorization': '<omitted>'}, 'params': {'alt': 'json', 'hl': 'en_US', 'dv': 0, 'tier': 'aa'}})
2017-02-18T22:48:20.068933+00:00 app[web.1]: (response was: '{"mutate_response":[{"id":"","response_code":"INVALID_REQUEST"}]}')
2017-02-18T22:48:20.068929+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/clients/shared.py", line 84, in _make_call
2017-02-18T22:48:20.068929+00:00 app[web.1]:     return protocol.perform(self.session, self.validate, *args, **kwargs)
2017-02-18T22:48:20.068929+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/protocol/shared.py", line 261, in perform
2017-02-18T22:48:20.068930+00:00 app[web.1]:     raise_from(CallFailure(err_msg, e.callname), e)
2017-02-18T22:48:20.068930+00:00 app[web.1]:   File "<string>", line 2, in raise_from
2017-02-18T22:48:20.068931+00:00 app[web.1]:     
2017-02-18T22:48:20.068932+00:00 app[web.1]: gmusicapi.exceptions.CallFailure: BatchMutateStations: BatchMutateStations: The server reported failure while changing the requested resource. If this wasn't caused by invalid arguments or server flakiness, please open an issue.
2017-02-18T22:48:20.068933+00:00 app[web.1]: (requests kwargs: {'method': 'POST', 'url': 'https://mclients.googleapis.com/sj/v2.5/radio/editstation', 'data': '{"mutations": [{"createOrGet": {"clientId": "582f8358-f62c-11e6-82e1-b6fb9be2bec5", "deleted": false, "imageType": 1, "lastModifiedTimestamp": "-1", "name": "Radiohead Radio", "recentTimestamp": "1487458099988003", "seed": {}, "tracks": []}, "includeFeed": false, "numEntries": 0, "params": {"contentFilter": 1}}]}', 'headers': {'Content-Type': 'application/json', 'Authorization': '<omitted>'}, 'params': {'alt': 'json', 'hl': 'en_US', 'dv': 0, 'tier': 'aa'}})
2017-02-18T22:48:20.068933+00:00 app[web.1]: (response was: '{"mutate_response":[{"id":"","response_code":"INVALID_REQUEST"}]}')

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@raphaelcastaneda Thanks for catching that! I just pushed a fix to the loop-support branch.

from geemusic.

appetterson avatar appetterson commented on July 30, 2024

@PostsDesert - I can confirm your branch works. Cheers. :)

from geemusic.

ruricu avatar ruricu commented on July 30, 2024

@PostsDesert Can you give more specific details on the proxy/proxy_pass setup you mentioned?

or figure out a way to proxy_pass the url (kinda like you would do in nginx). I'm going to continue looking into the second option and see if I can get something whipped up.

I fixed this in PR #41 by streaming the url though a proxy. The speed was fast enough for me with no stutters.

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@ruricu Here's the code. Basically it streams the url in 1mb chunks though the APP_URL set in you .env instead of redirecting to the google url. This appears to amazon as if you were streaming it from your home server url and not googles. Amazon is blocking google's ssl certificate for googleusercontent.com but Amazon accepts your APP_URL certificate. Therefore it works (but it needs some fine tuning on the chunk size for slow internet connections).

from geemusic.

ruricu avatar ruricu commented on July 30, 2024

@PostsDesert Dang; I only posted because I had used your branch and still saw the "SSL certificate problem: unable to get local issuer certificate" error with my self-signed certificate.
For completeness' sake, I'm attempting to use an Apache reverse proxy with the skill accessible at [domain]/geemusic. I have proxy_pass set up for /geemusic, but did you have to configure anything additional for /geemusic/stream?

from geemusic.

CarLeeToes avatar CarLeeToes commented on July 30, 2024

@PostsDesert I'm also having the "Alexa responds, but no music" problem using master on Heroku. I tried your branch (using Heroku) but I don't even get a response from 'help' in the simulator. I have no trailing "/" in Heroku's envs.

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@ruricu Sorry if I can across as harsh in the first reply. The endpoint is set to /alexa on the latest commit (It's been changed back and forward between /geemusic a few times). It seems according to the issues that Alexa does not like self-signed certs. I'm using a nginx reverse proxy with the skill assessable at [domain]/alexa. I did not have to configure anything else for /alexa/stream. I'm using let's encrypt for my ssl certs which is very easy to set up with apache or nginx.

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@CarLeeToes Did you set it up for python3? Do you have any logs?

from geemusic.

reductio avatar reductio commented on July 30, 2024

I have the same problem. However, I have one Echo Dot and two big Echos. Only the Dot shows that problem, both Echos don't. I use the same account and also the same geemusic server (which I set up on my own public server) for all devices.

from geemusic.

appetterson avatar appetterson commented on July 30, 2024

Interesting. Both of my devices are dots.

from geemusic.

ruricu avatar ruricu commented on July 30, 2024

@PostsDesert No harm done. It's interesting that a skill can be run from an untrusted self-signed cert, but audio cannot be streamed from it. I'm currently using a free DDNS to access my various webservices, so LetsEncrypt does not play nice... but maybe this is finally enough push to actually buy a domain.

EDIT: Picked up an $0.88 domain from namecheap and a free SSL cert from LetsEncrypt, and I'm in business! Thanks!

from geemusic.

PostsDesert avatar PostsDesert commented on July 30, 2024

@appetterson @reductio I have an echo dot too. Maybe the dots got a software update before the big echos.

from geemusic.

leaskovski avatar leaskovski commented on July 30, 2024

@PostsDesert , your branch worked for me as well. I am also using an echo dot. Brilliant work! Thanks.

from geemusic.

stevenleeg avatar stevenleeg commented on July 30, 2024

this should be fixed now that #41 is merged, woohoo! could someone pull from master, try it out, and confirm for me?

from geemusic.

arimk avatar arimk commented on July 30, 2024

broke my Heroku installation
See #68

from geemusic.

Karthik-Kannan avatar Karthik-Kannan commented on July 30, 2024

@stevenleeg I still have the same bug. I just cloned the repo today, so I assume I got the changes. This is the debug output I get from foreman.

04:29:25 web.1 | DEBUG in selection [/home/pi/geemusic/geemusic/intents/selection.py:85]: 04:29:25 web.1 | Fetching song anthem by emancipator 04:29:25 web.1 | -------------------------------------------------------------------------------- 04:29:25 web.1 | 127.0.0.1 - - [01/Mar/2017 04:29:25] "POST /alexa HTTP/1.1" 200 - 04:29:26 web.1 | 127.0.0.1 - - [01/Mar/2017 04:29:26] "GET /alexa/alexa/stream/Tvf6ekr6pd3jqzq6wstv5vcyuqa HTTP/1.1" 404 - 04:29:27 web.1 | 127.0.0.1 - - [01/Mar/2017 04:29:27] "POST /alexa HTTP/1.1" 400 -

from geemusic.

arimk avatar arimk commented on July 30, 2024

This double alexa in "GET /alexa/alexa/stream/Tvf6ekr6pd3jqzq6wstv5vcyuqa is not supposed to be there... @PostsDesert no?

from geemusic.

arimk avatar arimk commented on July 30, 2024

All works for me on heroku on the last build now streaming and everything

from geemusic.

Karthik-Kannan avatar Karthik-Kannan commented on July 30, 2024

Yeah I had the wrong URL on Amazon. I get the stream URL but it just doesn't play. I think it might be something to do with my Pi, because I can play it on when I paste the URL on my browser. I'll try to figure out what's wrong and get back to you

Update: It works for me using Heroku as well! Thanks!

from geemusic.

joseeantonior avatar joseeantonior commented on July 30, 2024

This bug is hitting me as well. It can run fine through Heroku, but on my own Linode instance with Let'sEncrypt ceritficates it just fails. If there is anything I can do to help debug, please let me know.

from geemusic.

sasurai-engineer avatar sasurai-engineer commented on July 30, 2024

I'm having the same issue, with a different setup. I am using Docker/Nginx and a self-signed SSL.

172.17.0.1 - - [18/Apr/2017 02:44:46] "POST /alexa HTTP/1.0" 200
172.17.0.1 - - [18/Apr/2017 02:45:21] "POST /alexa HTTP/1.0" 200
172.17.0.1 - - [18/Apr/2017 02:45:36] "POST /alexa HTTP/1.0" 200
172.17.0.1 - - [18/Apr/2017 02:45:41] "POST /alexa HTTP/1.0" 400
172.17.0.1 - - [18/Apr/2017 02:46:49] "POST /alexa HTTP/1.0" 200
172.17.0.1 - - [18/Apr/2017 02:46:54] "POST /alexa HTTP/1.0" 400`

from geemusic.

stevenleeg avatar stevenleeg commented on July 30, 2024

This hasn't seen any recent activity and will therefore be closed. Feel free to comment or file a new issue if you're still having trouble.

from geemusic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.