esphome / firmware

Holds firmware configuration files for projects that the ESPHome team provides.
https://esphome.io/projects
Apache License 2.0
126 stars 89 forks source link

Atom media player only playing one file #176

Open psfshr opened 3 months ago

psfshr commented 3 months ago

I have a pair of Atom devices (one Atom Echo, one Atom Lite with the speaker kit attached), which I’m using as a basic media player for ambient sounds around the house while working (think rain sounds, etc).

I’ve noted that they will only play one media source/file, and to play something else requires a reboot of the device, e.g. (testing with Media function in HA)

  1. Plug the device in
  2. Start playing a media file, plays ok
  3. Pause, play, pause, play, etc on that file, plays ok
  4. Start playing a different media file, doesn’t play
  5. Try playing the first media file again, doesn’t play
  6. Reboot the device
  7. Repeat from 2 above

I’m running on current versions of all components, and using the default “build” provided by the “ready made project” option on ESPHome, with a vanilla config, e.g.:

` substitutions: name: m5stack-atom-speaker-kit-315bd0 friendly_name: Study Atom Speaker 315bd0 packages: m5stack.atom-speaker-kit: github://esphome/firmware/media-player/m5stack-atom-speaker-kit.yaml@main esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name} api: encryption: key:

wifi: ssid: !secret wifi_ssid password: !secret wifi_password fast_connect: true `

Log entries for versions... [12:19:09][I][app:102]: ESPHome version 2024.2.2 compiled on Mar 6 2024, 11:26:22 [12:19:09][I][app:104]: Project m5stack.atom-speaker-kit version 1.0

Log entries for testing...

[12:19:27][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:19:27][D][media_player:066]: Media URL: http://a.b.c.d:8123/media/local/BlueyMedia/rain-and-thunder-16705.mp3?authSig=<snip> [12:19:28][W][component:214]: Component i2s_audio.media_player took a long time for an operation (0.54 s). [12:19:28][W][component:215]: Components should block for at most 20-30ms. [12:19:47][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:19:47][D][media_player:063]: Command: PAUSE [12:19:53][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:19:53][D][media_player:063]: Command: PLAY [12:20:01][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:20:01][D][media_player:063]: Command: PAUSE [12:20:05][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:20:05][D][media_player:066]: Media URL: http://a.b.c.d:8123/media/local/BlueyMedia/birds-in-the-morning-24147.mp3?authSig=<snip> [12:20:15][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:20:15][D][media_player:063]: Command: PLAY [12:20:25][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [12:20:25][D][media_player:063]: Command: PLAY

Tests timestamped 12:19:27 through 12:20:01 are successful (first file, 2&3 above). Tests timestamped 12:20:05 through 12:20:25 fail (second file, 4 above).

Any idea here? I presume that it should be possible to switch back and forth between media files/streams without rebooting?

psfshr commented 3 months ago

Update to the above issue. Testing with the now current version (ESPHome version 2024.3.0), it looks like the issue is when you open a non-MP3 stream (e.g. AAC) it causes the device to crash/hang/reset, and while you can reconnect to it for logging it then won't play any further streams until a hard power-off & power-on again.

