Configure media player to play an internet stream

I’d like to configure a button to play a particular internet radio station (Radio Paradise, an Internet-only station) on a device, but I can’t find a simple example of configuring media_player.play_media to take a random stream url (e.g., https://stream.radioparadise.com/aac-128). Is that possible? Can someone show me an example?

From a dashboard button:

        hold_action:
          action: call-service
          service: media_player.play_media
          service_data:
            entity_id: media_player.bedroom_speaker
            media_content_id: 'http://ice-the.musicradio.com/HeartBedfordshire'
            media_content_type: audio/mp4

Thanks for that @TazUk, that put me on the right track. I eventually got this working, like so (using Bose Soundtouch integration) in a script, which I’ve assigned to a button. I could probably simplify this:

play_radioparadise_everywhere:
  alias: "Play Radioparadise everywhere"
  sequence:
    - service: media_player.turn_on
      target:
        entity_id: media_player.soundtouch_living_room
    - service: media_player.turn_on
      target:
        entity_id: media_player.soundtouch_kitchen
    - service: soundtouch.play_everywhere
      data:
        master: media_player.soundtouch_living_room
    - service: media_player.play_media
      target:
        entity_id: media_player.soundtouch_living_room
      data:
        media_content_id: http://stream.radioparadise.com/aac-128
        media_content_type: MUSIC
2 Likes

So, what am I doing wrong here??

show_name: true
show_icon: true
type: button
tap_action:
action: toggle
hold_action:
action: call-service
service: media_player.play_media
data:
media_content_id: Listening to: KEWR Tower #1 | Newark, New Jersey, United States | LiveATC.net
enqueue: play
media_content_type: audio/mp4
target:
entity_id: media_player.scott_s_office
entity: media_player.scott_s_office
name: ATC
show_state: true

Without seeing the formatting…
Does the service call work from Developer Tools with the parameters you are using?

Not sure of this. I merely got some sample code from HA but can not get it to work. :frowning:

Well then I’d suggest trying the calls in Developer Tools…

Sorry…may be beyond my understanding. Can you provide a bit of a hint. Would this be a Call Service? If so, how???

Developer Tools Documentation

Test your service call in the services section.
This will tell you whether what you are trying to do will work.

If your service call works in developer tools, then it is your dashboard code that needs adjusting.
To get help with the dashboard code you will need to format it properly when posting it - see this.

Interesting…Alexa is telling me that I’m trying to do TTS. I must be totally lost on this one. Can’t believe there’s not an existing Integration to play internet streaming audio.

Thanks anyway.
s

Progress…I dropped it into Developer Tools and when I call the service I get a GREEN CHECKMARK but I’m still not hearing anything.

So the service call is valid.
Loading the stream url you are using does not autoplay in my browser, whereas http://ice-the.musicradio.com/HeartBedfordshire does.
See if that works.

getting a bit frustrated here. Tried plugging it all into the mini-media player and although it appears valid, there is NO SOUND

type: custom:mini-media-player
entity: media_player.scott_s_office
service: media_player.play_media
data:
media_content_id: http://ice-the.musicradio.com/HeartBedfordshire
media_content_type: audio/mp4
enqueue: play
target:
device_id: 1b6c4b692ea4c530d934705c6dd24270
name: ATC
volume_stateless: true
info: scroll
source: icon
sound_mode: full

==========================
Any thoughts??? ps. sorry for the BOLD letters. I’m not screaming :slight_smile:

  1. If you don’t get sound using the Developer Tools > Services interface, you won’t get sound calling the service from anywhere else.
  2. Please don’t post code without formatting.

My call works with a Nest Home Hub Max in HA v2022.7.7 - we don’t have any Amazon devices so I don’t know whether there are any differences in how they behave.

In fact, a quick search of the community turns up this post by sparkydave that implies that Amazon devices are (or were) known to be difficult.

I suspect that if you dig around the community you may find further info on that - failing that I’d suggest starting a new thread with the specific end to end details of what you want to achieve (and formatted code please).

sorry about the unformatted code. Could you please explain and I’ll be glad to comply.

With regards to my inquiry, I will try on a SONOS and see if there’s any luck there. thanks for your reply.

OK…so no luck trying to go to SONOS either. Ironically, I do hear error messages from SONOS when I change the code parameters. Has anyone heard of a custom integration to do this using Amazon Alexa?

any help here? I’m a newbie but learning fast.

service: media_player.play_media
data:
  media_content_id: http://d.liveatc.net/kewr_twr
  media_content_type: playlist
  enqueue: replace
target:
  entity_id: media_player.nest_office

Pls remember - you can’t play media on Alexa devices like Echo. Use other sound device like Google Nest or other compatible loudspeaker device. I noticed that after starting this stream, it starts working after a few dozen seconds.

In case anyone is still monitoring this thread …

I just developed a new SoundTouchPlus custom component if you’re interested. It can easily be installed via HACS as well. More information can be found in this forum post.

It can play HTTPS media streams. Example:

service: media_player.play_media
data:
  media_content_type: music
  media_content_id: >-
    https://stream.radioparadise.com/aac-128
target:
  entity_id: media_player.soundtouch_10
6 Likes