-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Wont Stream to Alexa Devies #2729
Comments
Same issue using Music Assistant |
I believe this Custom Integration acts as a middleman that allows Home Assistant to communicate with Amazon servers over the cloud by interacting with the APIs available from Amazon side. The amazon servers act as gatekeepers to the Alexa ecosystem and have to let through the data received from Home Assistant (or ytubeMediaPlayer) using the API to the Alexa device. So, being the gatekeeper of what is allowed to be played on the Alexa device, Amazon has to provide a method to allow it to stream content other than TTS which I believe it no longer does. The other approach involve using an Alexa skill but it only allows you to ask your Alexa device to play music using that skill. It still does not allow you to stream directly from the service providing the skill (like Spotify) to the Alexa device. I hope that helps understand things better. |
alexa_media_player/custom_components/alexa_media/media_player.py Lines 1450 to 1456 in a39db58
The above seems to send music requests to async_play_tts_cloud_say which at the bottom sends out the error message mentioned in this issue. Not sure why the actual play_music call is only the default action and not used when the media_type is music. alexa_media_player/custom_components/alexa_media/media_player.py Lines 1585 to 1613 in a39db58
|
The first blob is simply a way to gracefully handle the error that arises when the media type is music instead of leaving the users clueless without a response at all. "Sorry folks! Amazon doesn't allow streaming music like this." would be a more appropriate TTS response for this I think. Regarding the second blob, I think Amazon previously allowed this functionality and Alexa Media Player was able to use it (I started using Home Assistant only about a year ago so not sure) but the support no longer exists and this is just remnants of the old code that allowed it. It could also be some placeholder code they could use if Amazon allows/re-allows this functionality in the future. In fact, I have created a small PR for this (#2736) so that users get hear a more accurate error message while trying to play music using this integration instead of something vague. EDIT: I checked out the code for play_music function (https://gitlab.com/keatontaylor/alexapy/-/blob/dev/alexapy/alexaapi.py?ref_type=heads#L728) in alexaapi file in alexapy from where this function is actually imported. Seems like the function is simply meant to do something like "Alexa, play on ". So there doesn't seem to be anything that can actually control the playback or cast local music to the Alexa device since Amazon's 'walled garden' doesn't have any support for casting local music at all. |
That play_music function in gitlab indicates you can pass a provider and search string, which should work: Granted we'd need to pass some sort of valid provider, which would not likely work for local media but could be used for several services such as:
|
Thanks for explaining it in a better manner. You're right, it simply executes a search query which could be done with an automation like the one I am using (#2208 (comment)). Maybe the Music Assistant team could implement a way to pass a search query with 'custom' content type to the media player device created by AMP to create an illusion of the music being cast on the Alexa media device but even in that case, Alexa device would only be able to play the track if it is available on one of its supported services. Therefore, this method still won't allow the media_player entity created by this Integration to be used like a proper media player using Music Assistant since this approach will limit the ability to control playback fully or cast local media. |
IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.
Describe the bug
When attempting to play music from ytubeMediaPlayer (YouTube) i get a announcement: To send TTS, please set Announce=true. Music can't be played this way.
System details
Core 2024.12.0
Supervisor 2024.11.4
Operating System 14.0
Frontend 20241127.4
Here is the log.
Logger: custom_components.alexa_media.media_player
Source: custom_components/alexa_media/media_player.py:1436
integration: Alexa Media Player (documentation, issues)
First occurred: 2:37:58 AM (4 occurrences)
Last logged: 2:39:13 AM
To send TTS, please set Announce=true. Music can't be played this way.
The text was updated successfully, but these errors were encountered: