Offer option to loop/repeat an audio file on the media_player.play_media service

I will be nice to have custom buttons at media player (call service).

In the same boat. I have a lullaby song that plays for my kids for nap/bed time, and I’d love to be able to easily specify repeat to easily keep it playing through the night.

If you use YouTube Music you could use the custom component to play the track on repeat

It might not be the best solution, but I created this script:

alias: Rain Sounds
sequence:
  - service: media_player.volume_set
    data:
      volume_level: 0.3
    target:
      device_id: b6e85f0827e4471c94bd298390d6c606
  - repeat:
      until:
        - condition: template
          value_template: >-
            {{ state_attr('media_player.nest_mini', 'media_title') != 'Rain
            sounds' or states('media_player.nest_mini') != 'idle' }}
      sequence:
        - service: media_player.play_media
          data:
            media_content_type: music
            extra:
              title: Rain sounds
              thumb: >-
                http://www.gstatic.com/voice_delight/images/relaxation_sounds/icons/rain.png
            media_content_id: 'https://storage.googleapis.com/relaxation-sounds/rain_3600.mp3'
          target:
            device_id: b6e85f0827e4471c94bd298390d6c606
        - delay:
            hours: 0
            minutes: 0
            seconds: 10
            milliseconds: 0
        - wait_for_trigger:
            - platform: template
              value_template: >-

                {{ state_attr('media_player.nest_mini', 'media_title') == 'Rain
                sounds' and is_state('media_player.nest_mini', 'idle') }}
          continue_on_timeout: false
          timeout: '01:01:01'
mode: restart
icon: 'mdi:weather-pouring'

Here’s the result:

image

In short, until I tell it to stop or something else plays it’ll be repeating the mp3 I’ve chosen. Once HA gets support for script blueprints I’ll create and share it.

4 Likes

Following this… would like to be able to cast an mp4 (FINALLY figured out how to do that, the secret is in the www folder) then loop/repeat that mp4 on my Chromecast devices. No dice adding the media_player.repeat_set to one or all in my automation that fires the mp4 on multiple Chromecasts.

1 Like

+1
Playing back a rignbell audio sound (wav file that only lasts for 2-3 seconds), having this option would avoid having to repeat the service call 2-3 times.

So this hasn’t been resolved? Can we loop audio with Chromecasts yet?

1 Like

Hello!

same here, when you play a song from your local media, i have a folder “music” for example, that plenty of folders of “artists”, and then inside “albums”, and then inside “songs”…you can only play one file and after music stop…

Like on all players, it will be great to play a file and then the next play automatically, and the next, and the next…should be a great feature…like “continuously” playing song…

Hope devellopers will read this post… :wink:

really strange that only a few of us expect this feature :thinking:

1 Like

I asked about this in the 2022.3.x thread. No one replied. Not sure why such functionality is missing because the media browser is almost useless without it.

2 Likes

hello @sparkydave

you are totaly right…useless without this functionality…

Dont understand why we are only 2 of us that expect this basic feature…???

have a nice day

so I’ll just say that I agree that the media browser for music is kind of useless since it doesn’t play an entire album, after one song it just stops. It’s a shame since I would use this all the time because it’s just so much easier to select a song from home assistant and not have to go to my plex server’s IP. I always have homeassistant open so this would be a nice feature. I do love the updates to it though.

@carlos.vroque did you happen to create a blueprint for this? I can’t seem to get my sciprt repeating/looping the mp3 file.

Hi All,

Is this feature available yet or at least a work around? ta

Hi Carlos, Cheers for this! it definitely worked on mp3, but I’m trying to tinker around to get it working to play a playlist. plex playlist to be exact, but it simple doesn’t want to cooperate. I managed to get it working on plex media /single mp3 media.

Any advise? Thanks

This problem is abandoned.

More users need to vote to make this higher in the development list

1 Like

This has been an on-going issue since 2020 and there are still no known solution nor updates from the developers. I really want to have this done too and have been monitoring this thread since last year but as of now, still no cigar.

4 Likes

Just posting to keep the thread alive, but I don’t suspect we’ll ever see movement on this issue.

4 Likes

We will, keep positive thinking! Thanks for bumping!

3 Likes

perhaps we need to submite this function to the " The month of ‘What the Heck?!’ 2023" https://www.home-assistant.io/blog/2022/09/30/the-month-of-what-the-heck/

1 Like