diff --git a/esphome/components/i2s_audio/media_player/__init__.py b/esphome/components/i2s_audio/media_player/__init__.py index a7693307d3..95bb13b60b 100644 --- a/esphome/components/i2s_audio/media_player/__init__.py +++ b/esphome/components/i2s_audio/media_player/__init__.py @@ -131,6 +131,6 @@ async def to_code(config): cg.add_library( name="ESP32-audioI2S", version=None, - # Note: use a custom fork that removes the length limit on the host parameter in connecttohost() - repository="https://github.com/shadow578/ESP32-audioI2S.git#remove_host_length_limit", + # use close-to latest commit, since tagged versions are fairly irregular... + repository="https://github.com/schreibfaul1/ESP32-audioI2S.git#1bc79e547ebb6f917bf82b47bec9b7e6a9b7e314", ) diff --git a/esphome/components/i2s_audio/media_player/i2s_audio_media_player.cpp b/esphome/components/i2s_audio/media_player/i2s_audio_media_player.cpp index 1aba81ba68..f33f05092c 100644 --- a/esphome/components/i2s_audio/media_player/i2s_audio_media_player.cpp +++ b/esphome/components/i2s_audio/media_player/i2s_audio_media_player.cpp @@ -271,6 +271,14 @@ bool I2SAudioMediaPlayer::connecttouri_(const std::string uri) { // web stream? if (uri.find("http://", 0) == 0 || uri.find("https://", 0) == 0) { ESP_LOGD(TAG, "ConnectTo WebStream '%s'", uri.c_str()); + + if (uri.size() > 2048) { + // ESP32-audioI2S limits the URI to 2048 characters + // (since https://github.com/schreibfaul1/ESP32-audioI2S/commit/b1b89a9f64b73b0b171493bf55e6158f37a0bccd) + ESP_LOGE(TAG, "WebStream URI too long"); + return false; + } + return this->audio_->connecttohost(uri.c_str()); }