Media_player delay about a minute

Hello, how to fix delay on music play?

My code:

alias: Radio M-1
sequence:
  - service: media_player.play_media
    data:
      media_content_type: audio
      media_content_id: https://stream.m-1.fm/m1/aacp64
      extra:
        thumb: >-
          https://upload.wikimedia.org/wikipedia/lt/thumb/5/5c/M-1_logo.png/200px-M-1_logo.png
        title: M - 1
    target:
      entity_id: media_player.darbo_speaker
mode: single

Any other solution?

What delay are you talking about?
Your question leaves a lot for guessing.

I want to play radio on google mini. I wrote script, which I run and wait about a minute while google mini starts playing it. It sucks. Maybe my script is wrong or any have workaround on this?

What if you choose a different radio channel?

I get a long delay on some internet streams, and practically zero delay on others. I think it is something to do with the stream and nothing HA related. No fix as far as I have been able to tell.

I have 3 radio stations and all of them play with delay 30-60 seconds. I think it’s not related to channels and this is the issue for the developers. I think so because if I run https://transliacija.relaxfm.lt/relaxfm128.mp3 in vlc, it works without any delay.

Logs:

How to fix the delay?

2022-01-25 15:06:01 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:01 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:06 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:06 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:11 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:11 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:13 DEBUG (Thread-12) [pychromecast.dial] Resolved service ServiceInfo(type='host', data=('192.168.1.136', 8009)) to 192.168.1.136
2022-01-25 15:06:13 DEBUG (Thread-12) [pychromecast.dial] Resolved service ServiceInfo(type='host', data=('192.168.1.136', 8009)) to 192.168.1.136
2022-01-25 15:06:16 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:16 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:16 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-01-25 15:06:16 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-01-25 15:06:16 INFO (SyncWorker_2) [pychromecast.controllers] Not launching app CC1AD845 - already running
2022-01-25 15:06:16 DEBUG (SyncWorker_2) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Sending: Message urn:x-cast:com.google.cast.media from sender-0 to 2395caa4-7ba6-46d6-9331-57679d003151: {'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}}, 'type': 'LOAD', 'autoplay': True, 'customData': {}, 'requestId': 10, 'sessionId': '2395caa4-7ba6-46d6-9331-57679d003151'}
2022-01-25 15:06:16 DEBUG (Thread-14) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Received: Message urn:x-cast:com.google.cast.media from 2395caa4-7ba6-46d6-9331-57679d003151 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 13, 'playbackRate': 1, 'playerState': 'IDLE', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'currentItemId': 1, 'idleReason': 'INTERRUPTED', 'extendedStatus': {'playerState': 'LOADING', 'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}, 'mediaCategory': 'AUDIO'}, 'mediaSessionId': 14}}], 'requestId': 0}
2022-01-25 15:06:16 DEBUG (Thread-14) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 13, 'playbackRate': 1, 'playerState': 'IDLE', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'currentItemId': 1, 'idleReason': 'INTERRUPTED', 'extendedStatus': {'playerState': 'LOADING', 'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}, 'mediaCategory': 'AUDIO'}, 'mediaSessionId': 14}}], 'requestId': 0}
2022-01-25 15:06:17 DEBUG (Thread-14) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Received: Message urn:x-cast:com.google.cast.media from 2395caa4-7ba6-46d6-9331-57679d003151 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'BUFFERING', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:17 DEBUG (Thread-14) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'BUFFERING', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:18 DEBUG (Thread-14) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Received: Message urn:x-cast:com.google.cast.media from 2395caa4-7ba6-46d6-9331-57679d003151 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'PLAYING', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}, 'mediaCategory': 'AUDIO', 'duration': None, 'tracks': [], 'breakClips': [], 'breaks': []}, 'currentItemId': 1, 'items': [{'itemId': 1, 'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}, 'mediaCategory': 'AUDIO', 'duration': None}, 'autoplay': True, 'customData': {}, 'orderId': 0}], 'repeatMode': 'REPEAT_OFF'}], 'requestId': 10}
2022-01-25 15:06:18 DEBUG (Thread-14) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'PLAYING', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}, 'mediaCategory': 'AUDIO', 'duration': None, 'tracks': [], 'breakClips': [], 'breaks': []}, 'currentItemId': 1, 'items': [{'itemId': 1, 'media': {'contentId': 'http://5.20.223.18/relaxfm128.mp3', 'streamType': 'BUFFERED', 'contentType': 'audio', 'metadata': {'images': [{'url': 'https://relaxfm.lt/wp-content/themes/RelaxFM/images/player-img/rfm-logo-player.png'}], 'metadataType': 0}, 'mediaCategory': 'AUDIO', 'duration': None}, 'autoplay': True, 'customData': {}, 'orderId': 0}], 'repeatMode': 'REPEAT_OFF'}], 'requestId': 10}
2022-01-25 15:06:18 DEBUG (Thread-14) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Received: Message urn:x-cast:com.google.cast.media from 2395caa4-7ba6-46d6-9331-57679d003151 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'BUFFERING', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:18 DEBUG (Thread-14) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'BUFFERING', 'currentTime': 0, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:21 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:21 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:26 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:26 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:31 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:31 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:36 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:36 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:38 DEBUG (Thread-14) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Received: Message urn:x-cast:com.google.cast.media from 2395caa4-7ba6-46d6-9331-57679d003151 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'PLAYING', 'currentTime': 0.317967, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:38 DEBUG (Thread-14) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'PLAYING', 'currentTime': 0.317967, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:39 DEBUG (Thread-14) [pychromecast.socket_client] [Darbo speaker(192.168.1.136):8009] Received: Message urn:x-cast:com.google.cast.media from 2395caa4-7ba6-46d6-9331-57679d003151 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'PLAYING', 'currentTime': 1.325202, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:39 DEBUG (Thread-14) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 14, 'playbackRate': 1, 'playerState': 'PLAYING', 'currentTime': 1.325202, 'supportedMediaCommands': 12303, 'volume': {'level': 1, 'muted': False}, 'activeTrackIds': [], 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2022-01-25 15:06:41 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:41 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:41 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [281473028752432] Connection closed by client
2022-01-25 15:06:43 DEBUG (Thread-12) [pychromecast.dial] Resolved service ServiceInfo(type='host', data=('192.168.1.136', 8009)) to 192.168.1.136
2022-01-25 15:06:43 DEBUG (Thread-12) [pychromecast.dial] Resolved service ServiceInfo(type='host', data=('192.168.1.136', 8009)) to 192.168.1.136
2022-01-25 15:06:46 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:46 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.
2022-01-25 15:06:50 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [281472974502832] Connection closed by client
2022-01-25 15:06:50 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [281472841018624] Connection closed by client
2022-01-25 15:06:51 INFO (MainThread) [charset_normalizer] ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-01-25 15:06:51 INFO (MainThread) [charset_normalizer] ascii is most likely the one. Stopping the process.

I have some speakers that play local mp3/wav files instantly with no delay, others cut off the first few seconds of the file.