esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

i2s media player cant play local files anymore, radio, TTS works great #4443

Open Electronlibre2012 opened 1 year ago

Electronlibre2012 commented 1 year ago

The problem

When i play a mp3 file from my local /media folder, nothing play. In the esp32 media_player its says "playing" but no sound.

Same mp3 file can be played on any other google home.

My i2s media player can play TTS or a lot of radio without issue, so i am sure its not a hardware problem.

i have not use for a while, so i read some report the local files stop working since 2022.11.0 version of HA

Which version of ESPHome has the issue?

2023.4.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.4.5

What platform are you using?

ESP32

Board

esp-wrover-kit

Component causing the issue

i2s_audio

Example YAML snippet

esphome:
  name: audionotifier
  friendly_name: audionotifier

esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 192.168.1.xxx
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
  fast_connect: on
  power_save_mode: none

status_led:
  pin:
    number: GPIO2 #ESP32 OnBroad LED
    inverted: True

sensor:
  - platform: internal_temperature
    name: "Internal Temperature AudioNotifier"  

i2s_audio:
  i2s_lrclk_pin: GPIO33
  i2s_bclk_pin: GPIO19

microphone:
  - platform: i2s_audio
    id: echo_microphone
    i2s_din_pin: GPIO23

voice_assistant:
  microphone: echo_microphone

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: False
    name: ${friendly_name} Button
    id: echo_button
    on_press:
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:

media_player: 
  - platform: i2s_audio
    name: audionotifier Media Player
    id: echo_audio
    dac_type: external
    i2s_dout_pin: GPIO22
    mode: mono

Anything in the logs that might be useful for us?

no error

Additional information

when i play a .mp3 thats NOT WORK:

22:34:12][D][media_player:066]:   Media URL: http://192.168.1.50:8123/media/local/sikmu/A%20Reminiscent%20Drive/Ambrosia/Ambrosia.mp3?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2YmQ4ZWFmZGMyZmE0YjNkYWNkODc1Y2ZjZDQxZDU3YiIsInBhdGgiOiIvbWVkaWEvbG9jYWwvc2lrbXUvQSBSZW1pbmlzY2VudCBEcml2ZS9BbWJyb3NpYS9BbWJyb3NpYS5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE2ODIxMDIwNTIsImV4cCI6MTY4MjE4ODQ1Mn0.qnS-O37sXv-E58lQsRoAm97rDp7NmbvslURks_ICvws
[22:37:56][V][component:204]: Component i2s_audio.media_player took a long time for an operation (0.55 s).
[22:37:56][V][component:205]: Components should block for at most 20-30ms.

when i play a TTS message that WORK:

[D][media_player:066]:   Media URL: http://192.168.1.50:8123/api/tts_proxy/375fa026067a22b9081c7f2ed36ed653b7ac6222_fr_-_google_translate.mp3
[22:39:28][V][component:204]: Component api took a long time for an operation (0.10 s).
[22:39:28][V][component:205]: Components should block for at most 20-30ms.
[22:39:37][V][component:204]: Component i2s_audio.media_player took a long time for an operation (0.34 s).
[22:39:37][V][component:205]: Components should block for at most 20-30ms.
[22:39:37][V][component:204]: Component i2s_audio.media_player took a long time for an operation (0.33 s).
[22:39:37][V][component:205]: Components should block for at most 20-30ms.

when i play a radio that WORK:

[22:43:45][D][media_player:066]:   Media URL: http://stream.zeno.fm/g4gf4u13k0hvv
[22:43:46][V][component:204]: Component i2s_audio.media_player took a long time for an operation (1.07 s).
[22:43:46][V][component:205]: Components should block for at most 20-30ms.
[22:43:47][V][component:204]: Component i2s_audio.media_player took a long time for an operation (0.57 s).
[22:43:47][V][component:205]: Components should block for at most 20-30ms.

perhaps something has change with "auth", does someone has an idea please? Files served from media are protected by Home Assistant authentication unlike those served from www (as per the doc say).

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

gatonero commented 1 year ago

This happens to mee also.

lemestrez commented 7 months ago

This problem is the same for me. I also try out to play sources from an other server from the network and it works. If I try to play the same sources over "HA Music Assist" the source URL is again the HA and it not playing. In the logs i didn't see errors or problems. Same logs as shown above.

fantnhu commented 6 months ago

+1

RynoM commented 6 months ago

Similar issue, "Component i2s_audio.media_player took a long time for an operation" but has worked once or twice in the past with the same hardware and config.

RynoM commented 6 months ago

Turns out for me the cause was trying to play https media urls, which silently fail. See e.g. https://github.com/esphome/feature-requests/issues/2179

newpond commented 5 months ago

try popping this in your configuration.yaml and putting your media files in /config/www/media folder.

homeassistant: media_dirs: media: /config/www