ESP-Home media Player -- play https media url

Dear All,

looking solution for the issue:
-using esp32 and external i2s DAC as a media player, and it works fine on my test environment .
-Im usig https access to my production system, and moved the esp32+DAC to this system. I can not
play any url in this environment, I guess, because these are https://domain.duckdns.org:8123/… urls,
and not local https urls, as on my test system.

Is there any idea/solution to fix it? Thanks in advance!!

1 Like

thanks for your reply!
You are right, guessing does not help, even on the top of the fact, that webradio streams are working…but tts, and play local media files are not…
In HA log i see nothing, in the esp32 media player log i have this:

15:05:37	[W]	[api.connection:080]	
Home Assistant 2022.7.0 (::FFFF:C0A8:105): Connection closed
15:05:37	[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
15:05:37	[D]	[media_player:066]	
  Media URL: https://icast.connectmedia.hu/5301/live.mp3
15:06:17	[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
15:06:17	[D]	[media_player:063]	
  Command: PAUSE
15:06:17	[D]	[sensor:125]	
'ESP32 Media Bedroom': Sending state -71.00000 dBm with 0 decimals of accuracy
15:06:24	[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
15:06:24	[D]	[media_player:066]	
  Media URL: https://ccc.duckdns.org:8123/api/tts_proxy/ccc54006efc727183476cb95031f2f9fc760ffe7_en_-_google_translate.mp3
15:06:30	[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
15:06:30	[D]	[media_player:066]	
  Media URL: https://ccc.duckdns.org:8123/api/tts_proxy/ccc54006efc727183476cb95031f2f9fc760ffe7_en_-_google_translate.mp3
15:06:37	[D]	[api:102]	
Accepted ::FFFF:C0A8:105
15:06:37	[W]	[api.connection:080]	
Home Assistant 2022.7.0 (::FFFF:C0A8:105): Connection closed

and the media player shows: “play nothing”

thanks!!!

here is the log - tts:

[V]	[api.connection:843]	
Hello from client: 'Home Assistant 2022.7.0 (::FFFF:C0A8:105)'
15:24:44	[W]	[api.connection:080]	
Home Assistant 2022.7.0 (::FFFF:C0A8:105): Connection closed
15:24:44	[V]	[api:114]	
Removing connection to Home Assistant 2022.7.0 (::FFFF:C0A8:105)
15:25:01	[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
15:25:01	[D]	[media_player:066]	
  Media URL: https://ccc.duckdns.org:8123/api/tts_proxy/ccc54006efc727183476cb95031f2f9fc760ffe7_en_-_google_translate.mp3
15:25:04	[V]	[component:199]	
Component api took a long time for an operation (2.99 s).
15:25:04	[V]	[component:200]	
Components should block for at most 20-30ms.
15:25:21	[V]	[sensor:074]	
'ESP32 Media Bedroom': Received new state -68.000000
15:25:21	[D]	[sensor:125]	
'ESP32 Media Bedroom': Sending state -68.00000 dBm with 0 decimals of accuracy
15:25:21	[V]	[json:031]	
Attempting to allocate 512 bytes for JSON serialization
15:25:21	[V]	[json:051]	
Size after shrink 84 bytes
15:25:21	[V]	[json:051]	
Size after shrink 84 bytes
15:25:44	[D]	[api:102]	
Accepted ::FFFF:C0A8:105
15:25:44	[V]	[api.connection:843]	
Hello from client: 'Home Assistant 2022.7.0 (::FFFF:C0A8:105)'
15:25:44	[W]	[api.connection:080]	
Home Assistant 2022.7.0 (::FFFF:C0A8:105): Connection closed
15:25:44	[V]	[api:114]	
Removing connection to Home Assistant 2022.7.0 (::FFFF:C0A8:105)

and if play a local mp4 file:

[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
15:26:41	[D]	[media_player:066]	
  Media URL: https://ccc.duckdns.org:8123/media/local/usb_drive/testing_mp3/01%20-%20Believe%20In%20Love%20(LP%20Version).mp3?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjZTA4NmU2ODM0MzM0MWU1OGU5NzUzNDYzMDk5ZTIzOCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvdXNiX2RyaXZlL3Rlc3RpbmdfbXAzLzAxIC0gQmVsaWV2ZSBJbiBMb3ZlIChMUCBWZXJzaW9uKS5tcDMiLCJwYXJhbXMiOnt9LCJpYXQiOjE2NTgzMjM2MDAsImV4cCI6MTY1ODQxMDAwMH0.tdViBb8Fn0oDmz9YeOBzO4e5DWnDI_99xwm9mieC3io
15:26:44	[V]	[component:199]	
Component api took a long time for an operation (3.09 s).
15:26:44	[V]	[component:200]	
Components should block for at most 20-30ms.
15:26:44	[D]	[api:102]	
Accepted ::FFFF:C0A8:105
15:26:44	[V]	[api.connection:843]	
Hello from client: 'Home Assistant 2022.7.0 (::FFFF:C0A8:105)'
15:26:44	[W]	[api.connection:080]	
Home Assistant 2022.7.0 (::FFFF:C0A8:105): Connection closed
15:26:44	[V]	[api:114]	
Removing connection to Home Assistant 2022.7.0 (::FFFF:C0A8:105)

well, i have just HA to use to steram to a device, and if i play the same file from the same HA to a rpi3/openelec - works fine, or play to a browser, or a vlc client are okay as well.

thanks for your time to investigate!
Of course, going to run very verbose!

the fact, that the same esp32/DAC, same code, but connected to a test HA, using simple inside IP, like 192.168.1.5:8123 works perfectly with mp3/tts/radio - so this is strange…

Hi,
i have run very_verbose, and this is i got:

11:16:23	[D]	[media_player:059]	
'ESP32 Media Bedroom' - Setting
11:16:23	[D]	[media_player:066]	
  Media URL: https://ccc.duckdns.org:8123/media/local/usb_drive/testing_mp3/02%20-%20It%20Must%20Have%20Been%20Love.mp3?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjZTA4NmU2ODM0MzM0MWU1OGU5NzUzNDYzMDk5ZTIzOCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvdXNiX2RyaXZlL3Rlc3RpbmdfbXAzLzAyIC0gSXQgTXVzdCBIYXZlIEJlZW4gTG92ZS5tcDMiLCJwYXJhbXMiOnt9LCJpYXQiOjE2NTgzOTQ5ODIsImV4cCI6MTY1ODQ4MTM4Mn0.L26pVv_uDcbqOLs0tqyosBab21hiqmnD14zmPnwlZb4
11:16:26	[VV	][api.service:324]	
send_media_player_state_response: MediaPlayerStateResponse {
  key: 1425399028
  state: MEDIA_PLAYER_STATE_PLAYING
  volume: 1
  muted: NO
}
11:16:26	[V]	[component:199]	
Component api took a long time for an operation (3.11 s).
11:16:26	[V]	[component:200]	
Components should block for at most 20-30ms.
11:16:26	[VV	][api.service:324]	
send_media_player_state_response: MediaPlayerStateResponse {
  key: 1425399028
  state: MEDIA_PLAYER_STATE_IDLE
  volume: 1
  muted: NO
}
11:16:31	[VV	][scheduler:196]	
Running interval '' with interval=10000 last_execution=189739 (now=199742)
11:16:32	[VV	][api.service:373]	
on_ping_request: PingRequest {}
11:16:32	[VV	][api.service:043]	
send_ping_response: PingResponse {}
11:16:41	[VV	][scheduler:196]	
Running interval '' with interval=10000 last_execution=199739 (now=209739)
11:16:45	[VV	][scheduler:196]	
Running interval 'update' with interval=60000 last_execution=154055 (now=214059)
11:16:45	[V]	[sensor:074]	
'ESP32 Media Bedroom': Received new state -67.000000
11:16:45	[D]	[sensor:125]	
'ESP32 Media Bedroom': Sending state -67.00000 dBm with 0 decimals of accuracy
11:16:45	[V]	[json:031]	
Attempting to allocate 512 bytes for JSON serialization
11:16:45	[V]	[json:051]	
Size after shrink 84 bytes
11:16:45	[V]	[json:051]	
Size after shrink 84 bytes
11:16:45	[VV	][api.service:140]	
send_sensor_state_response: SensorStateResponse {
  key: 1425399028
  state: -67
  missing_state: NO
}
11:16:45	[VV	][api.service:140]	
send_sensor_state_response: SensorStateResponse {
  key: 1425399028
  state: -67
  missing_state: NO
}
11:16:46	[VV	][scheduler:196]	
Running interval '' with interval=60000 last_execution=154495 (now=214500)
11:16:48	[VV	][api.service:373]	
on_ping_request: PingRequest {}
11:16:48	[VV	][api.service:043]	
send_ping_response: PingResponse {}

it was a try to play a local file…
thank you for your time helping me!

just a note - maybe it helps - if i copy the link, sent to player by HA, as media url, and open from a browser in the same subnet, it works…

and using devtools, and calling the service Media player: Play media - and use the media url as content ID - does not work — does not matter using local ip, duckdns address or external IP with https. But webradio with https works fine…

Hi, is there any solution for this problem? I have the same issue on my HA - ESP setup. Could somebody help us? Or is there any workaround for this problem?

i also have the same problem, very frustrating.

Count me in on this one as well. I can play local url, but external url links it is unable to play. There is no errors in log. Anyone found the issue??

I’ve added a audio_info snippet to get more log in, but it doesn’t tell me much.

log:


[10:20:31][C][audio:135]: Audio:
[10:20:35][D][media_player:059]: 'razer-leviathan-player' - Setting
[10:20:35][D][media_player:066]:   Media URL: http://nrk-mms-live.telenorcdn.net:80/nrk_radio_jazz_mp3_h
[10:20:35][D][main:312]: audio_info: buffers freed, free Heap: 202508 bytes
[10:20:35][D][main:312]: audio_info: Connect to new host: "http://nrk-mms-live.telenorcdn.net:80/nrk_radio_jazz_mp3_h"
[10:20:35][D][main:312]: audio_info: Connect to "nrk-mms-live.telenorcdn.net" on port 80, extension "/nrk_radio_jazz_mp3_h"
[10:20:35][D][main:312]: audio_info: Request http://nrk-mms-live.telenorcdn.net:80/nrk_radio_jazz_mp3_h failed!
[10:20:35][D][main:226]: Playback started!
[10:20:35][D][main:220]: Playback finished!

Same issue here.
ESP32 with external DAC. Latest (2023.3.2) ESPHome add-on.
It plays local mp3 files and text to speach from Nabucasa.
It will NOT play radio links (from Media libray). The same radio will play on the browser and other media players (like Squuselite) in my system.
Here is the VERY_VERBOSE log from ESPHome:

[22:51:15][D][media_player:059]: 'ESPHome I2S Media Player' - Setting
[22:51:15][D][media_player:066]:   Media URL: https://stream.0nlineradio.com/80s-rock?ref=radiobrowser
[22:51:15][VV][api.service:324]: send_media_player_state_response: MediaPlayerStateResponse {
  key: 3210548230
  state: MEDIA_PLAYER_STATE_PLAYING
  volume: 1
  muted: NO
}
[22:51:15][V][component:204]: Component api took a long time for an operation (0.16 s).
[22:51:15][V][component:205]: Components should block for at most 20-30ms.
[22:51:15][VV][api.service:324]: send_media_player_state_response: MediaPlayerStateResponse {
  key: 3210548230
  state: MEDIA_PLAYER_STATE_IDLE
  volume: 1
  muted: NO
}

It does not tell me much apart that immediately after sending the link to play - which looks like is accepted then it changes status to IDLE.
Any help to resolve this will be appreciated.

Interesting enough (by some blind clicking) I have found some of the radio working, while the most of other radio links do not work.
There are examples of working for me:

Media URL: http://212.34.233.78:8000/live
Media URL: http://83.169.36.75:8000/stream
Media URL: http://5.39.16.62:8004/tre
Media URL: http://149.210.138.12:8000/nommeraadio
Media URL: http://5.201.13.191/live

Can you check how is your system working with them ?

Also I have opened issue on github for this.

Hello. I just tested some urls (2) above and it works.

So, that proves that you CAN play external links! Which also means that issue is not with the links (internal/external) but rather with the player itself which can play some content and cannot other.
Now how can we see what kind of coding is in the radio station which can play and what coding is on others - which cannot be played.

Oh. I just reread my previous post above. At the time of setup, I had trouble playing url link, but I had fixed it. Can’t remember what I did, but it works. I was able to play external links and local mp3 files. After some updates of esphome ( I am assuming is the culprit), the local mp3 files stopped working. No errors in the log, no audio coming out of the speaker. If I copy the url link that esphome generate in the log and play it via the browser, it works. Thus, I can also create tts message and it will play fine.

With the latest ESPHome version and HA version my setup is playing mp3 from local HA server with no problem. External links (most of the radio stations) do not play :frowning:

I am a little burnt out from messing with HA. There is always something broken. My current esphome version is 2023.2.2, I’ve read from other post that some of their esp devices would not connect any longer after upgrading to 2023.3. I have yet to upgrade homeassistant to 2023.4.

Update: I have just updated homeassistant to 2023.4.1 and esphome 2023.3.2. No go on playing mp3 files.

Hello guys,

have you found a solution? same boat.

it has worked before and some days ago it works again, then today i want to listen some mucis and its doesnt work again…

I only use local files on /media folder, where there is HDD mount with samba-nas AddOn or DLNA files on my servers.

it plays from HTTP but not HTTPS, same here

Still no fix on v2023.6.4 but I can play http on an esp8266.