Support for Alexa Media Player #431
Replies: 31 comments 110 replies
-
I've inspected this today and so far I see no easy way to make that work. The Alexa Media Player does not allow to just send a stream URL to play which is what this integration needs. The only way to make this work properly is if somebody creates a custom Alexa skill that communicates with this integration. I do not own a Alexa device so I can't do that. A little googleing I just did quickly led me to several 3rd party solutions you could use to turn the Echo device into a unpnp receiver or squeezebox player. For example: https://www.amazon.com/ComputeQ-UG-Haftungsbeschr-Roomskills-Squeezebox/dp/B0983C2377 I'm happy to work with somebody to make this work but without an actual Alexa/Echo device to test with, this is not something I can start with alone |
Beta Was this translation helpful? Give feedback.
-
I would gladly help, I'm not a developer, but I would help by testing it on my echos, unfortunately I'm located in Spain and the skill you pointed can be only installable on US echos (perhaps on DE as well, as per language selection) |
Beta Was this translation helpful? Give feedback.
-
I don't know how the SpotCast integration works but I'm able to play music from spotify on my alexa devices from Home Assistant, I don't believe a skill is needed. |
Beta Was this translation helpful? Give feedback.
-
@mabrochu-helpox how do you bring the Alexa's into HA as media players though? |
Beta Was this translation helpful? Give feedback.
-
To be clear, this is not the official Alexa integration built into HA. This is a custom integration known as Alexa Media Player. It is found here: https://github.com/custom-components/alexa_media_player |
Beta Was this translation helpful? Give feedback.
-
For Music Assistant to work it is required that the enddevice (the speaker) supports "play from url". Music Assistant is not about playing Spotify on a speaker. Music Assistant is about playing all your online en offline media to a collection of speakers. The Spotcast implementation (and others like the alexa custom integration) send Spotify commands to the Echo speaker, not plain urls |
Beta Was this translation helpful? Give feedback.
-
Its hacky but you can send urls like this:
Probably not the intended use but im curious if there is another api we that could be leveraged ? |
Beta Was this translation helpful? Give feedback.
-
Enjoyed the Open Home Audio stream with you all! Very impressive stuff all around! @marcelveldt Music Assistant seems great, and opens a world of possibilities! I just wanted to offer up a potential path forward for supporting Echo devices, and that would be using them as a bluetooth audio target. I regularly pair my Echo with my Macbook via bluetooth, and set it as my output device. No special hardware of configuration needed, just the Amazon Alexa app: The simplest solution is to pair your Echo(s) with the host OS, and use them as system output device(s) - of course, that may incur limitations regarding targeting specific connected devices/groups Traditionally, Bluetooth radios have supported a single audio streaming device per chip (except for a few specialist radios) - so 1 dongle = 1 speaker, 2 dongles = 2 speakers, etc.... However, the recent Bluetooth LE specification also adds "multi device audio streaming" from a single radio, I believe using the LC3 codec. Here's some reference links: https://www.bluetooth.com/learn-about-bluetooth/recent-enhancements/le-audio/
|
Beta Was this translation helpful? Give feedback.
-
Additional: I came across an article from last year on Mark Lewis's Blog, in which he configures audio with a bluetooth dongle on Home Assistant OS, seemed fairly simple: https://marklewis.blog/2021/02/25/home-assistant-bluetooth-speaker/ Mark was using a "Local VLC" community addon as a player, but I'm sure there's other things that can be done |
Beta Was this translation helpful? Give feedback.
-
would we possibly be able to use something like this: https://www.youtube.com/watch?v=NoCPUypkimc&ab_channel=DabbleLab as a base for a custom skill to be able to play media from a url on amazon devices? |
Beta Was this translation helpful? Give feedback.
-
Moved to discussions, raise your votes! |
Beta Was this translation helpful? Give feedback.
-
I think we would need to create a music provider following https://developer.amazon.com/en-US/docs/alexa/music-skills/understand-the-music-skill-api.html and then hook into that via alexa_media_player through alexapys |
Beta Was this translation helpful? Give feedback.
-
Not a coder, just a dabler. From what I understand. Activating this skill will have the backend load up an audio stream. The URL in this stream could be changed to point to your home assistant instance (or I believe nabu casa URL) for the .m3u file. If it's possible to code an audio stream, then we could use this skill. The scenario would be to have the audio stream process start when opening the media player If this is achievable, then we could adapt the stream URL to other players. Using a m3u app on your phone to stream is one example that comes to mind. Edit: |
Beta Was this translation helpful? Give feedback.
-
Any more progress on using the Alexa Media Player integration in conjunction with this? |
Beta Was this translation helpful? Give feedback.
-
I wonder why it doesn't work. Anyway, my plan is to get rid of all Alexa speakers :) |
Beta Was this translation helpful? Give feedback.
-
2 years later this still hasn't been able to be fixed? I downloaded Music Assitant because I have a house full of Alexa and even Alexa Amplifiers so I can have whole house audio. It's very disappointing that my Alexa devices can't be used as players. |
Beta Was this translation helpful? Give feedback.
-
Looking for any success stories with Alexa and either a Bluetooth connection or via the HA plugin exposing HA media players. Interested to understand if we have a workable solution already to support these devices. |
Beta Was this translation helpful? Give feedback.
-
I think the solution is relatively simple (at least that's what my Alexa said). So a normal service call to play music from Alexa is the following:
But since Alexa says
This service call option is also documented on the official Home Assistant Docs https://www.home-assistant.io/integrations/media_player/ |
Beta Was this translation helpful? Give feedback.
-
I tried the changes suggested and only ended up with error
I guess the only problem now is to figure out how to get rid of the |
Beta Was this translation helpful? Give feedback.
-
I have used this to stream from my local shoutcast Server to play on Alexa |
Beta Was this translation helpful? Give feedback.
-
I just used this for my local Snapcast from Music Assistant and I can get all my Alexas to play the same stream and they are in sync pretty well https://github.com/alexa-samples/skill-sample-nodejs-audio-player in Lambda index.js just change this line to your local pserver const podcastUrl = 'https://audio1.maxi80.com'; |
Beta Was this translation helpful? Give feedback.
-
good tutorial for this: https://giuliomagnifico.medium.com/build-a-custom-audio-stream-from-a-video-url-for-echo-devices-1ba8a7cd34bb |
Beta Was this translation helpful? Give feedback.
-
I have a solution that works using snapcast. |
Beta Was this translation helpful? Give feedback.
-
I worked around this problem by using the alexa media player integration and using an automation to send a command to alexa. Note that media_player.entry is the alexa where I send all my commands to just in case she ever decides to respond but the media_content_id I am specifying everything I want to do. If I can code this so that the media content id is dynamic then I can create a dashboard with station buttons just using the voice commands. I've used this method quite a few times particulary when I can't get devices working with home assistant but they work fine with alexa voice commands. You just have to remember to write "how it sounds" |
Beta Was this translation helpful? Give feedback.
-
So they're definitely seems to be a way for this to work because there's a third party program called MyMedia Alexa (mymediaalexa.com) that allows you to play any mp3 that you may have locally stored on your computer and there is no 4 minute limit (I've played a 3hr DJ set on my Echos). Then consider the fact that I can play Sirius XM on my speakers, so it must play URLs. It's just a matter of figuring out how Sirius XM is able to work and combine that with MyMedia and how it's able to play audio that doesn't confirm to the 4 min limit and bitrate requirements. That is of course, if it converts everything on the fly. |
Beta Was this translation helpful? Give feedback.
-
I was able to get a preliminary version working but this is a very hacky workaround and requires several other services.
If everything is working, you should now be able to hear your stream on your Echo device. So far, any of the media controls once the stream is started on the Echo device will end the stream on your Echo device and requires you to start the skill again. Another useful invocation is to use Alexa Media Player's custom command similar to this:
Hopefully more experienced developers can use some of these components and make a more robust solution. Also if you are having trouble with the Alexa skill, this guide may help. The test tab in the Alexa developer console is also very useful for debugging and can be used to see if the proxied mpd url is working. |
Beta Was this translation helpful? Give feedback.
-
Hey @alams154, you're basically doing the same thing MyMediaAlexa does, only in way more steps necessary.
The button basically asks MyMediaAlexa to play whatever song/playlist/artist you have put in your yaml. My suggestion would be to create several playlists in MyMediaAlexa and then create corresponding scripts in Hass, and buttons in Music Assistant for the same playlists you created in MMA. I've posted the question in MMA forum to see if they could add a Play Now button that runs a script telling Alexa to play the song/artist/album/playlist it's next to. Currently you cannot initate a song/playlist in MMA by pressing any button. You have to tell Alexa to play it verbally. But that's a whole different issue, and not related to MA. I've been tinkering with MA using the nice card YAML that was recently posted. See below. I have it now displaying the previous song played, and a few buttons that will grow as I create them. Ignore what you see where the albums are. I changed my URLs to point to MyMediaAlexa since it's an iFrame but there's no functionality to initiate playing any songs. I have to decide what I want to do with that part of the card because it won't work for me since I use Alexa devices. But the 4 grey see through buttons in the top left are fully functional. |
Beta Was this translation helpful? Give feedback.
-
To each their own man. When you say you don't think MyMedia would work, did you leave out the words, "for you"? Because as I showed you in my screen print, it does work. So I am able to merge MA and MyMedia together in MA. So not only can I play YouTube, Spotify, SiriusXM, I'm able to play my local music as well. My last hurdle, which is possible, is to learn how to code the search function so I can search my local media. I'm sure there's a way to use MA's search function and tie it to a script. I'm not that great with coding but am a fast learning and will succeed in doing so. Also, there are 3 of your steps are not that easy to do for the average person:
First, how much money are you paying to host a public domain? Or is this free? Domain names are usually around $10-$15 a year. So the cost of that is at or more than the cost of MyMedia ($9.50 per year). Then you have to configure/setup your domain. Again, not that easy for the average person. Then the next twoo steps are quite complicated. I've attempted myself and gave up. It's very overwhelming on creating your own Alexa Skill. It's not intuitive and there are a ton of steps to take to get it going. But, you do what you are confortable with. As will I. That's the great thing about Home Assistant. We can all do our own variations of setup. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if you knew about this or not, but I found a skill already that allows Alexa to control MPD: |
Beta Was this translation helpful? Give feedback.
-
Trying to play music from Spotify to my Alexa devices, which are set as media devices using Alexa Media Player. Alexa gives an error stating that the proper service calls must be made.
If this could be integrated in some way, it would be a game changer for playing music via HA. Happy to test anything as needed.
Beta Was this translation helpful? Give feedback.
All reactions