schreibfaul1 / ESP32-audioI2S

Play mp3 files from SD via I2S
GNU General Public License v3.0
1.12k stars 288 forks source link

Starting audio from a position does not work in connecttoFS #803

Closed kungfupizza closed 1 month ago

kungfupizza commented 2 months ago

Here is what I am trying as flow, Start playing a song with, audio.connecttoFS(SD, "xyz.mp3");

Stop after some time and get the seek, uint32_t seek = audio.getFilePos();

Restart the song from a seek, audio.connecttoFS(SD, "xyz.mp3", seek); here seek value is 14756

The song starts from start instead of starting from that seek value. Some useful prints from Audio::processLocalFile processLocalFile(): m_audioDataStart 138 processLocalFile(): m_resumeFilePos 14756 processLocalFile(): Corrected m_resumeFilePos 22706

What am I doing wrong?

schreibfaul1 commented 2 months ago

The file pointer is not synchronized with the audio currently being played. audio.stopSong() returns a calculated value that you can use in connecttoFS().

kungfupizza commented 2 months ago

Thank you! It has gotten better with stopSong BUT still does not start from the point it left rather starts from just a few seconds from the start.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.