[11:23:39][D][api:102]: Accepted 192.168.2.10 [11:23:39][D][api.connection:1159]: Home Assistant 2024.3.1 (192.168.2.10): Connected successfully [11:23:44][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:23:44][D][media_player:066]: Media URL: http://192.168.2.10:8123/media/local/BlueyMedia/rain-and-thunder-16705.mp3?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiZjQ5ZGNmMjRmOTk0OTIxODE0MDNjNjY1YzQzMGIxOCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvQmx1ZXlNZWRpYS9yYWluLWFuZC10aHVuZGVyLTE2NzA1Lm1wMyIsInBhcmFtcyI6W10sImlhdCI6MTcxMDkzMzgyNCwiZXhwIjoxNzExMDIwMjI0fQ.2YiLO39su6S1PoIm0E_UGVghnA88CVht0h4zpwhhtpQ [11:23:45][W][component:232]: Component i2s_audio.media_player took a long time for an operation (537 ms). [11:23:45][W][component:233]: Components should block for at most 30 ms. [11:23:54][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:23:54][D][media_player:066]: Media URL: http://192.168.2.10:8123/media/local/BlueyMedia/birds-in-the-morning-24147.mp3?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiZjQ5ZGNmMjRmOTk0OTIxODE0MDNjNjY1YzQzMGIxOCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvQmx1ZXlNZWRpYS9iaXJkcy1pbi10aGUtbW9ybmluZy0yNDE0Ny5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE3MTA5MzM4MzQsImV4cCI6MTcxMTAyMDIzNH0.skC5Cdq0imOeb1gOkJvZ11hHyNxyTuq9GQwpKI4E8I8 [11:23:55][W][component:232]: Component api took a long time for an operation (359 ms). [11:23:55][W][component:233]: Components should block for at most 30 ms. [11:24:32][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:24:32][D][media_player:066]: Media URL: http://rainyday.radio.mynoise.net/ [11:24:32][W][component:232]: Component api took a long time for an operation (396 ms). [11:24:32][W][component:233]: Components should block for at most 30 ms. [11:24:32][W][component:232]: Component i2s_audio.media_player took a long time for an operation (332 ms). [11:24:32][W][component:233]: Components should block for at most 30 ms. [11:24:38][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:24:38][D][media_player:066]: Media URL: http://zengarden.radio.mynoise.net/ [11:24:38][W][component:232]: Component api took a long time for an operation (253 ms). [11:24:38][W][component:233]: Components should block for at most 30 ms. [11:24:39][W][component:232]: Component i2s_audio.media_player took a long time for an operation (163 ms). [11:24:39][W][component:233]: Components should block for at most 30 ms. [11:24:43][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:24:43][D][media_player:066]: Media URL: http://oceanwaves.radio.mynoise.net/ [11:24:43][W][component:232]: Component api took a long time for an operation (327 ms). [11:24:43][W][component:233]: Components should block for at most 30 ms. [11:24:43][W][component:232]: Component i2s_audio.media_player took a long time for an operation (147 ms). [11:24:43][W][component:233]: Components should block for at most 30 ms. [11:25:34][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:25:34][D][media_player:066]: Media URL: https://playerservices.streamtheworld.com/api/livestream-redirect/RFMAAC_SC [11:25:35][W][component:232]: Component api took a long time for an operation (891 ms). [11:25:35][W][component:233]: Components should block for at most 30 ms. [11:25:36][W][component:232]: Component i2s_audio.media_player took a long time for an operation (899 ms). [11:25:36][W][component:233]: Components should block for at most 30 ms. WARNING m5stack-atom-lite-315bd0 @ 192.168.2.51: Connection error occurred: [Errno 104] Connection reset by peer INFO Processing unexpected disconnect from ESPHome API for m5stack-atom-lite-315bd0 @ 192.168.2.51 WARNING Disconnected from API INFO Successfully connected to m5stack-atom-lite-315bd0 @ 192.168.2.51 in 0.008s INFO Successful handshake with m5stack-atom-lite-315bd0 @ 192.168.2.51 in 0.100s [11:26:00][D][media_player:059]: 'Study Atom Speaker 315bd0' - Setting [11:26:00][D][media_player:066]: Media URL: https://23603.live.streamtheworld.com/RFMAAC.aac [11:26:01][W][component:232]: Component i2s_audio.media_player took a long time for an operation (1331 ms). [11:26:01][W][component:233]: Components should block for at most 30 ms.

The last 2 streams above seem to be both AAC and cause the issue, the previous streams seem to be MP3, some local from HA and the others from the Internet.

psfshr commented 3 months ago

Tested with AAC sample files downloaded from https://getsamplefiles.com/sample-audio-files/aac On the shorter file (sample-3) the device attempts to decode, fails to play, but eventually seems to recover. On a longer file (sample-1) the device attempts to decode, fails to play, and eventually exceptions and resets (log attached) esp-web-tools-logs.txt. .