Skip to content

Commit 59a6a3d

Browse files
Update readme.md (#78)
* Update README.md * Fixed bitrate callback not working
1 parent 50d3da1 commit 59a6a3d

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/ESP32_VS1053_Stream.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ bool ESP32_VS1053_Stream::connectToFile(fs::FS &fs, const char *filename, const
800800
}
801801
_playingFile = true;
802802
_remainingBytes = _file.size() - offset;
803+
_bitrateTimer = millis() ?: 1;
803804

804805
return true;
805806
}
@@ -816,6 +817,8 @@ void ESP32_VS1053_Stream::_handleLocalFile()
816817
log_d("file pos: %lu", _file.position());
817818
log_d("remaining bytes: %lu", _remainingBytes);
818819

820+
_updateBitRate();
821+
819822
[[maybe_unused]] const auto startTimeMS = millis();
820823

821824
if (_remainingBytes && _file.position() < _file.size())
@@ -856,12 +859,6 @@ void ESP32_VS1053_Stream::_updateBitRate()
856859

857860
void ESP32_VS1053_Stream::_readBitRate()
858861
{
859-
if (!_http || !_http->connected())
860-
return;
861-
862-
if (_codec != CODEC_UNKNOWN && !_bitrateCallback)
863-
return;
864-
865862
const uint8_t SCI_HDAT0 = 0x08;
866863
const uint8_t SCI_HDAT1 = 0x09;
867864

0 commit comments

Comments
 (0)