Select Radio MP3 stream (in a way similar to selecting playlists, without specifying which speakers to use)

media_player_example_v01

With the ytube_music_player I can easily select which speakers (or groups) to use (media_player.select_source), and it is also easy to select the playlist (entity_id: media_player.ytube_music_player, media_content_id: PLxxxxx, media_content_type: playlist), and no need for Helpers, and each can be chosen independantly (when I set a playlist I do not need to respecify which speakers I already selected for playing when switching to another playlist, or change speaker without respecifying the playlist. All great :slight_smile:

How do I do that for a radio/mp3 music stream (without specifying which speakers I have already selected)?

I would like it if it could work something like this:

type: custom:mushroom-template-card
primary: QMusic 80's
icon: mdi:radio
tap_action:
  action: call-service
  service: media_player.play_media
  service_data:
    **entity_id: "{{ state_attr('media_player.ytube_music_player', 'remote_player_id') }}"**
    media_content_id: https://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_fouteuur_96.mp3
    media_content_type: music

I am fine with using a different media_player (I understand the one I use now is focussed on YouTube Music). Only the dynamic setting of the speaker isn’t working in the code above. I like code to be self contained as much as possible (no helpers/automations if it can be avoided) How do I chose a radio mp3 stream without saying explicitly which speaker (google cast) entities to use? (for example by using the attribute value: remote_player_id, of: media_player.ytube_music_player, which contains the chosen speaker)

To answer my own question: It is possible to do the dynamic entity assignment of which speaker source to use when done in script (instead of in the button code). That disconnects the ytube_media_player so I needed to keep track if a playlist was playing or radio is playing. I used input_text variables for it and keep track which playlist, which radio/stream, which source was selected (and when I which source/speaker pause the previous media_player, and play on the new one selected). I hoped it would be more self contained, but it works :slight_smile: