dmhacker / alexa-youtube-skill

Allows Alexa to play audio from YouTube videos
MIT License
243 stars 109 forks source link

AudioPlayer.PlaybackFailed not handled #2

Closed colinfrei closed 7 years ago

colinfrei commented 7 years ago

When I try to run this, I get an error when trying to play back the media file. This is sent as a 'AudioPlayer.PlaybackFailed' request, which doesn't have the applicationid in the sessiondetails, and that causes the following error:

Unhandled exception: Cannot read property 'applicationId' of undefined.

I think the 'pre' function needs to handle that case as well, and the app should probably log errors if it receives them.

ghost commented 7 years ago

@colinfrei did you manage to fix this? I have the same issue

dmhacker commented 7 years ago

I updated the alexa-app package so request.applicationId returns the correct information in app.pre. See if that works.

kadeschs commented 7 years ago

It seems to find stuff. I had a few successful finds. However, it doesn't play anything afterward.

Firni95 commented 7 years ago

Same here. Got the answer: {"state":"success","message":"Attempting upload ...","link":"https://s3-us-west-1.amazonaws.com/alexa-youtube-skill/audio/UC81i2M30Bc.mp3"} but it doesn't play any music

dmhacker commented 7 years ago

This is a known issue that Alexa doesn't play the audio. Can you guys @kadeschs @Firni95 @angelos1989 test this by giving the skill something to search and then looking through your Lambda's CloudWatch logs? You might be getting something like:

{ message: 'Your GStreamer installation is missing a plug-in.', type: 'MEDIA_ERROR_UNKNOWN' }

Also, make sure to pull from the repository and run zip.py again. I added in debugging, so you can see any error messages that Alexa gives.

kadeschs commented 7 years ago

Yes. It says it's missing a plug-in. Does the content-type need changed to "application/x-mpegurl"?

ghost commented 7 years ago

@dmhacker I have that issue with the Gstreamer as you described. Can we change the content type as suggested by @kadeschs and here : https://forums.developer.amazon.com/questions/59814/audioplayer-live-stream.html

dmhacker commented 7 years ago

@kadeschs @angelos1989 I'm going to update the server to return a m3u file (content-type would then equal application/x-mpegurl). The m3u file basically would serve as a redirect to the actual mp3 file, which will still be hosted on the same S3 bucket.

ohadbenita commented 7 years ago

Hi, I'm having the same issue as described with the missing plugin, see my latest Lambda invocation -

START RequestId: 6025202a-76ea-11e7-9587-855f366c09f5 Version: $LATEST 2017-08-01T18:51:06.567Z 6025202a-76ea-11e7-9587-855f366c09f5 Playback failed. 2017-08-01T18:51:06.568Z 6025202a-76ea-11e7-9587-855f366c09f5 { type: 'AudioPlayer.PlaybackFailed', requestId: 'amzn1.echo-api.request.a13d135d-3720-47a1-a2ce-7a51c8dc3e69', timestamp: '2017-08-01T18:51:06Z', locale: 'en-US', currentPlaybackState: { playerActivity: 'STOPPED' }, error: { message: 'Your GStreamer installation is missing a plug-in.', type: 'MEDIA_ERROR_UNKNOWN' }, token: 'zlabsbE4aiQ' } 2017-08-01T18:51:06.571Z 6025202a-76ea-11e7-9587-855f366c09f5 { message: 'Your GStreamer installation is missing a plug-in.', type: 'MEDIA_ERROR_UNKNOWN' } END RequestId: 6025202a-76ea-11e7-9587-855f366c09f5 REPORT RequestId: 6025202a-76ea-11e7-9587-855f366c09f5 Duration: 4.93 ms Billed Duration: 100 ms Memory Size: 384 MB Max Memory Used: 41 MB

Any update on how to fix this issue? @dmhacker Your help is highly appreciated

kadeschs commented 7 years ago

@dmhacker Try looking at https://github.com/Fenton-Fenton-Fenton/alexa-tube. They are accomplishing something similar with success. They are passing the mp3 file temporarily to a dropbox account. Might shed some light on what's going on here.

dmhacker commented 7 years ago

@ohadbenita @kadeschs @Firni95 @angelos1989

This is now fixed! The issue was that the mp3 file downloaded with ytdl-core in the Heroku server wasn't the correct bitrate. I fixed this by using ffmpeg to resave the file and modify the bitrate.

Yippee! Finally, no more GStreamer issues. If you are getting an issue or something isn't working, make sure everything you've done on your end matches the setup instructions in the README.